Fix Windows build
[ghc.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 <$> 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 -- FIXME: See https://phabricator.haskell.org/D4121#117481.
36 , input "//SysTools.hs" ? pure [ "-Wno-unused-imports" ]
37 , package directory ? pure [ "-Wno-unused-imports" ]
38 , package ghc ? pure [ "-Wcpp-undef" ]
39 , package ghcPrim ? pure [ "-Wno-trustworthy-safe" ]
40 , package haddock ? pure [ "-Wno-unused-imports"
41 , "-Wno-deprecations" ]
42 , package haskeline ? pure [ "-Wno-deprecations"
43 , "-Wno-unused-imports"
44 , "-Wno-redundant-constraints"
45 , "-Wno-simplifiable-class-constraints" ]
46 , package pretty ? pure [ "-Wno-unused-imports" ]
47 , package primitive ? pure [ "-Wno-unused-imports"
48 , "-Wno-deprecations" ]
49 , package rts ? pure [ "-Wcpp-undef" ]
50 , package terminfo ? pure [ "-Wno-unused-imports" ]
51 , isIntegerSimple ?
52 package text ? pure [ "-Wno-unused-imports" ]
53 , package transformers ? pure [ "-Wno-unused-matches"
54 , "-Wno-unused-imports"
55 , "-Wno-redundant-constraints"
56 , "-Wno-orphans" ]
57 , package win32 ? pure [ "-Wno-trustworthy-safe" ]
58 , package xhtml ? pure [ "-Wno-unused-imports" ] ] ]