f8eb4a5da0d43de1b31c4c4ec23917f230835128
[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 ? pure [ "-Werror", "-Wnoncanonical-monad-instances" ]
14 , (not <$> flag GccIsClang) ? mconcat
15 [ (not <$> flag GccLt46) ?
16 (not <$> windowsHost ) ? arg "-optc-Werror=unused-but-set-variable"
17 , (not <$> flag GccLt44) ? arg "-optc-Wno-error=inline" ]
18 , flag GccIsClang ? arg "-optc-Wno-unknown-pragmas" ]
19
20 -- | Package-specific warnings-related arguments, mostly suppressing various warnings.
21 warningArgs :: Args
22 warningArgs = builder Ghc ? do
23 isIntegerSimple <- (== integerSimple) <$> getIntegerPackage
24 mconcat
25 [ stage0 ? mconcat
26 [ libraryPackage ? pure [ "-fno-warn-deprecated-flags" ]
27 , package terminfo ? pure [ "-fno-warn-unused-imports" ]
28 , package transformers ? pure [ "-fno-warn-unused-matches"
29 , "-fno-warn-unused-imports" ] ]
30 , notStage0 ? mconcat
31 [ libraryPackage ? pure [ "-Wno-deprecated-flags" ]
32 , package base ? pure [ "-Wno-trustworthy-safe" ]
33 , package binary ? pure [ "-Wno-deprecations" ]
34 , package bytestring ? pure [ "-Wno-inline-rule-shadowing" ]
35 , package compiler ? pure [ "-Wcpp-undef" ]
36 , package directory ? pure [ "-Wno-unused-imports" ]
37 , package ghc ? pure [ "-Wcpp-undef" ]
38 , package ghcPrim ? pure [ "-Wno-trustworthy-safe" ]
39 , package haddock ? pure [ "-Wno-unused-imports"
40 , "-Wno-deprecations" ]
41 , package haskeline ? pure [ "-Wno-deprecations"
42 , "-Wno-unused-imports"
43 , "-Wno-redundant-constraints"
44 , "-Wno-simplifiable-class-constraints" ]
45 , package pretty ? pure [ "-Wno-unused-imports" ]
46 , package primitive ? pure [ "-Wno-unused-imports"
47 , "-Wno-deprecations" ]
48 , package rts ? pure [ "-Wcpp-undef" ]
49 , package terminfo ? pure [ "-Wno-unused-imports" ]
50 , isIntegerSimple ?
51 package text ? pure [ "-Wno-unused-imports" ]
52 , package transformers ? pure [ "-Wno-unused-matches"
53 , "-Wno-unused-imports"
54 , "-Wno-redundant-constraints"
55 , "-Wno-orphans" ]
56 , package win32 ? pure [ "-Wno-trustworthy-safe" ]
57 , package xhtml ? pure [ "-Wno-unused-imports" ] ] ]