[commit: ghc] wip/nfs-locking: Add Werror to CC and HC (#309) (4952e80)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:18:40 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/4952e8022f805d31035c3ecfd354518c72d07557/ghc

>---------------------------------------------------------------

commit 4952e8022f805d31035c3ecfd354518c72d07557
Author: Zhen Zhang <izgzhen at gmail.com>
Date:   Wed May 3 08:58:34 2017 -0700

    Add Werror to CC and HC (#309)


>---------------------------------------------------------------

4952e8022f805d31035c3ecfd354518c72d07557
 src/Settings/Builders/Cc.hs      |  5 ++++-
 src/Settings/Default.hs          | 16 +++++++++++++++-
 src/Settings/Packages/GhcPrim.hs |  1 +
 src/Settings/Packages/Rts.hs     |  4 +++-
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/Settings/Builders/Cc.hs b/src/Settings/Builders/Cc.hs
index b5d85df..38a1665 100644
--- a/src/Settings/Builders/Cc.hs
+++ b/src/Settings/Builders/Cc.hs
@@ -8,7 +8,10 @@ ccBuilderArgs = builder Cc ? mconcat
     , argSettingList . ConfCcArgs =<< getStage
     , cIncludeArgs
 
-    , builder (Cc CompileC) ? mconcat [ arg "-c", arg =<< getInput
+    , builder (Cc CompileC) ? mconcat [ arg "-Werror"
+                                      -- mk/warning.mk:
+                                      --  SRC_CC_OPTS     += -Wall $(WERROR)
+                                      , arg "-c", arg =<< getInput
                                       , arg "-o", arg =<< getOutput ]
 
     , builder (Cc FindCDependencies) ? do
diff --git a/src/Settings/Default.hs b/src/Settings/Default.hs
index 90e2db0..619fca1 100644
--- a/src/Settings/Default.hs
+++ b/src/Settings/Default.hs
@@ -65,10 +65,24 @@ defaultArgs = mconcat
     , sourceArgs defaultSourceArgs
     , defaultPackageArgs ]
 
+-- | Default flags about Werror
+-- | mk/warnings.mk
+defaultErrorGhcFlags :: Args
+defaultErrorGhcFlags =
+  mconcat [ notStage0 ? arg "-Werror"
+          , (not <$> flag GccIsClang) ? mconcat [
+                (not <$> flag GccLt46) ? (not <$> windowsHost) ?
+                  arg "-Werror=unused-but-set-variable"
+              , (not <$> flag GccLt44) ? arg "-Wno-error=inline" ]
+          , flag GccIsClang ? arg "-Wno-unknown-pragmas" ]
+
 -- | Default source arguments, e.g. optimisation settings.
 defaultSourceArgs :: SourceArgs
 defaultSourceArgs = SourceArgs
-    { hsDefault  = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2", arg "-H32m"]
+    { hsDefault  = mconcat [ stage0 ? arg "-O"
+                           , notStage0 ? arg "-O2"
+                           , arg "-H32m"
+                           , defaultErrorGhcFlags ]
     , hsLibrary  = mempty
     , hsCompiler = mempty
     , hsGhc      = mempty }
diff --git a/src/Settings/Packages/GhcPrim.hs b/src/Settings/Packages/GhcPrim.hs
index bed8345..af3c0d5 100644
--- a/src/Settings/Packages/GhcPrim.hs
+++ b/src/Settings/Packages/GhcPrim.hs
@@ -10,4 +10,5 @@ ghcPrimPackageArgs = package ghcPrim ? mconcat
 
     , builder (Cc CompileC)    ?
       (not <$> flag GccLt44)   ?
+      (not <$> flag GccIsClang) ?
       input "//cbits/atomic.c" ? arg "-Wno-sync-nand" ]
diff --git a/src/Settings/Packages/Rts.hs b/src/Settings/Packages/Rts.hs
index 6855402..e278204 100644
--- a/src/Settings/Packages/Rts.hs
+++ b/src/Settings/Packages/Rts.hs
@@ -89,7 +89,9 @@ rtsPackageArgs = package rts ? do
             , inputs ["//Evac.c", "//Evac_thr.c"] ? arg "-funroll-loops"
 
             , inputs ["//Evac_thr.c", "//Scav_thr.c"] ?
-              append [ "-DPARALLEL_GC", "-Irts/sm" ] ]
+              append [ "-DPARALLEL_GC", "-Irts/sm" ]
+
+            , input "//StgCRun.c" ? windowsHost ? arg "-Wno-return-local-addr" ]
 
         , builder Ghc ? arg "-Irts"
 



More information about the ghc-commits mailing list