[commit: ghc] master: Simplify implementation of wWarningFlags (76aaa6e)
git at git.haskell.org
git at git.haskell.org
Fri Oct 7 14:20:53 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/76aaa6eed264ac2398753a09418c6e1374244ff6/ghc
>---------------------------------------------------------------
commit 76aaa6eed264ac2398753a09418c6e1374244ff6
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date: Fri Oct 7 15:19:56 2016 +0100
Simplify implementation of wWarningFlags
>---------------------------------------------------------------
76aaa6eed264ac2398753a09418c6e1374244ff6
compiler/main/DynFlags.hs | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 63bb0ef..b78d665 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -186,6 +186,7 @@ import Control.Monad.Trans.Reader
import Control.Monad.Trans.Except
import Control.Exception (throwIO)
+import Data.Ord
import Data.Bits
import Data.Char
import Data.Int
@@ -2295,7 +2296,7 @@ flagsPackage = map snd package_flags_deps
type FlagMaker m = String -> OptKind m -> Flag m
type DynFlagMaker = FlagMaker (CmdLineP DynFlags)
-data Deprecation = Deprecated | NotDeprecated
+data Deprecation = NotDeprecated | Deprecated deriving (Eq, Ord)
-- Make a non-deprecated flag
make_ord_flag :: DynFlagMaker -> String -> OptKind (CmdLineP DynFlags)
@@ -3236,15 +3237,7 @@ flagSpecOf flag = listToMaybe $ filter check wWarningFlags
-- | These @-W\<blah\>@ flags can all be reversed with @-Wno-\<blah\>@
wWarningFlags :: [FlagSpec WarningFlag]
-wWarningFlags = wWarningFlagsDepsCurrent ++ wWarningFlagsDepsDeprecated
- where
- deprecatedWFlags = filter (not . isCurr) wWarningFlagsDeps
- currentWFlags = filter isCurr wWarningFlagsDeps
- wWarningFlagsDepsCurrent = map snd currentWFlags
- wWarningFlagsDepsDeprecated = map snd deprecatedWFlags
-
- isCurr ( Deprecated , _ ) = False
- isCurr _ = True
+wWarningFlags = map snd (sortBy (comparing fst) wWarningFlagsDeps)
wWarningFlagsDeps :: [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps = [
More information about the ghc-commits
mailing list