Add `-W(no-)xxx` aliases for `-f(no-)warn-xxx` flags
[ghc.git] / utils / mkUserGuidePart / Options / Warnings.hs
1 module Options.Warnings where
2
3 import Types
4
5 warningsOptions :: [Flag]
6 warningsOptions =
7 [ flag { flagName = "-W"
8 , flagDescription = "enable normal warnings"
9 , flagType = DynamicFlag
10 , flagReverse = "-w"
11 }
12 , flag { flagName = "-w"
13 , flagDescription = "disable all warnings"
14 , flagType = DynamicFlag
15 }
16 , flag { flagName = "-Wall"
17 , flagDescription =
18 "enable almost all warnings (details in :ref:`options-sanity`)"
19 , flagType = DynamicFlag
20 , flagReverse = "-w"
21 }
22 , flag { flagName = "-Wcompat"
23 , flagDescription =
24 "enable future compatibility warnings " ++
25 "(details in :ref:`options-sanity`)"
26 , flagType = DynamicFlag
27 , flagReverse = "-Wno-compat"
28 }
29 , flag { flagName = "-Werror"
30 , flagDescription = "make warnings fatal"
31 , flagType = DynamicFlag
32 , flagReverse = "-Wwarn"
33 }
34 , flag { flagName = "-Wwarn"
35 , flagDescription = "make warnings non-fatal"
36 , flagType = DynamicFlag
37 , flagReverse = "-Werror"
38 }
39 , flag { flagName = "-fdefer-type-errors"
40 , flagDescription =
41 "Turn type errors into warnings, :ref:`deferring the error until "++
42 "runtime <defer-type-errors>`. Implies ``-fdefer-typed-holes``. "++
43 "See also ``-Wdeferred-type-errors``"
44 , flagType = DynamicFlag
45 , flagReverse = "-fno-defer-type-errors"
46 }
47 , flag { flagName = "-fdefer-typed-holes"
48 , flagDescription =
49 "Convert :ref:`typed hole <typed-holes>` errors into warnings, "++
50 ":ref:`deferring the error until runtime <defer-type-errors>`. "++
51 "Implied by ``-fdefer-type-errors``. "++
52 "See also ``-Wtyped-holes``."
53 , flagType = DynamicFlag
54 , flagReverse = "-fno-defer-typed-holes"
55 }
56 , flag { flagName = "-fhelpful-errors"
57 , flagDescription = "Make suggestions for mis-spelled names."
58 , flagType = DynamicFlag
59 , flagReverse = "-fno-helpful-errors"
60 }
61 , flag { flagName = "-Wdeprecated-flags"
62 , flagDescription =
63 "warn about uses of commandline flags that are deprecated"
64 , flagType = DynamicFlag
65 , flagReverse = "-Wno-deprecated-flags"
66 }
67 , flag { flagName = "-Wduplicate-constraints"
68 , flagDescription =
69 "warn when a constraint appears duplicated in a type signature"
70 , flagType = DynamicFlag
71 , flagReverse = "-Wno-duplicate-constraints"
72 }
73 , flag { flagName = "-Wduplicate-exports"
74 , flagDescription = "warn when an entity is exported multiple times"
75 , flagType = DynamicFlag
76 , flagReverse = "-Wno-duplicate-exports"
77 }
78 , flag { flagName = "-Whi-shadowing"
79 , flagDescription =
80 "warn when a ``.hi`` file in the current directory shadows a library"
81 , flagType = DynamicFlag
82 , flagReverse = "-Wno-hi-shadowing"
83 }
84 , flag { flagName = "-Widentities"
85 , flagDescription =
86 "warn about uses of Prelude numeric conversions that are probably "++
87 "the identity (and hence could be omitted)"
88 , flagType = DynamicFlag
89 , flagReverse = "-Wno-identities"
90 }
91 , flag { flagName = "-Wimplicit-prelude"
92 , flagDescription = "warn when the Prelude is implicitly imported"
93 , flagType = DynamicFlag
94 , flagReverse = "-Wno-implicit-prelude"
95 }
96 , flag { flagName = "-Wincomplete-patterns"
97 , flagDescription = "warn when a pattern match could fail"
98 , flagType = DynamicFlag
99 , flagReverse = "-Wno-incomplete-patterns"
100 }
101 , flag { flagName = "-Wincomplete-uni-patterns"
102 , flagDescription =
103 "warn when a pattern match in a lambda expression or "++
104 "pattern binding could fail"
105 , flagType = DynamicFlag
106 , flagReverse = "-Wno-incomplete-uni-patterns"
107 }
108 , flag { flagName = "-Wincomplete-record-updates"
109 , flagDescription = "warn when a record update could fail"
110 , flagType = DynamicFlag
111 , flagReverse = "-Wno-incomplete-record-updates"
112 }
113 , flag { flagName = "-Wlazy-unlifted-bindings"
114 , flagDescription =
115 "*(deprecated)* warn when a pattern binding looks lazy but "++
116 "must be strict"
117 , flagType = DynamicFlag
118 , flagReverse = "-Wno-lazy-unlifted-bindings"
119 }
120 , flag { flagName = "-Wmissing-fields"
121 , flagDescription = "warn when fields of a record are uninitialised"
122 , flagType = DynamicFlag
123 , flagReverse = "-Wno-missing-fields"
124 }
125 , flag { flagName = "-Wmissing-import-lists"
126 , flagDescription =
127 "warn when an import declaration does not explicitly list all the"++
128 "names brought into scope"
129 , flagType = DynamicFlag
130 , flagReverse = "-fnowarn-missing-import-lists"
131 }
132 , flag { flagName = "-Wmissing-methods"
133 , flagDescription = "warn when class methods are undefined"
134 , flagType = DynamicFlag
135 , flagReverse = "-Wno-missing-methods"
136 }
137 , flag { flagName = "-Wmissing-signatures"
138 , flagDescription = "warn about top-level functions without signatures"
139 , flagType = DynamicFlag
140 , flagReverse = "-Wno-missing-signatures"
141 }
142 , flag { flagName = "-Wmissing-exported-sigs"
143 , flagDescription =
144 "warn about top-level functions without signatures, only if they "++
145 "are exported. takes precedence over -Wmissing-signatures"
146 , flagType = DynamicFlag
147 , flagReverse = "-Wno-missing-exported-sigs"
148 }
149 , flag { flagName = "-Wmissing-local-sigs"
150 , flagDescription =
151 "warn about polymorphic local bindings without signatures"
152 , flagType = DynamicFlag
153 , flagReverse = "-Wno-missing-local-sigs"
154 }
155 , flag { flagName = "-Wmissing-monadfail-instance"
156 , flagDescription =
157 "warn when a failable pattern is used in a do-block that does " ++
158 "not have a ``MonadFail`` instance."
159 , flagType = DynamicFlag
160 , flagReverse = "-Wno-missing-monadfail-instance"
161 }
162 , flag { flagName = "-Wsemigroup"
163 , flagDescription =
164 "warn when a ``Monoid`` is not ``Semigroup``, and on non-" ++
165 "``Semigroup`` definitions of ``(<>)``?"
166 , flagType = DynamicFlag
167 , flagReverse = "-Wno-semigroup"
168 }
169 , flag { flagName = "-Wmissed-specialisations"
170 , flagDescription =
171 "warn when specialisation of an imported, overloaded function fails."
172 , flagType = DynamicFlag
173 , flagReverse = "-Wno-missed-specialisations"
174 }
175 , flag { flagName = "-Wall-missed-specialisations"
176 , flagDescription =
177 "warn when specialisation of any overloaded function fails."
178 , flagType = DynamicFlag
179 , flagReverse = "-Wno-all-missed-specialisations"
180 }
181 , flag { flagName = "-Wmonomorphism-restriction"
182 , flagDescription = "warn when the Monomorphism Restriction is applied"
183 , flagType = DynamicFlag
184 , flagReverse = "-Wno-monomorphism-restriction"
185 }
186 , flag { flagName = "-Wname-shadowing"
187 , flagDescription = "warn when names are shadowed"
188 , flagType = DynamicFlag
189 , flagReverse = "-Wno-name-shadowing"
190 }
191 , flag { flagName = "-Wnoncanonical-monad-instance"
192 , flagDescription =
193 "warn when ``Applicative`` or ``Monad`` instances have "++
194 "noncanonical definitions of ``return``, ``pure``, ``(>>)``, "++
195 "or ``(*>)``. "++
196 "See flag description in :ref:`options-sanity` for more details."
197 , flagType = DynamicFlag
198 , flagReverse = "-Wno-noncanonical-monad-instance"
199 }
200 , flag { flagName = "-Wnoncanonical-monoid-instance"
201 , flagDescription =
202 "warn when ``Semigroup`` or ``Monoid`` instances have "++
203 "noncanonical definitions of ``(<>)`` or ``mappend``. "++
204 "See flag description in :ref:`options-sanity` for more details."
205 , flagType = DynamicFlag
206 , flagReverse = "-Wno-noncanonical-monoid-instance"
207 }
208 , flag { flagName = "-Worphans"
209 , flagDescription =
210 "warn when the module contains :ref:`orphan instance declarations "++
211 "or rewrite rules <orphan-modules>`"
212 , flagType = DynamicFlag
213 , flagReverse = "-Wno-orphans"
214 }
215 , flag { flagName = "-Woverlapping-patterns"
216 , flagDescription = "warn about overlapping patterns"
217 , flagType = DynamicFlag
218 , flagReverse = "-Wno-overlapping-patterns"
219 }
220 , flag { flagName = "-Wtabs"
221 , flagDescription = "warn if there are tabs in the source file"
222 , flagType = DynamicFlag
223 , flagReverse = "-Wno-tabs"
224 }
225 , flag { flagName = "-Wtype-defaults"
226 , flagDescription = "warn when defaulting happens"
227 , flagType = DynamicFlag
228 , flagReverse = "-Wno-type-defaults"
229 }
230 , flag { flagName = "-Wunrecognised-pragmas"
231 , flagDescription =
232 "warn about uses of pragmas that GHC doesn't recognise"
233 , flagType = DynamicFlag
234 , flagReverse = "-Wno-unrecognised-pragmas"
235 }
236 , flag { flagName = "-Wunticked-promoted-constructors"
237 , flagDescription = "warn if promoted constructors are not ticked"
238 , flagType = DynamicFlag
239 , flagReverse = "-Wno-unticked-promoted-constructors"
240 }
241 , flag { flagName = "-Wunused-binds"
242 , flagDescription =
243 "warn about bindings that are unused. Alias for "++
244 "``-Wunused-top-binds``, ``-Wunused-local-binds`` and "++
245 "``-Wunused-pattern-binds``"
246 , flagType = DynamicFlag
247 , flagReverse = "-Wno-unused-binds"
248 }
249 , flag { flagName = "-Wunused-top-binds"
250 , flagDescription = "warn about top-level bindings that are unused"
251 , flagType = DynamicFlag
252 , flagReverse = "-Wno-unused-top-binds"
253 }
254 , flag { flagName = "-Wunused-local-binds"
255 , flagDescription = "warn about local bindings that are unused"
256 , flagType = DynamicFlag
257 , flagReverse = "-Wno-unused-local-binds"
258 }
259 , flag { flagName = "-Wunused-pattern-binds"
260 , flagDescription = "warn about pattern match bindings that are unused"
261 , flagType = DynamicFlag
262 , flagReverse = "-Wno-unused-pattern-binds"
263 }
264 , flag { flagName = "-Wunused-imports"
265 , flagDescription = "warn about unnecessary imports"
266 , flagType = DynamicFlag
267 , flagReverse = "-Wno-unused-imports"
268 }
269 , flag { flagName = "-Wunused-matches"
270 , flagDescription = "warn about variables in patterns that aren't used"
271 , flagType = DynamicFlag
272 , flagReverse = "-Wno-unused-matches"
273 }
274 , flag { flagName = "-Wunused-do-bind"
275 , flagDescription =
276 "warn about do bindings that appear to throw away values of types "++
277 "other than ``()``"
278 , flagType = DynamicFlag
279 , flagReverse = "-Wno-unused-do-bind"
280 }
281 , flag { flagName = "-Wwrong-do-bind"
282 , flagDescription =
283 "warn about do bindings that appear to throw away monadic values "++
284 "that you should have bound instead"
285 , flagType = DynamicFlag
286 , flagReverse = "-Wno-wrong-do-bind"
287 }
288 , flag { flagName = "-Wunsafe"
289 , flagDescription =
290 "warn if the module being compiled is regarded to be unsafe. "++
291 "Should be used to check the safety status of modules when using "++
292 "safe inference. Works on all module types, even those using "++
293 "explicit :ref:`Safe Haskell <safe-haskell>` modes (such as "++
294 "``-XTrustworthy``) and so can be used to have the compiler check "++
295 "any assumptions made."
296 , flagType = DynamicFlag
297 , flagReverse = "-Wno-unsafe"
298 }
299 , flag { flagName = "-Wsafe"
300 , flagDescription =
301 "warn if the module being compiled is regarded to be safe. Should "++
302 "be used to check the safety status of modules when using safe "++
303 "inference. Works on all module types, even those using explicit "++
304 ":ref:`Safe Haskell <safe-haskell>` modes (such as "++
305 "``-XTrustworthy``) and so can be used to have the compiler check "++
306 "any assumptions made."
307 , flagType = DynamicFlag
308 , flagReverse = "-Wno-safe"
309 }
310 , flag { flagName = "-Wtrustworthy-safe"
311 , flagDescription =
312 "warn if the module being compiled is marked as ``-XTrustworthy`` "++
313 "but it could instead be marked as ``-XSafe``, a more informative "++
314 "bound. Can be used to detect once a Safe Haskell bound can be "++
315 "improved as dependencies are updated."
316 , flagType = DynamicFlag
317 , flagReverse = "-Wno-safe"
318 }
319 , flag { flagName = "-Wwarnings-deprecations"
320 , flagDescription =
321 "warn about uses of functions & types that have warnings or "++
322 "deprecated pragmas"
323 , flagType = DynamicFlag
324 , flagReverse = "-Wno-warnings-deprecations"
325 }
326 , flag { flagName = "-Wamp"
327 , flagDescription =
328 "*(deprecated)* warn on definitions conflicting with the "++
329 "Applicative-Monad Proposal (AMP)"
330 , flagType = DynamicFlag
331 , flagReverse = "-Wno-amp"
332 }
333 , flag { flagName = "-Wdeferred-type-errors"
334 , flagDescription =
335 "Report warnings when :ref:`deferred type errors "++
336 "<defer-type-errors>` are enabled. This option is enabled by "++
337 "default. See ``-fdefer-type-errors``."
338 , flagType = DynamicFlag
339 , flagReverse = "-Wno-deferred-type-errors"
340 }
341 , flag { flagName = "-Wtyped-holes"
342 , flagDescription =
343 "Report warnings when :ref:`typed hole <typed-holes>` errors are "++
344 ":ref:`deferred until runtime <defer-type-errors>`. See "++
345 "``-fdefer-typed-holes``."
346 , flagType = DynamicFlag
347 , flagReverse = "-Wno-typed-holes"
348 }
349 , flag { flagName = "-Wpartial-type-signatures"
350 , flagDescription =
351 "warn about holes in partial type signatures when "++
352 "``-XPartialTypeSignatures`` is enabled. Not applicable when "++
353 "``-XPartialTypesignatures`` is not enabled, in which case errors "++
354 "are generated for such holes. See :ref:`partial-type-signatures`."
355 , flagType = DynamicFlag
356 , flagReverse = "-Wno-partial-type-signatures"
357 }
358 , flag { flagName = "-Wderiving-typeable"
359 , flagDescription =
360 "warn when encountering a request to derive an instance of class "++
361 "``Typeable``. As of GHC 7.10, such declarations are unnecessary "++
362 "and are ignored by the compiler because GHC has a custom solver "++
363 "for discharging this type of constraint."
364 , flagType = DynamicFlag
365 , flagReverse = "-Wno-deriving-typeable"
366 }
367 ]