Commit 04e9fe5c authored by Vladislav Zavialov's avatar Vladislav Zavialov Committed by Ben Gamari

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
parent 008ea12d
......@@ -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)
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment