summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2016-02-23 23:13:33 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2016-02-23 23:53:05 +0100
commit32a9a7f514bdd33ff72a673ade2591e4e815be58 (patch)
tree91aab6c3728a83168cdb6b15eb47c99381142318 /compiler/main
parenta3e0e9365e4f195d5dad9389955869744f2cdba9 (diff)
downloadhaskell-32a9a7f514bdd33ff72a673ade2591e4e815be58.tar.gz
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
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/DynFlags.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 52da3005bf..62fa936bff 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))]