19a12df5fe93b4aa459dd82a449249ef6b85322f
[hadrian.git] / src / Settings / Warnings.hs
1 module Settings.Warnings (defaultGhcWarningsArgs, warningArgs) where
2
3 import Expression
4 import Oracles.Flag
5 import Oracles.Setting
6 import Settings
7
8 -- See @mk/warnings.mk@ for warning-related arguments in the Make build system.
9
10 -- | Default Haskell warning-related arguments.
11 defaultGhcWarningsArgs :: Args
12 defaultGhcWarningsArgs = mconcat
13 [ notStage0 ? arg "-Wnoncanonical-monad-instances"
14 , (not <$> flag GccIsClang) ? mconcat
15 [ (not <$> windowsHost ) ? arg "-optc-Werror=unused-but-set-variable"
16 , arg "-optc-Wno-error=inline" ]
17 , flag GccIsClang ? arg "-optc-Wno-unknown-pragmas" ]
18
19 -- | Package-specific warnings-related arguments, mostly suppressing various warnings.
20 warningArgs :: Args
21 warningArgs = builder Ghc ? do
22 isIntegerSimple <- (== integerSimple) <$> getIntegerPackage
23 mconcat
24 [ stage0 ? mconcat
25 [ libraryPackage ? pure [ "-fno-warn-deprecated-flags" ]
26 , package terminfo ? pure [ "-fno-warn-unused-imports" ]
27 , package transformers ? pure [ "-fno-warn-unused-matches"
28 , "-fno-warn-unused-imports" ] ]
29 , notStage0 ? mconcat
30 [ libraryPackage ? pure [ "-Wno-deprecated-flags" ]
31 , package base ? pure [ "-Wno-trustworthy-safe" ]
32 , package binary ? pure [ "-Wno-deprecations" ]
33 , package bytestring ? pure [ "-Wno-inline-rule-shadowing" ]
34 , package compiler ? pure [ "-Wcpp-undef" ]
35 , package directory ? pure [ "-Wno-unused-imports" ]
36 , package ghc ? pure [ "-Wcpp-undef" ]
37 , package ghcPrim ? pure [ "-Wno-trustworthy-safe" ]
38 , package haddock ? pure [ "-Wno-unused-imports"
39 , "-Wno-deprecations" ]
40 , package haskeline ? pure [ "-Wno-deprecations"
41 , "-Wno-unused-imports"
42 , "-Wno-redundant-constraints"
43 , "-Wno-simplifiable-class-constraints" ]
44 , package pretty ? pure [ "-Wno-unused-imports" ]
45 , package primitive ? pure [ "-Wno-unused-imports"
46 , "-Wno-deprecations" ]
47 , package rts ? pure [ "-Wcpp-undef" ]
48 , package terminfo ? pure [ "-Wno-unused-imports" ]
49 , isIntegerSimple ?
50 package text ? pure [ "-Wno-unused-imports" ]
51 , package transformers ? pure [ "-Wno-unused-matches"
52 , "-Wno-unused-imports"
53 , "-Wno-redundant-constraints"
54 , "-Wno-orphans" ]
55 , package win32 ? pure [ "-Wno-trustworthy-safe" ]
56 , package xhtml ? pure [ "-Wno-unused-imports" ] ] ]