[commit: ghc] master: Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*` (32a9a7f)
git at git.haskell.org
git at git.haskell.org
Tue Feb 23 22:51:46 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/32a9a7f514bdd33ff72a673ade2591e4e815be58/ghc
>---------------------------------------------------------------
commit 32a9a7f514bdd33ff72a673ade2591e4e815be58
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.
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1942
>---------------------------------------------------------------
32a9a7f514bdd33ff72a673ade2591e4e815be58
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 52da300..62fa936 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2935,14 +2935,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.")
@@ -2953,13 +2955,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 pfx = defFlag pfx (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: -" ++ pfx ++ flag
-- See Note [Supporting CLI completion]
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
More information about the ghc-commits
mailing list