[commit: ghc] master: Add -Werror=compat (04e9fe5)
git at git.haskell.org
git at git.haskell.org
Sun Jun 17 18:40:58 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/04e9fe5c7d3c2bac46933e3d647e561cb741edf4/ghc
>---------------------------------------------------------------
commit 04e9fe5c7d3c2bac46933e3d647e561cb741edf4
Author: Vladislav Zavialov <vlad.z.4096 at gmail.com>
Date: Sun Jun 17 12:51:06 2018 -0400
Add -Werror=compat
Add a flag `-Werror=compat` to GHC which has the effect of `-Werror=x
-Werror=y ...`, where `x, y, ...` are warnings from the `-Wcompat`
option group.
Test Plan: ./validate
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15278
Differential Revision: https://phabricator.haskell.org/D4860
>---------------------------------------------------------------
04e9fe5c7d3c2bac46933e3d647e561cb741edf4
compiler/main/DynFlags.hs | 16 ++++++++++++----
docs/users_guide/using-warnings.rst | 6 ++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 485eb72..fa210dc 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -3522,10 +3522,7 @@ dynamic_flags_deps = [
++ map (mkFlag turnOff "fno-" unSetGeneralFlag ) fFlagsDeps
++ map (mkFlag turnOn "W" setWarningFlag ) wWarningFlagsDeps
++ map (mkFlag turnOff "Wno-" unSetWarningFlag ) wWarningFlagsDeps
- ++ map (mkFlag turnOn "Werror=" (\flag -> do {
- ; setWarningFlag flag
- ; setFatalWarningFlag flag }))
- wWarningFlagsDeps
+ ++ map (mkFlag turnOn "Werror=" setWErrorFlag ) wWarningFlagsDeps
++ map (mkFlag turnOn "Wwarn=" unSetFatalWarningFlag )
wWarningFlagsDeps
++ map (mkFlag turnOn "Wno-error=" unSetFatalWarningFlag )
@@ -3537,6 +3534,12 @@ dynamic_flags_deps = [
++ [ (NotDeprecated, unrecognisedWarning "W"),
(Deprecated, unrecognisedWarning "fwarn-"),
(Deprecated, unrecognisedWarning "fno-warn-") ]
+ ++ [ make_ord_flag defFlag "Werror=compat"
+ (NoArg (mapM_ setWErrorFlag minusWcompatOpts))
+ , make_ord_flag defFlag "Wno-error=compat"
+ (NoArg (mapM_ unSetFatalWarningFlag minusWcompatOpts))
+ , make_ord_flag defFlag "Wwarn=compat"
+ (NoArg (mapM_ unSetFatalWarningFlag minusWcompatOpts)) ]
++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlagsDeps
++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlagsDeps
++ map (mkFlag turnOn "X" setExtensionFlag ) xFlagsDeps
@@ -4802,6 +4805,11 @@ setFatalWarningFlag, unSetFatalWarningFlag :: WarningFlag -> DynP ()
setFatalWarningFlag f = upd (\dfs -> wopt_set_fatal dfs f)
unSetFatalWarningFlag f = upd (\dfs -> wopt_unset_fatal dfs f)
+setWErrorFlag :: WarningFlag -> DynP ()
+setWErrorFlag flag =
+ do { setWarningFlag flag
+ ; setFatalWarningFlag flag }
+
--------------------------
setExtensionFlag, unSetExtensionFlag :: LangExt.Extension -> DynP ()
setExtensionFlag f = upd (setExtensionFlag' f)
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 7dc4a3b..510b56a 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -151,6 +151,9 @@ to abort.
Makes a specific warning into a fatal error. The warning will be enabled if
it hasn't been enabled yet.
+ ``-Werror=compat`` has the same effect as ``-Werror=...`` for each warning
+ flag in the :ghc-flag:`-Wcompat` option group.
+
.. ghc-flag:: -Wwarn
:shortdesc: make warnings non-fatal
:type: dynamic
@@ -172,6 +175,9 @@ to abort.
Note that it doesn't fully negate the effects of ``-Werror=<wflag>`` - the
warning will still be enabled.
+ ``-Wwarn=compat`` has the same effect as ``-Wwarn=...`` for each warning
+ flag in the :ghc-flag:`-Wcompat` option group.
+
When a warning is emitted, the specific warning flag which controls
it is shown.
More information about the ghc-commits
mailing list