Add `--fwarn-trustworthy-safe` to `-Wall`
[ghc.git] / mk / validate-settings.mk
1 # DO NOT EDIT! Instead, create a file mk/validate.mk, whose settings will
2 # override these. See also mk/custom-settings.mk.
3
4 WERROR = -Werror
5 SRC_CC_WARNING_OPTS =
6 SRC_HC_WARNING_OPTS =
7
8 HADDOCK_DOCS = YES
9
10 #####################
11 # Warnings
12
13 ifneq "$(GccIsClang)" "YES"
14
15 # Debian doesn't turn -Werror=unused-but-set-variable on by default, so
16 # we turn it on explicitly for consistency with other users
17 ifeq "$(GccLT46)" "NO"
18 # Never set the flag on Windows as the host gcc may be too old.
19 ifneq "$(HostOS_CPP)" "mingw32"
20 SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
21 endif
22 # gcc 4.6 gives 3 warning for giveCapabilityToTask not being inlined
23 SRC_CC_WARNING_OPTS += -Wno-error=inline
24 endif
25
26 else
27
28 # Don't warn about unknown GCC pragmas when using clang
29 SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas
30
31 endif
32
33 SRC_CC_OPTS += $(WERROR) -Wall
34 SRC_HC_OPTS += $(WERROR) -Wall
35
36 GhcStage1HcOpts += -fwarn-tabs
37 GhcStage2HcOpts += -fwarn-tabs
38
39 utils/hpc_dist-install_EXTRA_HC_OPTS += -fwarn-tabs
40
41 #####################
42 SRC_HC_OPTS += -H64m -O0
43
44 GhcStage1HcOpts += -O
45 GhcStage2HcOpts += -O -dcore-lint
46 # Using -O (rather than -O0) here bringes my validate down from 22mins to 16 mins.
47 # Compiling stage2 takes longer, but we gain a faster haddock, faster
48 # running of the tests, and faster building of the utils to be installed
49
50 GhcLibHcOpts += -O -dcore-lint
51
52 # We define DefaultFastGhcLibWays in this style so that the value is
53 # correct even if the user alters DYNAMIC_GHC_PROGRAMS.
54 # Technically we don't need the v way if DYNAMIC_GHC_PROGRAMS is YES,
55 # but with -dynamic-too it's cheap, and makes life easier.
56 DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)
57 DefaultProfGhcLibWays = $(if $(filter $(GhcProfiled),YES),p,)
58
59 ifeq "$(ValidateSpeed)" "FAST"
60 GhcLibWays = $(DefaultFastGhcLibWays)
61 else
62 GhcLibWays := $(filter v dyn,$(GhcLibWays))
63 endif
64 GhcLibWays += $(DefaultProfGhcLibWays)
65 SplitObjs = NO
66 NoFibWays =
67 STRIP_CMD = :
68
69 CHECK_PACKAGES = YES
70
71 # We want to install DPH when validating, so that we can test it
72 InstallExtraPackages = YES
73
74 # dblatex with miktex under msys/mingw can't build the PS and PDF docs,
75 # and just building the HTML docs is sufficient to check that the
76 # markup is correct, so we turn off PS and PDF doc building when
77 # validating.
78 BUILD_DOCBOOK_PS = NO
79 BUILD_DOCBOOK_PDF = NO
80
81 ifeq "$(ValidateHpc)" "YES"
82 GhcStage2HcOpts += -fhpc -hpcdir $(TOP)/testsuite/hpc_output/
83 endif
84 ifeq "$(ValidateSpeed)" "SLOW"
85 GhcStage2HcOpts += -DDEBUG
86 endif
87
88 ######################################################################
89 # Disable some warnings in packages we use
90
91 # Cabal doesn't promise to be warning-free
92 utils/ghc-cabal_dist_EXTRA_HC_OPTS += -w
93 libraries/Cabal/Cabal_dist-boot_EXTRA_HC_OPTS += -w
94 libraries/Cabal/Cabal_dist-install_EXTRA_HC_OPTS += -w
95
96 # Temporarily turn off incomplete-pattern warnings for containers
97 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-incomplete-patterns
98
99 # Temporarily turn off pointless-pragma warnings for containers
100 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-pointless-pragmas
101
102 # Turn off import warnings for bad unused imports
103 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
104 libraries/hoopl_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
105 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
106 utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-unused-imports
107 libraries/stm_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
108 libraries/parallel_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
109 libraries/vector_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
110
111 # bytestring has identities at the moment
112 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-identities
113
114 # bytestring uses bitSize at the moment
115 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
116
117 # containers uses bitSize at the moment
118 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
119
120 # Temporarily turn off unused-do-bind warnings for the time package
121 libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-do-bind
122 # Temporary: mkTyCon is deprecated
123 libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
124 # On Windows, there are also some unused import warnings
125 libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports -fno-warn-identities
126
127 # haskeline has warnings about deprecated use of block/unblock
128 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
129 libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
130
131 # binary upstream has some warnings, so don't use -Werror for it
132 libraries/binary_dist-boot_EXTRA_HC_OPTS += -Wwarn
133 libraries/binary_dist-install_EXTRA_HC_OPTS += -Wwarn
134
135 # temporarily turn off -Werror for mtl
136 libraries/mtl_dist-install_EXTRA_HC_OPTS += -Wwarn
137
138 # temporarily turn off unused-imports warnings for pretty
139 libraries/pretty_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
140
141 # primitive has a warning about deprecated use of GHC.IOBase
142 libraries/primitive_dist-install_EXTRA_HC_OPTS += -Wwarn
143
144 # temporarily turn off unused-imports warnings for terminfo
145 libraries/terminfo_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
146
147 # temporarily turn off -Werror for transformers
148 libraries/transformers_dist-boot_EXTRA_HC_OPTS += -Wwarn
149 libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wwarn
150
151 # vector has some unused match warnings
152 libraries/vector_dist-install_EXTRA_HC_OPTS += -Wwarn
153
154 # temporarily turn off unused-imports warnings for xhtml
155 libraries/xhtml_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
156
157 libraries/dph/dph-base_dist-install_EXTRA_HC_OPTS += -Wwarn
158 libraries/dph/dph-prim-interface_dist-install_EXTRA_HC_OPTS += -Wwarn
159 libraries/dph/dph-prim-seq_dist-install_EXTRA_HC_OPTS += -Wwarn
160 libraries/dph/dph-prim-par_dist-install_EXTRA_HC_OPTS += -Wwarn
161 libraries/dph/dph-lifted-common-install_EXTRA_HC_OPTS += -Wwarn
162
163 # We need to turn of deprecated warnings for SafeHaskell transition
164 libraries/array_dist-install_EXTRA_HC_OPTS += -fno-warn-warnings-deprecations
165
166 # Turn of trustworthy-safe warning
167 libraries/base_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
168 libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
169 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
170 libraries/process_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
171 libraries/unix_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
172
173 # Temporarely disable inline rule shadowing warning
174 libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-shadowing
175 libraries/template-haskell_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-shadowing
176
177 # We need -fno-warn-deprecated-flags to avoid failure with -Werror
178 GhcLibHcOpts += -fno-warn-deprecated-flags
179 GhcBootLibHcOpts += -fno-warn-deprecated-flags
180
181 # The warning suppression flag below is a temporary kludge. While working with
182 # modules that contain tabs, please de-tab them so this flag can be eventually
183 # removed. See
184 # http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
185 # for details
186 #
187 GhcLibHcOpts += -fno-warn-tabs
188 utils/hsc2hs_dist-install_EXTRA_HC_OPTS += -fno-warn-tabs