[commit: ghc] master: Implement basic uniform warning set tower (86897e1)
git at git.haskell.org
git at git.haskell.org
Mon Feb 1 14:51:11 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/86897e1fe23cb26fa2278e86542b34c33301606a/ghc
>---------------------------------------------------------------
commit 86897e1fe23cb26fa2278e86542b34c33301606a
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Mon Feb 1 14:32:30 2016 +0100
Implement basic uniform warning set tower
This implements/completes the current basic warning sets to provide the
following tower of warning sets (i.e. each line subsumes the warnings
from the sets listed below):
- `-Weverything`
- `-Wall`
- `-Wextra` (alias of `-W`)
- `-Wdefault`
So for each of flags there's also a complement `-Wno-...` flag, which
subtracts the given set from the current enabled-warnings state.
Thus, we can now easily perform simple set subtraction operations, as
warning flags are evaluated from left-to-right on the command line.
So e.g.
- `-Weverything -Wno-all -Wno-compat` enables *all* warnings not enabled
by `-Wall` and `-Wcompat`.
- `-Wextra -Wno-default` only warnings that `-Wextra` provides
beyond the default warnings.
Reviewers: quchen, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1850
>---------------------------------------------------------------
86897e1fe23cb26fa2278e86542b34c33301606a
compiler/main/DynFlags.hs | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index b86d1a7..4b4eb77 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2579,13 +2579,29 @@ dynamic_flags = [
, defFlag "W" (NoArg (mapM_ setWarningFlag minusWOpts))
, defFlag "Werror" (NoArg (setGeneralFlag Opt_WarnIsError))
, defFlag "Wwarn" (NoArg (unSetGeneralFlag Opt_WarnIsError))
- , defFlag "Wcompat" (NoArg (mapM_ setWarningFlag minusWcompatOpts))
- , defFlag "Wno-compat" (NoArg (mapM_ unSetWarningFlag minusWcompatOpts))
- , defFlag "Wall" (NoArg (mapM_ setWarningFlag minusWallOpts))
, defFlag "Wnot" (NoArg (do upd (\dfs -> dfs {warningFlags = IntSet.empty})
- deprecate "Use -w instead"))
+ deprecate "Use -w or -Wno-everything instead"))
, defFlag "w" (NoArg (upd (\dfs -> dfs {warningFlags = IntSet.empty})))
+ -- New-style uniform warning sets
+ --
+ -- Note that -Weverything > -Wall > -Wextra > -Wdefault > -Wno-everything
+ , defFlag "Weverything" (NoArg (mapM_ setWarningFlag minusWeverythingOpts))
+ , defFlag "Wno-everything"
+ (NoArg (upd (\dfs -> dfs {warningFlags = IntSet.empty})))
+
+ , defFlag "Wall" (NoArg (mapM_ setWarningFlag minusWallOpts))
+ , defFlag "Wno-all" (NoArg (mapM_ unSetWarningFlag minusWallOpts))
+
+ , defFlag "Wextra" (NoArg (mapM_ setWarningFlag minusWOpts))
+ , defFlag "Wno-extra" (NoArg (mapM_ unSetWarningFlag minusWOpts))
+
+ , defFlag "Wdefault" (NoArg (mapM_ setWarningFlag standardWarnings))
+ , defFlag "Wno-default" (NoArg (mapM_ unSetWarningFlag standardWarnings))
+
+ , defFlag "Wcompat" (NoArg (mapM_ setWarningFlag minusWcompatOpts))
+ , defFlag "Wno-compat" (NoArg (mapM_ unSetWarningFlag minusWcompatOpts))
+
------ Plugin flags ------------------------------------------------
, defGhcFlag "fplugin-opt" (hasArg addPluginModuleNameOption)
, defGhcFlag "fplugin" (hasArg addPluginModuleName)
@@ -3540,6 +3556,10 @@ minusWallOpts
Opt_WarnMissingPatSynSigs
]
+-- | Things you get with -Weverything, i.e. *all* known warnings flags
+minusWeverythingOpts :: [WarningFlag]
+minusWeverythingOpts = [ toEnum 0 .. ]
+
-- | Things you get with -Wcompat.
--
-- This is intended to group together warnings that will be enabled by default
More information about the ghc-commits
mailing list