summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-14 10:12:26 -0500
committerBen Gamari <ben@smart-cactus.org>2020-12-16 17:00:31 -0500
commitafc39ff5395cc0b0aa6f20165614f53c750dfb5d (patch)
tree18007ed88bcc6c8601861f2683b5a4e9010b3e6c
parentb3cc6847a5f598241b0d181faf54191aff6072ce (diff)
downloadhaskell-afc39ff5395cc0b0aa6f20165614f53c750dfb5d.tar.gz
hadrian: Pass -Werror before other arguments
Previously we would append -Werror to the argument list. However, this ended up overriding the -Wno-error=... flags in Settings.Warnings.
-rw-r--r--hadrian/src/Flavour.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index e3efebfdf9..1b53b76357 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -2,7 +2,7 @@ module Flavour
( Flavour (..), werror
, DocTargets, DocTarget(..)
-- * Flavour transformers
- , addArgs
+ , addArgs, addArgsBefore
, splitSections, splitSectionsIf
, enableThreadSanitizer
, enableDebugInfo, enableTickyGhc
@@ -71,10 +71,15 @@ data DocTarget = Haddocks | SphinxHTML | SphinxPDFs | SphinxMan | SphinxInfo
addArgs :: Args -> Flavour -> Flavour
addArgs args' fl = fl { args = args fl <> args' }
+addArgsBefore :: Args -> Flavour -> Flavour
+addArgsBefore args' fl = fl { args = args' <> args fl }
+
-- | Turn on -Werror for packages built with the stage1 compiler.
-- It mimics the CI settings so is useful to turn on when developing.
werror :: Flavour -> Flavour
-werror = addArgs (builder Ghc ? notStage0 ? arg "-Werror")
+werror = addArgsBefore (builder Ghc ? notStage0 ? arg "-Werror")
+ -- N.B. We add this flag *before* the others to ensure that we don't override
+ -- the -Wno-error flags defined in "Settings.Warnings".
-- | Build C and Haskell objects with debugging information.
enableDebugInfo :: Flavour -> Flavour