[Git][ghc/ghc][wip/amg/warning-categories] Allow WARNING pragmas to be controlled with custom categories

Adam Gundry (@adamgundry) gitlab at gitlab.haskell.org
Sat Jan 14 21:26:54 UTC 2023



Adam Gundry pushed to branch wip/amg/warning-categories at Glasgow Haskell Compiler / GHC


Commits:
fe4d1201 by Adam Gundry at 2023-01-14T21:26:05+00:00
Allow WARNING pragmas to be controlled with custom categories

Closes #17209. This implements GHC Proposal 541, allowing a WARNING
pragma to be annotated with a category like so:

    {-# WARNING {x-partial} head "This function is undefined on empty lists." #-}

The user can then enable, disable and set the severity of such warnings
using command-line flags `-Wx-partial`, `-Werror=x-partial` and so on.  There
is a new warning group `-Wextended-warnings` containing all these warnings.
Warnings without a category are treated as if the category was `deprecations`,
and are (still) controlled by the flags `-Wdeprecations`
and `-Wwarnings-deprecations`.

- - - - -


30 changed files:

- compiler/GHC/Driver/Config/Diagnostic.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/HaddockLex.x
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/GHC/Utils/Error.hs
- docs/users_guide/exts/pragmas.rst
- docs/users_guide/using-warnings.rst
- testsuite/tests/parser/should_compile/T3303.stderr
- testsuite/tests/rename/should_compile/T5867.stderr
- testsuite/tests/rename/should_compile/rn050.stderr
- testsuite/tests/rename/should_compile/rn066.stderr
- testsuite/tests/rename/should_fail/T5281.stderr
- testsuite/tests/warnings/should_compile/DeprU.stderr
- + testsuite/tests/warnings/should_fail/WarningCategory1.hs
- + testsuite/tests/warnings/should_fail/WarningCategory1.stderr
- + testsuite/tests/warnings/should_fail/WarningCategory1_B.hs
- + testsuite/tests/warnings/should_fail/WarningCategory2.stderr
- + testsuite/tests/warnings/should_fail/WarningCategory4.stderr
- + testsuite/tests/warnings/should_fail/WarningCategory5.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe4d120139802d4e51852b60d42f6ab453af3f2f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe4d120139802d4e51852b60d42f6ab453af3f2f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230114/17919a47/attachment.html>


More information about the ghc-commits mailing list