[commit: ghc] ghc-8.0: Implement basic uniform warning set tower (49637f8)

git at git.haskell.org git at git.haskell.org
Tue Feb 2 09:47:27 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/49637f888d21a9020928387757cecb22aa5b9288/ghc

>---------------------------------------------------------------

commit 49637f888d21a9020928387757cecb22aa5b9288
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
    
    (cherry picked from commit 86897e1fe23cb26fa2278e86542b34c33301606a)


>---------------------------------------------------------------

49637f888d21a9020928387757cecb22aa5b9288
 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 3850026..21f63e6 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2583,13 +2583,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)
@@ -3543,6 +3559,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