diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-02-01 14:32:30 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-02-01 14:32:35 +0100 |
commit | 86897e1fe23cb26fa2278e86542b34c33301606a (patch) | |
tree | 95a00e7174c3c6901b703da436692f79235b80cb /compiler/main/DynFlags.hs | |
parent | 94048f9fb01c541215cfc9cc215af83566b63236 (diff) | |
download | haskell-86897e1fe23cb26fa2278e86542b34c33301606a.tar.gz |
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
Diffstat (limited to 'compiler/main/DynFlags.hs')
-rw-r--r-- | compiler/main/DynFlags.hs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index b86d1a7958..4b4eb77295 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 |