diff --git a/Makefile.am b/Makefile.am index d6a0e28a03db97163ac748b355e34ccf4ea2a74e..7daf7788defc097e504cdd5062dd70bd551d93d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -401,7 +401,12 @@ HS_ALL_PROGS = \ HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS)) HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail -HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools +HFLAGS = \ + -O -Wall -Werror -ihtools \ + -fwarn-monomorphism-restriction \ + -fwarn-tabs \ + $(GHC_BYVERSION_FLAGS) + # extra flags that can be overriden on the command line (e.g. -Wwarn, etc.) HEXTRA = # internal extra flags (used for htest/test mainly) diff --git a/configure.ac b/configure.ac index 3e134a21db5b2340a8cd0d2f86442b00396246ab..1cc62d5df13336be62f788ab54e326f50dec934d 100644 --- a/configure.ac +++ b/configure.ac @@ -430,6 +430,17 @@ if test -z "$GHC"; then AC_MSG_FAILURE([ghc not found, compilation will not possible]) fi +AC_MSG_CHECKING([checking for extra GHC flags]) +GHC_BYVERSION_FLAGS="" +# check for GHC supported flags that vary accross versions +for flag in -fwarn-incomplete-uni-patterns; do + if $GHC -e "0" $flag >/dev/null 2>/dev/null; then + GHC_BYVERSION_FLAGS="$GHC_BYVERSION_FLAGS $flag" + fi +done +AC_MSG_RESULT($GHC_BYVERSION_FLAGS) +AC_SUBST(GHC_BYVERSION_FLAGS) + # Check for ghc-pkg AC_ARG_VAR(GHC_PKG, [ghc-pkg path]) AC_PATH_PROG(GHC_PKG, [ghc-pkg], []) diff --git a/htest/Test/Ganeti/HTools/Cluster.hs b/htest/Test/Ganeti/HTools/Cluster.hs index fdc49240b03fa32f9f119173527798422e932bd4..96bd1cf52baa40f516ea5e1b4abd529ee7f1efa3 100644 --- a/htest/Test/Ganeti/HTools/Cluster.hs +++ b/htest/Test/Ganeti/HTools/Cluster.hs @@ -346,7 +346,11 @@ prop_AllocBalance = prop_CheckConsistency :: Node.Node -> Instance.Instance -> Bool prop_CheckConsistency node inst = let nl = makeSmallCluster node 3 - [node1, node2, node3] = Container.elems nl + (node1, node2, node3) = + case Container.elems nl of + [a, b, c] -> (a, b, c) + l -> error $ "Invalid node list out of makeSmallCluster/3: " ++ + show l node3' = node3 { Node.group = 1 } nl' = Container.add (Node.idx node3') node3' nl inst1 = Instance.setBoth inst (Node.idx node1) (Node.idx node2)