diff options
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
-rw-r--r-- | docs/users_guide/using-warnings.rst | 99 |
1 files changed, 52 insertions, 47 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 04e01c870c..1f658e8167 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -237,11 +237,11 @@ it is shown. :reverse: -fno-show-warning-groups :category: + :default: off + When showing which flag controls a warning, also show the respective warning group flag(s) that warning is contained in. - This option is off by default. - The full set of warning options is described below. To turn off any warning, simply give the corresponding ``-Wno-...`` option on the command line. For backwards compatibility with GHC versions prior to 8.0, @@ -314,11 +314,11 @@ of ``-W(no-)*``. :since: 8.4 + :default: on + Causes a warning to be reported when a type error is deferred until runtime. See :ref:`defer-type-errors` - This warning is on by default. - .. ghc-flag:: -fdefer-type-errors :shortdesc: Turn type errors into warnings, :ref:`deferring the error until runtime <defer-type-errors>`. Implies @@ -394,25 +394,25 @@ of ``-W(no-)*``. :since: 7.10 + :default: on + Determines whether the compiler reports holes in partial type signatures as warnings. Has no effect unless :extension:`PartialTypeSignatures` is enabled, which controls whether errors should be generated for holes in types or not. See :ref:`partial-type-signatures`. - This warning is on by default. - .. ghc-flag:: -fhelpful-errors :shortdesc: Make suggestions for mis-spelled names. :type: dynamic :reverse: -fno-helpful-errors :category: + :default: on + When a name or package is not found in scope, make suggestions for the name or package you might have meant instead. - This option is on by default. - .. ghc-flag:: -Wunrecognised-pragmas :shortdesc: warn about uses of pragmas that GHC doesn't recognise :type: dynamic @@ -421,13 +421,13 @@ of ``-W(no-)*``. :since: 6.10 + :default: on + Causes a warning to be emitted when a pragma that GHC doesn't recognise is used. As well as pragmas that GHC itself uses, GHC also recognises pragmas known to be used by other tools, e.g. ``OPTIONS_HUGS`` and ``DERIVE``. - This option is on by default. - .. ghc-flag:: -Wmissed-specialisations :shortdesc: warn when specialisation of an imported, overloaded function fails. @@ -437,6 +437,8 @@ of ``-W(no-)*``. :since: 8.0 + :default: off + Emits a warning if GHC cannot specialise an overloaded function, usually because the function needs an ``INLINABLE`` pragma. Reports when the situation arises during specialisation of an imported function. @@ -449,8 +451,6 @@ of ``-W(no-)*``. Note that this warning will not throw errors if used with :ghc-flag:`-Werror`. - This option is off by default. - .. ghc-flag:: -Wmissed-specializations :shortdesc: alias for :ghc-flag:`-Wmissed-specialisations` :type: dynamic @@ -466,6 +466,8 @@ of ``-W(no-)*``. :since: 8.0 + :default: off + Emits a warning if GHC cannot specialise an overloaded function, usually because the function needs an ``INLINABLE`` pragma. Reports all such situations. @@ -473,8 +475,6 @@ of ``-W(no-)*``. Note that this warning will not throw errors if used with :ghc-flag:`-Werror`. - This option is off by default. - .. ghc-flag:: -Wall-missed-specializations :shortdesc: alias for :ghc-flag:`-Wall-missed-specialisations` :type: dynamic @@ -491,6 +491,8 @@ of ``-W(no-)*``. :since: 6.10 + :default: on + .. index:: pair: deprecations; warnings @@ -498,8 +500,6 @@ of ``-W(no-)*``. a ``WARNING`` or ``DEPRECATED pragma`` is used. See :ref:`warning-deprecated-pragma` for more details on the pragmas. - This option is on by default. - .. ghc-flag:: -Wdeprecations :shortdesc: warn about uses of functions & types that have warnings or deprecated pragmas. Alias for :ghc-flag:`-Wwarnings-deprecations` @@ -507,6 +507,8 @@ of ``-W(no-)*``. :reverse: -Wno-deprecations :category: + :default: on + .. index:: single: deprecations @@ -515,8 +517,6 @@ of ``-W(no-)*``. :ref:`warning-deprecated-pragma` for more details on the pragmas. An alias for :ghc-flag:`-Wwarnings-deprecations`. - This option is on by default. - .. ghc-flag:: -Wnoncanonical-monad-instances :shortdesc: warn when ``Applicative`` or ``Monad`` instances have noncanonical definitions of ``return``, ``pure``, ``(>>)``, @@ -528,6 +528,8 @@ of ``-W(no-)*``. :since: 8.0 + :default: off + Warn if noncanonical ``Applicative`` or ``Monad`` instances declarations are detected. @@ -544,8 +546,6 @@ of ``-W(no-)*``. * Warn if ``pure`` is defined backwards (i.e. ``pure = return``). * Warn if ``(*>)`` is defined backwards (i.e. ``(*>) = (>>)``). - This option is off by default. - .. ghc-flag:: -Wnoncanonical-monadfail-instances :shortdesc: *(deprecated)* warn when ``Monad`` or ``MonadFail`` instances have @@ -635,14 +635,14 @@ of ``-W(no-)*``. :since: 6.10 + :default: on + .. index:: single: deprecated flags Causes a warning to be emitted when a deprecated command-line flag is used. - This option is on by default. - .. ghc-flag:: -Wunsupported-calling-conventions :shortdesc: warn about use of an unsupported calling convention :type: dynamic @@ -827,6 +827,8 @@ of ``-W(no-)*``. :reverse: -Wno-duplicate-exports :category: + :default: on + .. index:: single: duplicate exports, warning single: export lists, duplicates @@ -836,8 +838,6 @@ of ``-W(no-)*``. to avoid the continued export of a definition after you've deleted (one) mention of it in the export list. - This option is on by default. - .. ghc-flag:: -Whi-shadowing :shortdesc: *(deprecated)* warn when a ``.hi`` file in the current directory shadows a library @@ -917,6 +917,8 @@ of ``-W(no-)*``. :since: 6.8 + :default: off + .. index:: single: implicit prelude, warning @@ -933,8 +935,6 @@ of ``-W(no-)*``. to the actual Prelude module, regardless of the imports of the module being compiled). - This warning is off by default. - .. ghc-flag:: -Wincomplete-patterns :shortdesc: warn when a pattern match could fail :type: dynamic @@ -1035,7 +1035,8 @@ of ``-W(no-)*``. :reverse: -Wno-missing-deriving-strategies :category: - :since: 8.8 + :since: 8.8.1 + :default: off The datatype below derives the ``Eq`` typeclass, but doesn't specify a strategy. When :ghc-flag:`-Wmissing-deriving-strategies` is enabled, @@ -1047,8 +1048,7 @@ of ``-W(no-)*``. The compiler will warn here that the deriving clause doesn't specify a strategy. If the warning is enabled, but :extension:`DerivingStrategies` is not enabled, the compiler will suggest turning on the - :extension:`DerivingStrategies` extension. This option is not on by default, - having to be turned on manually or with :ghc-flag:`-Weverything`. + :extension:`DerivingStrategies` extension. .. ghc-flag:: -Wmissing-fields :shortdesc: warn when fields of a record are uninitialised @@ -1126,13 +1126,15 @@ of ``-W(no-)*``. :reverse: -Wno-missing-methods :category: + :default: on + .. index:: single: missing methods, warning single: methods, missing - This option is on by default, and warns you whenever an instance - declaration is missing one or more methods, and the corresponding - class declaration has no default declaration for them. + This option warns you whenever an instance declaration is missing + one or more methods, and the corresponding class declaration has no default + declaration for them. The ``MINIMAL`` pragma can be used to change which combination of methods will be required for instances of a particular class. See @@ -1144,13 +1146,14 @@ of ``-W(no-)*``. :reverse: -Wno-missing-signatures :category: + :default: off + .. index:: single: type signatures, missing If you would like GHC to check that every top-level function/value has a type signature, use the :ghc-flag:`-Wmissing-signatures` option. - As part of the warning GHC also reports the inferred type. The - option is off by default. + As part of the warning GHC also reports the inferred type. .. ghc-flag:: -Wmissing-exported-sigs :shortdesc: *(deprecated)* @@ -1177,6 +1180,8 @@ of ``-W(no-)*``. :since: 8.0 + :default: off + .. index:: single: type signatures, missing @@ -1186,7 +1191,7 @@ of ``-W(no-)*``. option. If this option is used in conjunction with :ghc-flag:`-Wmissing-signatures` then every top-level function/value must have a type signature. As part of the warning GHC also - reports the inferred type. The option is off by default. + reports the inferred type. .. ghc-flag:: -Wmissing-local-sigs :shortdesc: *(deprecated)* @@ -1227,6 +1232,8 @@ of ``-W(no-)*``. :since: 8.0 + :default: off + .. index:: single: type signatures, missing, pattern synonyms @@ -1236,7 +1243,7 @@ of ``-W(no-)*``. option is used in conjunction with :ghc-flag:`-Wmissing-exported-signatures` then only exported pattern synonyms must have a type signature. GHC also reports the inferred - type. This option is off by default. + type. .. ghc-flag:: -Wmissing-kind-signatures :shortdesc: warn when type declarations don't have kind signatures nor CUSKs @@ -1245,6 +1252,7 @@ of ``-W(no-)*``. :category: :since: 9.2 + :default: off .. index:: single: kind signatures, missing @@ -1262,8 +1270,6 @@ of ``-W(no-)*``. the parent class a standalone kind signature or CUSK is sufficient to fix the warning for the class's associated type families as well. - This option is off by default. - .. ghc-flag:: -Wmissing-exported-pattern-synonym-signatures :shortdesc: warn about pattern synonyms without signatures, only if they are exported @@ -1271,6 +1277,8 @@ of ``-W(no-)*``. :reverse: -Wno-missing-exported-pattern-synonym-signatures :category: + :default: off + .. index:: single: type signatures, missing, pattern synonyms @@ -1280,7 +1288,7 @@ of ``-W(no-)*``. option is used in conjunction with :ghc-flag:`-Wmissing-pattern-synonym-signatures` then every pattern synonym must have a type signature. As part of the warning GHC also reports the - inferred type. The option is off by default. + inferred type. .. ghc-flag:: -Wname-shadowing :shortdesc: warn when names are shadowed @@ -1482,6 +1490,7 @@ of ``-W(no-)*``. :category: :since: 8.2 + :default: on .. index:: single: simplifiable class constraints, warning @@ -1498,10 +1507,6 @@ of ``-W(no-)*``. f :: Eq a => a -> a - This option is on by default. As usual you can suppress it on a - per-module basis with :ghc-flag:`-Wno-simplifiable-class-constraints - <-Wsimplifiable-class-constraints>`. - .. ghc-flag:: -Wtabs :shortdesc: warn if there are tabs in the source file :type: dynamic @@ -1521,6 +1526,8 @@ of ``-W(no-)*``. :reverse: -Wno-type-defaults :category: + :default: off + .. index:: single: defaulting mechanism, warning @@ -1533,8 +1540,6 @@ of ``-W(no-)*``. ``Integer``. This may lead to differences in performance and behaviour, hence the usefulness of being non-silent about this. - This warning is off by default. - .. ghc-flag:: -Wmonomorphism-restriction :shortdesc: warn when the Monomorphism Restriction is applied :type: dynamic @@ -1543,6 +1548,8 @@ of ``-W(no-)*``. :since: 6.8 + :default: off + .. index:: single: monomorphism restriction, warning @@ -1551,8 +1558,6 @@ of ``-W(no-)*``. give rise to unexpected behaviour, so it can be helpful to have an explicit warning that it is being applied. - This warning is off by default. - .. ghc-flag:: -Wunsupported-llvm-version :shortdesc: Warn when using :ghc-flag:`-fllvm` with an unsupported version of LLVM. |