[Git][ghc/ghc][wip/backports-8.10] 2 commits: hadrian: Reindent Settings.Warnings

Ben Gamari gitlab at gitlab.haskell.org
Mon Dec 14 15:13:38 UTC 2020



Ben Gamari pushed to branch wip/backports-8.10 at Glasgow Haskell Compiler / GHC


Commits:
63e10d71 by Ben Gamari at 2020-12-14T10:10:38-05:00
hadrian: Reindent Settings.Warnings

The previous state was quite illegible.

- - - - -
eb9c45a0 by Ben Gamari at 2020-12-14T10:12:26-05:00
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.

- - - - -


2 changed files:

- hadrian/src/Flavour.hs
- hadrian/src/Settings/Warnings.hs


Changes:

=====================================
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


=====================================
hadrian/src/Settings/Warnings.hs
=====================================
@@ -20,38 +20,39 @@ ghcWarningsArgs = do
     isIntegerSimple <- (== integerSimple) <$> getIntegerPackage
     mconcat
         [ stage0 ? mconcat
-        [ libraryPackage       ? pure [ "-fno-warn-deprecated-flags" ]
-        , package terminfo     ? pure [ "-fno-warn-unused-imports" ]
-        , package transformers ? pure [ "-fno-warn-unused-matches"
-                                      , "-fno-warn-unused-imports" ] ]
+          [ libraryPackage       ? pure [ "-fno-warn-deprecated-flags" ]
+          , package terminfo     ? pure [ "-fno-warn-unused-imports" ]
+          , package transformers ? pure [ "-fno-warn-unused-matches"
+                                        , "-fno-warn-unused-imports" ] ]
         , notStage0 ? mconcat
-        [ libraryPackage       ? pure [ "-Wno-deprecated-flags" ]
-        , package base         ? pure [ "-Wno-trustworthy-safe" ]
-        , package binary       ? pure [ "-Wno-deprecations" ]
-        , package bytestring   ? pure [ "-Wno-inline-rule-shadowing" ]
-        , package compiler     ? pure [ "-Wcpp-undef" ]
-        , package directory    ? pure [ "-Wno-unused-imports" ]
-        , package ghc          ? pure [ "-Wcpp-undef" ]
-        , package ghcPrim      ? pure [ "-Wno-trustworthy-safe" ]
-        , package haddock      ? pure [ "-Wno-unused-imports"
-                                      , "-Wno-deprecations" ]
-        , package haskeline    ? pure [ "-Wno-deprecations"
-                                      , "-Wno-unused-imports"
-                                      , "-Wno-redundant-constraints"
-                                      , "-Wno-simplifiable-class-constraints" ]
-        , package pretty       ? pure [ "-Wno-unused-imports" ]
-        , package primitive    ? pure [ "-Wno-unused-imports"
-                                      , "-Wno-deprecations" ]
-        , package rts          ? pure [ "-Wcpp-undef" ]
-        , package terminfo     ? pure [ "-Wno-unused-imports" ]
-        , isIntegerSimple      ?
-          package text         ? pure [ "-Wno-unused-imports" ]
-        , package transformers ? pure [ "-Wno-unused-matches"
-                                      , "-Wno-unused-imports"
-                                      , "-Wno-redundant-constraints"
-                                      , "-Wno-orphans" ]
-        , package win32        ? pure [ "-Wno-trustworthy-safe" ]
-        , package xhtml        ? pure [ "-Wno-unused-imports" ] ]
+          [ libraryPackage       ? pure [ "-Wno-deprecated-flags" ]
+          , package base         ? pure [ "-Wno-trustworthy-safe" ]
+          , package binary       ? pure [ "-Wno-deprecations" ]
+          , package bytestring   ? pure [ "-Wno-inline-rule-shadowing" ]
+          , package compiler     ? pure [ "-Wcpp-undef" ]
+          , package directory    ? pure [ "-Wno-unused-imports" ]
+          , package ghc          ? pure [ "-Wcpp-undef" ]
+          , package ghcPrim      ? pure [ "-Wno-trustworthy-safe" ]
+          , package haddock      ? pure [ "-Wno-unused-imports"
+                                        , "-Wno-deprecations" ]
+          , package haskeline    ? pure [ "-Wno-deprecations"
+                                        , "-Wno-unused-imports"
+                                        , "-Wno-redundant-constraints"
+                                        , "-Wno-simplifiable-class-constraints" ]
+          , package pretty       ? pure [ "-Wno-unused-imports" ]
+          , package primitive    ? pure [ "-Wno-unused-imports"
+                                        , "-Wno-deprecations" ]
+          , package rts          ? pure [ "-Wcpp-undef" ]
+          , package terminfo     ? pure [ "-Wno-unused-imports" ]
+          , isIntegerSimple      ?
+            package text         ? pure [ "-Wno-unused-imports" ]
+          , package transformers ? pure [ "-Wno-unused-matches"
+                                        , "-Wno-unused-imports"
+                                        , "-Wno-redundant-constraints"
+                                        , "-Wno-orphans" ]
+          , package win32        ? pure [ "-Wno-trustworthy-safe" ]
+          , package xhtml        ? pure [ "-Wno-unused-imports" ]
+          ]
         , mconcat
-        [ package cabal        ? pure [ "-Wno-error=deprecations" ] ]
+          [ package cabal        ? pure [ "-Wno-error=deprecations" ] ]
         ]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cd3806aea179f93b06aa8e3154135e4939032330...eb9c45a0d612f8e16a0b0abd686534fedfdbac78

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cd3806aea179f93b06aa8e3154135e4939032330...eb9c45a0d612f8e16a0b0abd686534fedfdbac78
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201214/f5d42f56/attachment-0001.html>


More information about the ghc-commits mailing list