Disable same warnings for normal builds as for validate (#10223)
[ghc.git] / mk / warnings.mk
1 SRC_CC_WARNING_OPTS =
2 SRC_HC_WARNING_OPTS =
3
4
5 #####################
6 # Warnings
7
8 ifneq "$(GccIsClang)" "YES"
9
10 # Debian doesn't turn -Werror=unused-but-set-variable on by default, so
11 # we turn it on explicitly for consistency with other users
12 ifeq "$(GccLT46)" "NO"
13 # Never set the flag on Windows as the host gcc may be too old.
14 ifneq "$(HostOS_CPP)" "mingw32"
15 SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
16 endif
17 # gcc 4.6 gives 3 warning for giveCapabilityToTask not being inlined
18 SRC_CC_WARNING_OPTS += -Wno-error=inline
19 endif
20
21 else
22
23 # Don't warn about unknown GCC pragmas when using clang
24 SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas
25
26 endif
27
28 SRC_CC_OPTS += -Wall
29 SRC_HC_OPTS += -Wall
30
31 GhcStage1HcOpts += -fwarn-tabs
32 GhcStage2HcOpts += -fwarn-tabs
33
34 utils/hpc_dist-install_EXTRA_HC_OPTS += -fwarn-tabs
35
36
37 ######################################################################
38 # Disable some warnings in packages we use
39
40 # Cabal doesn't promise to be warning-free
41 utils/ghc-cabal_dist_EXTRA_HC_OPTS += -w
42 libraries/Cabal/Cabal_dist-boot_EXTRA_HC_OPTS += -w
43 libraries/Cabal/Cabal_dist-install_EXTRA_HC_OPTS += -w
44
45 # Turn off import warnings for bad unused imports
46 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
47 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
48 utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-unused-imports
49 libraries/vector_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
50
51 # haddock's attoparsec uses deprecated `inlinePerformIO`
52 utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-deprecations
53
54 # containers uses bitSize at the moment
55 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
56 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
57
58 # On Windows, there are also some unused import warnings
59 ifeq "$(HostOS_CPP)" "mingw32"
60 libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports -fno-warn-identities
61 endif
62
63 # haskeline has warnings about deprecated use of block/unblock
64 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
65 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
66 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
67
68 # binary upstream has some warnings, so don't use -Werror for it
69 libraries/binary_dist-boot_EXTRA_HC_OPTS += -Wwarn
70 libraries/binary_dist-install_EXTRA_HC_OPTS += -Wwarn
71
72 # temporarily turn off unused-imports warnings for pretty
73 libraries/pretty_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
74
75 # primitive has a warning about deprecated use of GHC.IOBase
76 libraries/primitive_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
77
78 # temporarily turn off unused-imports warnings for terminfo
79 libraries/terminfo_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-imports
80 libraries/terminfo_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
81
82 # vector has some unused match warnings
83 libraries/vector_dist-install_EXTRA_HC_OPTS += -Wwarn
84
85 # temporarily turn off unused-imports warnings for xhtml
86 libraries/xhtml_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
87
88 libraries/dph/dph-base_dist-install_EXTRA_HC_OPTS += -Wwarn
89 libraries/dph/dph-prim-interface_dist-install_EXTRA_HC_OPTS += -Wwarn
90 libraries/dph/dph-prim-seq_dist-install_EXTRA_HC_OPTS += -Wwarn
91 libraries/dph/dph-prim-par_dist-install_EXTRA_HC_OPTS += -Wwarn
92 libraries/dph/dph-lifted-common-install_EXTRA_HC_OPTS += -Wwarn
93
94 # transformers has unused function parameters warnings
95 libraries/transformers_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
96 libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
97 libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
98
99 # Turn of trustworthy-safe warning
100 libraries/base_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
101 libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
102 libraries/Win32_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
103
104 # Temporarely disable inline rule shadowing warning
105 libraries/template-haskell_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-shadowing
106
107 # We need -fno-warn-deprecated-flags to avoid failure with -Werror
108 GhcLibExtraHcOpts += -fno-warn-deprecated-flags
109 GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags
110
111 # The warning suppression flag below is a temporary kludge. While working with
112 # modules that contain tabs, please de-tab them so this flag can be eventually
113 # removed. See
114 # http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
115 # for details
116 #
117 GhcLibExtraHcOpts += -fno-warn-tabs
118 GhcBootLibExtraHcOpts += -fno-warn-tabs