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