Commit bcb419a4 authored by sgillespie's avatar sgillespie Committed by Ben Gamari
Browse files

Fix #12099: Remove bogus flags

Remove -fwarn- and -fno-warn- from flagsForCompletion

Testcase: Fix linter error on T12099

For Issue #12099

Reviewers: austin, thomie, bgamari

Reviewed By: austin, thomie, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2281

GHC Trac Issues: #12099
parent 47d81732
...@@ -2994,9 +2994,9 @@ dynamic_flags_deps = [ ...@@ -2994,9 +2994,9 @@ dynamic_flags_deps = [
wWarningFlagsDeps wWarningFlagsDeps
++ map (mkFlag turnOff "fno-warn-" unSetWarningFlag . hideFlag) ++ map (mkFlag turnOff "fno-warn-" unSetWarningFlag . hideFlag)
wWarningFlagsDeps wWarningFlagsDeps
++ [ (NotDeprecated, unrecognisedWarning "W") ++ [ (NotDeprecated, unrecognisedWarning "W"),
, (NotDeprecated, unrecognisedWarning "fwarn-") (Deprecated, unrecognisedWarning "fwarn-"),
, (NotDeprecated, unrecognisedWarning "fno-warn-") ] (Deprecated, unrecognisedWarning "fno-warn-") ]
++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlagsDeps ++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlagsDeps
++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlagsDeps ++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlagsDeps
++ map (mkFlag turnOn "X" setExtensionFlag ) xFlagsDeps ++ map (mkFlag turnOn "X" setExtensionFlag ) xFlagsDeps
...@@ -3015,7 +3015,7 @@ dynamic_flags_deps = [ ...@@ -3015,7 +3015,7 @@ dynamic_flags_deps = [
-- | This is where we handle unrecognised warning flags. We only issue a warning -- | This is where we handle unrecognised warning flags. We only issue a warning
-- if -Wunrecognised-warning-flags is set. See Trac #11429 for context. -- if -Wunrecognised-warning-flags is set. See Trac #11429 for context.
unrecognisedWarning :: String -> Flag (CmdLineP DynFlags) unrecognisedWarning :: String -> Flag (CmdLineP DynFlags)
unrecognisedWarning prefix = defFlag prefix (Prefix action) unrecognisedWarning prefix = defHiddenFlag prefix (Prefix action)
where where
action :: String -> EwM (CmdLineP DynFlags) () action :: String -> EwM (CmdLineP DynFlags) ()
action flag = do action flag = do
......
module Main where
import DynFlags
import Control.Monad
import Data.List
-- Verify bogus flags aren't printed on flagsForCompletion and
-- allNonDeprecatedFlags:
-- * -fwarn-
-- * -fno-warn-
--
-- Should print nothing
main :: IO ()
main = mapM_ print $ fwarnFlags (flagsForCompletion True) ++ nonDepFwarnFlags
-- Get flags beginning with -fwarn- and -fno-warn-
fwarnFlags :: [String] -> [String]
fwarnFlags = filter isFwarn
where isFwarn flag = any (flip isPrefixOf $ flag) ["-fwarn-", "-fno-warn"]
-- Get suggested flags for -fwarn-, -fno-warn-
nonDepFwarnFlags :: [String]
nonDepFwarnFlags = filter isFwarn allNonDeprecatedFlags
where isFwarn "-fwarn-" = True
isFwarn "-fno-warn-" = True
isFwarn _ = False
...@@ -26,3 +26,4 @@ test('T9015', extra_run_opts('"' + config.libdir + '"'), ...@@ -26,3 +26,4 @@ test('T9015', extra_run_opts('"' + config.libdir + '"'),
['-package ghc']) ['-package ghc'])
test('T11579', extra_run_opts('"' + config.libdir + '"'), compile_and_run, test('T11579', extra_run_opts('"' + config.libdir + '"'), compile_and_run,
['-package ghc']) ['-package ghc'])
test('T12099', normal, compile_and_run, ['-package ghc'])
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