summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-12-19 12:23:50 -0500
committerBen Gamari <ben@smart-cactus.org>2023-03-24 09:56:27 -0400
commit318ea2e411fef8bd2674e74b0ff1454c14713fd4 (patch)
tree69b0e90cef63d68c906a40256dcf8af6895ebbee
parent1a40ca00facfec5a2253b1cdc0479f27b219d7bc (diff)
downloadhaskell-318ea2e411fef8bd2674e74b0ff1454c14713fd4.tar.gz
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.
-rw-r--r--hadrian/src/Flavour.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 6f68d6c6ba..fbdac79623 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -123,16 +123,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