From afc39ff5395cc0b0aa6f20165614f53c750dfb5d Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Mon, 14 Dec 2020 10:12:26 -0500 Subject: [PATCH] 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. --- hadrian/src/Flavour.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs index e3efebfdf910..1b53b76357a5 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 -- GitLab