[Git][ghc/ghc][wip/rts-warnings] hadrian: Ensure that -Werror is passed when compiling the RTS.

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Feb 14 14:00:20 UTC 2023



Ben Gamari pushed to branch wip/rts-warnings at Glasgow Haskell Compiler / GHC


Commits:
e594159d by Ben Gamari at 2023-02-14T09:00:14-05:00
hadrian: Ensure that -Werror is passed when compiling the RTS.

Previously the `+werror` transformer would only pass `-Werror` to GHC,
which does not ensure that the same is passed to the C compiler when
building the RTS. Arguably this is itself a bug but for now we will just
work around this by passing `-optc-Werror` to GHC.

I tried to enable `-Werror` in all C compilations but the boot libraries
are something of a portability nightmare.

- - - - -


1 changed file:

- hadrian/src/Flavour.hs


Changes:

=====================================
hadrian/src/Flavour.hs
=====================================
@@ -122,16 +122,25 @@ addArgs args' fl = fl { args = args fl <> args' }
 -- from warnings.
 werror :: Flavour -> Flavour
 werror =
-  addArgs
-    ( builder Ghc
+  addArgs $ mconcat
+    [ builder Ghc
         ? notStage0
         ? mconcat
-          [ arg "-Werror",
-            flag CrossCompiling
+          [ arg "-Werror"
+          , flag CrossCompiling
               ? package unix
               ? mconcat [arg "-Wwarn=unused-imports", arg "-Wwarn=unused-top-binds"]
           ]
-    )
+    , builder Ghc
+        ? package rts
+        ? mconcat
+          [ arg "-optc-Werror"
+            -- clang complains about #pragma GCC pragmas
+          , arg "-optc-Wno-error=unknown-pragmas"
+          ]
+      -- N.B. We currently don't build the boot libraries' C sources with -Werror
+      -- as this tends to be a portability nightmare.
+    ]
 
 -- | Build C and Haskell objects with debugging information.
 enableDebugInfo :: Flavour -> Flavour



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e594159d6f40c4d7e2230bb9ac92204f221bd9f7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e594159d6f40c4d7e2230bb9ac92204f221bd9f7
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/20230214/fc9f96e8/attachment-0001.html>


More information about the ghc-commits mailing list