[commit: ghc] ghc-8.0: Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*` (3d345e8)
git at git.haskell.org
git at git.haskell.org
Tue Feb 23 22:56:28 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/3d345e8f1551b21980aeef9110463ecd2ee2686f/ghc
>---------------------------------------------------------------
commit 3d345e8f1551b21980aeef9110463ecd2ee2686f
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Tue Feb 23 23:13:33 2016 +0100
Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*`
The original implementation for #11429 covers only `-W*` flags. However,
old packages will continue to use `-f(no-)warn-*` flags, so it seems
desirable to have `-Wunrecognised-warning-flag` apply to those legacy aliases
as well.
(cherry picked from commit 32a9a7f514bdd33ff72a673ade2591e4e815be58)
>---------------------------------------------------------------
3d345e8f1551b21980aeef9110463ecd2ee2686f
compiler/main/DynFlags.hs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index c02e0d3..57fd140 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2931,14 +2931,16 @@ dynamic_flags_deps = [
wWarningFlagsDeps
++ map (mkFlag turnOff "fno-warn-" unSetWarningFlag . hideFlag)
wWarningFlagsDeps
+ ++ [ (NotDeprecated, unrecognisedWarning "W")
+ , (NotDeprecated, unrecognisedWarning "fwarn-")
+ , (NotDeprecated, unrecognisedWarning "fno-warn-") ]
++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlagsDeps
++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlagsDeps
++ map (mkFlag turnOn "X" setExtensionFlag ) xFlagsDeps
++ map (mkFlag turnOff "XNo" unSetExtensionFlag) xFlagsDeps
++ map (mkFlag turnOn "X" setLanguage ) languageFlagsDeps
++ map (mkFlag turnOn "X" setSafeHaskell ) safeHaskellFlagsDeps
- ++ [ (NotDeprecated, unrecognisedWarning)
- , make_dep_flag defFlag "XGenerics"
+ ++ [ make_dep_flag defFlag "XGenerics"
(NoArg $ return ())
("it does nothing; look into -XDefaultSignatures " ++
"and -XDeriveGeneric for generic programming support.")
@@ -2949,13 +2951,13 @@ dynamic_flags_deps = [
-- | This is where we handle unrecognised warning flags. We only issue a warning
-- if -Wunrecognised-warning-flags is set. See Trac #11429 for context.
-unrecognisedWarning :: Flag (CmdLineP DynFlags)
-unrecognisedWarning = defFlag "W" (Prefix action)
+unrecognisedWarning :: String -> Flag (CmdLineP DynFlags)
+unrecognisedWarning prefix = defFlag prefix (Prefix action)
where
action :: String -> EwM (CmdLineP DynFlags) ()
action flag = do
f <- wopt Opt_WarnUnrecognisedWarningFlags <$> liftEwM getCmdLineState
- when f $ addWarn $ "unrecognised warning flag: -W" ++ flag
+ when f $ addWarn $ "unrecognised warning flag: -" ++ prefix ++ flag
-- See Note [Supporting CLI completion]
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
More information about the ghc-commits
mailing list