summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luposchainsky <dluposchainsky@gmail.com>2015-12-16 11:42:00 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2015-12-16 12:31:35 +0100
commit2206fa8cdb1209320f3690690b610320b4810de6 (patch)
tree6b2ffe50753ed62035716f6fba9e0d0a4ff51b26
parent3a48e6ef80e4bf3d84814316cace259147f67df2 (diff)
downloadhaskell-2206fa8cdb1209320f3690690b610320b4810de6.tar.gz
Add `-W(no-)xxx` aliases for `-f(no-)warn-xxx` flags
This also updates the user's guide to refer to the `-W`-based warning flags by default. Quoting the release note entry: | Warnings can now be controlled with `-W(no-)...` flags in addition to | the old `-f(no-)warn...` ones. This was done as the first part of a | rewrite of the warning system to provide better control over warnings, | better warning messages, and more common syntax compared to other | compilers. The old `-fwarn...`-based warning flags will remain | functional for the forseeable future. This is part of https://ghc.haskell.org/wiki/Design/Warnings and addresses #11218 Reviewed By: hvr, bgamari Differential Revision: https://phabricator.haskell.org/D1613
-rw-r--r--compiler/main/DynFlags.hs176
-rw-r--r--compiler/main/HscMain.hs8
-rw-r--r--compiler/main/InteractiveEval.hs2
-rw-r--r--compiler/rename/RnPat.hs2
-rw-r--r--compiler/typecheck/TcClassDcl.hs2
-rw-r--r--compiler/typecheck/TcDeriv.hs2
-rw-r--r--compiler/typecheck/TcErrors.hs4
-rw-r--r--compiler/typecheck/TcSimplify.hs4
-rw-r--r--docs/users_guide/7.12.1-notes.rst19
-rw-r--r--docs/users_guide/ghci.rst8
-rw-r--r--docs/users_guide/glasgow_exts.rst20
-rw-r--r--docs/users_guide/runghc.rst2
-rw-r--r--docs/users_guide/safe_haskell.rst8
-rw-r--r--docs/users_guide/separate_compilation.rst4
-rw-r--r--docs/users_guide/sooner.rst2
-rw-r--r--docs/users_guide/using-warnings.rst288
-rw-r--r--docs/users_guide/using.rst6
-rw-r--r--ghc/InteractiveUI.hs15
-rw-r--r--testsuite/tests/ghci/scripts/Makefile2
-rw-r--r--testsuite/tests/ghci/scripts/ghci024.stdout4
-rw-r--r--utils/mkUserGuidePart/Options/Warnings.hs196
21 files changed, 396 insertions, 378 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 3b531f58c4..5b16bd69b0 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -48,7 +48,8 @@ module DynFlags (
PkgConfRef(..),
Option(..), showOpt,
DynLibLoader(..),
- fFlags, fWarningFlags, fLangFlags, xFlags,
+ fFlags, fLangFlags, xFlags,
+ wWarningFlags,
dynFlagDependencies,
tablesNextToCode, mkTablesNextToCode,
SigOf, getSigOf,
@@ -503,7 +504,7 @@ data WarningFlag =
| Opt_WarnUnusedPatternBinds
| Opt_WarnUnusedImports
| Opt_WarnUnusedMatches
- | Opt_WarnContextQuantification -- remove in 8.2
+ | Opt_WarnContextQuantification -- remove in 8.2
| Opt_WarnWarningsDeprecations
| Opt_WarnDeprecatedFlags
| Opt_WarnAMP -- Introduced in GHC 7.8, obsolete since 7.10
@@ -2610,8 +2611,10 @@ dynamic_flags = [
, defFlag "fno-glasgow-exts"
(NoArg (do disableGlasgowExts
deprecate "Use individual extensions instead"))
- , defFlag "fwarn-unused-binds" (NoArg enableUnusedBinds)
- , defFlag "fno-warn-unused-binds" (NoArg disableUnusedBinds)
+ , defFlag "Wunused-binds" (NoArg enableUnusedBinds)
+ , defFlag "Wno-unused-binds" (NoArg disableUnusedBinds)
+ , defHiddenFlag "fwarn-unused-binds" (NoArg enableUnusedBinds)
+ , defHiddenFlag "fno-warn-unused-binds" (NoArg disableUnusedBinds)
------ Safe Haskell flags -------------------------------------------
, defFlag "fpackage-trust" (NoArg setPackageTrust)
@@ -2622,20 +2625,22 @@ dynamic_flags = [
------ Debugging flags ----------------------------------------------
, defGhcFlag "g" (OptIntSuffix setDebugLevel)
]
- ++ map (mkFlag turnOn "" setGeneralFlag ) negatableFlags
- ++ map (mkFlag turnOff "no-" unSetGeneralFlag) negatableFlags
- ++ map (mkFlag turnOn "d" setGeneralFlag ) dFlags
- ++ map (mkFlag turnOff "dno-" unSetGeneralFlag) dFlags
- ++ map (mkFlag turnOn "f" setGeneralFlag ) fFlags
- ++ map (mkFlag turnOff "fno-" unSetGeneralFlag) fFlags
- ++ map (mkFlag turnOn "f" setWarningFlag ) fWarningFlags
- ++ map (mkFlag turnOff "fno-" unSetWarningFlag) fWarningFlags
- ++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlags
- ++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlags
- ++ map (mkFlag turnOn "X" setExtensionFlag ) xFlags
- ++ map (mkFlag turnOff "XNo" unSetExtensionFlag) xFlags
- ++ map (mkFlag turnOn "X" setLanguage) languageFlags
- ++ map (mkFlag turnOn "X" setSafeHaskell) safeHaskellFlags
+ ++ map (mkFlag turnOn "" setGeneralFlag ) negatableFlags
+ ++ map (mkFlag turnOff "no-" unSetGeneralFlag ) negatableFlags
+ ++ map (mkFlag turnOn "d" setGeneralFlag ) dFlags
+ ++ map (mkFlag turnOff "dno-" unSetGeneralFlag ) dFlags
+ ++ map (mkFlag turnOn "f" setGeneralFlag ) fFlags
+ ++ map (mkFlag turnOff "fno-" unSetGeneralFlag ) fFlags
+ ++ map (mkFlag turnOn "W" setWarningFlag ) wWarningFlags
+ ++ map (mkFlag turnOff "Wno-" unSetWarningFlag ) wWarningFlags
+ ++ map (mkFlag turnOn "fwarn-" setWarningFlag . hideFlag) wWarningFlags
+ ++ map (mkFlag turnOff "fno-warn-" unSetWarningFlag . hideFlag) wWarningFlags
+ ++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlags
+ ++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlags
+ ++ map (mkFlag turnOn "X" setExtensionFlag ) xFlags
+ ++ map (mkFlag turnOff "XNo" unSetExtensionFlag) xFlags
+ ++ map (mkFlag turnOn "X" setLanguage ) languageFlags
+ ++ map (mkFlag turnOn "X" setSafeHaskell ) safeHaskellFlags
++ [ defFlag "XGenerics"
(NoArg (deprecate $
"it does nothing; look into -XDefaultSignatures " ++
@@ -2740,6 +2745,13 @@ flagHiddenSpec name flag = flagHiddenSpec' name flag nop
flagHiddenSpec' :: String -> flag -> (TurnOnFlag -> DynP ()) -> FlagSpec flag
flagHiddenSpec' name flag act = FlagSpec name flag act HiddenFlag
+-- | Hide a 'FlagSpec' from being displayed in @--show-options@.
+--
+-- This is for example useful for flags that are obsolete, but should not
+-- (yet) be deprecated for compatibility reasons.
+hideFlag :: FlagSpec a -> FlagSpec a
+hideFlag fs = fs { flagSpecGhcMode = HiddenFlag }
+
mkFlag :: TurnOnFlag -- ^ True <=> it should be turned on
-> String -- ^ The flag prefix
-> (flag -> DynP ()) -- ^ What to do when the flag is found
@@ -2765,80 +2777,80 @@ useInstead flag turn_on
nop :: TurnOnFlag -> DynP ()
nop _ = return ()
--- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
-fWarningFlags :: [FlagSpec WarningFlag]
-fWarningFlags = [
+-- | These @-W\<blah\>@ flags can all be reversed with @-Wno-\<blah\>@
+wWarningFlags :: [FlagSpec WarningFlag]
+wWarningFlags = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
-- Please keep the list of flags below sorted alphabetically
- flagSpec "warn-alternative-layout-rule-transitional"
+ flagSpec "alternative-layout-rule-transitional"
Opt_WarnAlternativeLayoutRuleTransitional,
- flagSpec' "warn-amp" Opt_WarnAMP
+ flagSpec' "amp" Opt_WarnAMP
(\_ -> deprecate "it has no effect"),
- flagSpec' "warn-auto-orphans" Opt_WarnAutoOrphans
+ flagSpec' "auto-orphans" Opt_WarnAutoOrphans
(\_ -> deprecate "it has no effect"),
- flagSpec "warn-deferred-type-errors" Opt_WarnDeferredTypeErrors,
- flagSpec "warn-deprecations" Opt_WarnWarningsDeprecations,
- flagSpec "warn-deprecated-flags" Opt_WarnDeprecatedFlags,
- flagSpec "warn-deriving-typeable" Opt_WarnDerivingTypeable,
- flagSpec "warn-dodgy-exports" Opt_WarnDodgyExports,
- flagSpec "warn-dodgy-foreign-imports" Opt_WarnDodgyForeignImports,
- flagSpec "warn-dodgy-imports" Opt_WarnDodgyImports,
- flagSpec "warn-empty-enumerations" Opt_WarnEmptyEnumerations,
- flagSpec' "warn-context-quantification" Opt_WarnContextQuantification
+ flagSpec "deferred-type-errors" Opt_WarnDeferredTypeErrors,
+ flagSpec "deprecations" Opt_WarnWarningsDeprecations,
+ flagSpec "deprecated-flags" Opt_WarnDeprecatedFlags,
+ flagSpec "deriving-typeable" Opt_WarnDerivingTypeable,
+ flagSpec "dodgy-exports" Opt_WarnDodgyExports,
+ flagSpec "dodgy-foreign-imports" Opt_WarnDodgyForeignImports,
+ flagSpec "dodgy-imports" Opt_WarnDodgyImports,
+ flagSpec "empty-enumerations" Opt_WarnEmptyEnumerations,
+ flagSpec' "context-quantification" Opt_WarnContextQuantification
(\_ -> deprecate "it is subsumed by an error message that cannot be disabled"),
- flagSpec' "warn-duplicate-constraints" Opt_WarnDuplicateConstraints
- (\_ -> deprecate "it is subsumed by -fwarn-redundant-constraints"),
- flagSpec "warn-redundant-constraints" Opt_WarnRedundantConstraints,
- flagSpec "warn-duplicate-exports" Opt_WarnDuplicateExports,
- flagSpec "warn-hi-shadowing" Opt_WarnHiShadows,
- flagSpec "warn-implicit-prelude" Opt_WarnImplicitPrelude,
- flagSpec "warn-incomplete-patterns" Opt_WarnIncompletePatterns,
- flagSpec "warn-incomplete-record-updates" Opt_WarnIncompletePatternsRecUpd,
- flagSpec "warn-incomplete-uni-patterns" Opt_WarnIncompleteUniPatterns,
- flagSpec "warn-inline-rule-shadowing" Opt_WarnInlineRuleShadowing,
- flagSpec "warn-identities" Opt_WarnIdentities,
- flagSpec "warn-missing-fields" Opt_WarnMissingFields,
- flagSpec "warn-missing-import-lists" Opt_WarnMissingImportList,
- flagSpec "warn-missing-local-sigs" Opt_WarnMissingLocalSigs,
- flagSpec "warn-missing-methods" Opt_WarnMissingMethods,
- flagSpec "warn-missing-monadfail-instance" Opt_WarnMissingMonadFailInstance,
- flagSpec "warn-semigroup" Opt_WarnSemigroup,
- flagSpec "warn-missing-signatures" Opt_WarnMissingSigs,
- flagSpec "warn-missing-exported-sigs" Opt_WarnMissingExportedSigs,
- flagSpec "warn-monomorphism-restriction" Opt_WarnMonomorphism,
- flagSpec "warn-name-shadowing" Opt_WarnNameShadowing,
- flagSpec "warn-noncanonical-monad-instances"
+ flagSpec' "duplicate-constraints" Opt_WarnDuplicateConstraints
+ (\_ -> deprecate "it is subsumed by -Wredundant-constraints"),
+ flagSpec "redundant-constraints" Opt_WarnRedundantConstraints,
+ flagSpec "duplicate-exports" Opt_WarnDuplicateExports,
+ flagSpec "hi-shadowing" Opt_WarnHiShadows,
+ flagSpec "implicit-prelude" Opt_WarnImplicitPrelude,
+ flagSpec "incomplete-patterns" Opt_WarnIncompletePatterns,
+ flagSpec "incomplete-record-updates" Opt_WarnIncompletePatternsRecUpd,
+ flagSpec "incomplete-uni-patterns" Opt_WarnIncompleteUniPatterns,
+ flagSpec "inline-rule-shadowing" Opt_WarnInlineRuleShadowing,
+ flagSpec "identities" Opt_WarnIdentities,
+ flagSpec "missing-fields" Opt_WarnMissingFields,
+ flagSpec "missing-import-lists" Opt_WarnMissingImportList,
+ flagSpec "missing-local-sigs" Opt_WarnMissingLocalSigs,
+ flagSpec "missing-methods" Opt_WarnMissingMethods,
+ flagSpec "missing-monadfail-instance" Opt_WarnMissingMonadFailInstance,
+ flagSpec "semigroup" Opt_WarnSemigroup,
+ flagSpec "missing-signatures" Opt_WarnMissingSigs,
+ flagSpec "missing-exported-sigs" Opt_WarnMissingExportedSigs,
+ flagSpec "monomorphism-restriction" Opt_WarnMonomorphism,
+ flagSpec "name-shadowing" Opt_WarnNameShadowing,
+ flagSpec "noncanonical-monad-instances"
Opt_WarnNonCanonicalMonadInstances,
- flagSpec "warn-noncanonical-monoid-instances"
+ flagSpec "noncanonical-monoid-instances"
Opt_WarnNonCanonicalMonoidInstances,
- flagSpec "warn-orphans" Opt_WarnOrphans,
- flagSpec "warn-overflowed-literals" Opt_WarnOverflowedLiterals,
- flagSpec "warn-overlapping-patterns" Opt_WarnOverlappingPatterns,
- flagSpec "warn-missed-specialisations" Opt_WarnMissedSpecs,
- flagSpec "warn-all-missed-specialisations" Opt_WarnAllMissedSpecs,
- flagSpec' "warn-safe" Opt_WarnSafe setWarnSafe,
- flagSpec "warn-trustworthy-safe" Opt_WarnTrustworthySafe,
- flagSpec "warn-tabs" Opt_WarnTabs,
- flagSpec "warn-type-defaults" Opt_WarnTypeDefaults,
- flagSpec "warn-typed-holes" Opt_WarnTypedHoles,
- flagSpec "warn-partial-type-signatures" Opt_WarnPartialTypeSignatures,
- flagSpec "warn-unrecognised-pragmas" Opt_WarnUnrecognisedPragmas,
- flagSpec' "warn-unsafe" Opt_WarnUnsafe setWarnUnsafe,
- flagSpec "warn-unsupported-calling-conventions"
+ flagSpec "orphans" Opt_WarnOrphans,
+ flagSpec "overflowed-literals" Opt_WarnOverflowedLiterals,
+ flagSpec "overlapping-patterns" Opt_WarnOverlappingPatterns,
+ flagSpec "missed-specialisations" Opt_WarnMissedSpecs,
+ flagSpec "all-missed-specialisations" Opt_WarnAllMissedSpecs,
+ flagSpec' "safe" Opt_WarnSafe setWarnSafe,
+ flagSpec "trustworthy-safe" Opt_WarnTrustworthySafe,
+ flagSpec "tabs" Opt_WarnTabs,
+ flagSpec "type-defaults" Opt_WarnTypeDefaults,
+ flagSpec "typed-holes" Opt_WarnTypedHoles,
+ flagSpec "partial-type-signatures" Opt_WarnPartialTypeSignatures,
+ flagSpec "unrecognised-pragmas" Opt_WarnUnrecognisedPragmas,
+ flagSpec' "unsafe" Opt_WarnUnsafe setWarnUnsafe,
+ flagSpec "unsupported-calling-conventions"
Opt_WarnUnsupportedCallingConventions,
- flagSpec "warn-unsupported-llvm-version" Opt_WarnUnsupportedLlvmVersion,
- flagSpec "warn-unticked-promoted-constructors"
+ flagSpec "unsupported-llvm-version" Opt_WarnUnsupportedLlvmVersion,
+ flagSpec "unticked-promoted-constructors"
Opt_WarnUntickedPromotedConstructors,
- flagSpec "warn-unused-do-bind" Opt_WarnUnusedDoBind,
- flagSpec "warn-unused-imports" Opt_WarnUnusedImports,
- flagSpec "warn-unused-local-binds" Opt_WarnUnusedLocalBinds,
- flagSpec "warn-unused-matches" Opt_WarnUnusedMatches,
- flagSpec "warn-unused-pattern-binds" Opt_WarnUnusedPatternBinds,
- flagSpec "warn-unused-top-binds" Opt_WarnUnusedTopBinds,
- flagSpec "warn-warnings-deprecations" Opt_WarnWarningsDeprecations,
- flagSpec "warn-wrong-do-bind" Opt_WarnWrongDoBind,
- flagSpec "warn-missing-pat-syn-sigs" Opt_WarnMissingPatSynSigs]
+ flagSpec "unused-do-bind" Opt_WarnUnusedDoBind,
+ flagSpec "unused-imports" Opt_WarnUnusedImports,
+ flagSpec "unused-local-binds" Opt_WarnUnusedLocalBinds,
+ flagSpec "unused-matches" Opt_WarnUnusedMatches,
+ flagSpec "unused-pattern-binds" Opt_WarnUnusedPatternBinds,
+ flagSpec "unused-top-binds" Opt_WarnUnusedTopBinds,
+ flagSpec "warnings-deprecations" Opt_WarnWarningsDeprecations,
+ flagSpec "wrong-do-bind" Opt_WarnWrongDoBind,
+ flagSpec "missing-pat-syn-sigs" Opt_WarnMissingPatSynSigs]
-- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@
negatableFlags :: [FlagSpec GeneralFlag]
@@ -3405,7 +3417,7 @@ enableUnusedBinds = mapM_ setWarningFlag unusedBindsFlags
disableUnusedBinds :: DynP ()
disableUnusedBinds = mapM_ unSetWarningFlag unusedBindsFlags
--- Things you get with -fwarn-unused-binds
+-- Things you get with -Wunused-binds
unusedBindsFlags :: [WarningFlag]
unusedBindsFlags = [ Opt_WarnUnusedTopBinds
, Opt_WarnUnusedLocalBinds
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index bd0fa19e03..0b60596123 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -270,8 +270,8 @@ ioMsgMaybe' ioA = do
#ifdef GHCI
hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name]
-hscTcRnLookupRdrName hsc_env0 rdr_name
- = runInteractiveHsc hsc_env0 $
+hscTcRnLookupRdrName hsc_env0 rdr_name
+ = runInteractiveHsc hsc_env0 $
do { hsc_env <- getHscEnv
; ioMsgMaybe $ tcRnLookupRdrName hsc_env rdr_name }
#endif
@@ -809,8 +809,8 @@ hscFileFrontEnd mod_summary = do
--
-- It used to be that we only did safe inference on modules that had no Safe
-- Haskell flags, but now we perform safe inference on all modules as we want
--- to allow users to set the `-fwarn-safe`, `-fwarn-unsafe` and
--- `-fwarn-trustworthy-safe` flags on Trustworthy and Unsafe modules so that a
+-- to allow users to set the `-Wsafe`, `-Wunsafe` and
+-- `-Wtrustworthy-safe` flags on Trustworthy and Unsafe modules so that a
-- user can ensure their assumptions are correct and see reasons for why a
-- module is safe or unsafe.
--
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 286b62e9f7..ac53382a78 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -182,7 +182,7 @@ execStmt stmt ExecOptions{..} = do
-- wait on this when a computation is running
statusMVar <- liftIO $ newEmptyMVar
- -- Turn off -fwarn-unused-local-binds when running a statement, to hide
+ -- Turn off -Wunused-local-binds when running a statement, to hide
-- warnings about the implicit bindings we introduce.
let ic = hsc_IC hsc_env -- use the interactive dflags
idflags' = ic_dflags ic `wopt_unset` Opt_WarnUnusedLocalBinds
diff --git a/compiler/rename/RnPat.hs b/compiler/rename/RnPat.hs
index 641d86dc7e..ff25bda1cd 100644
--- a/compiler/rename/RnPat.hs
+++ b/compiler/rename/RnPat.hs
@@ -178,7 +178,7 @@ data NameMaker
= LamMk -- Lambdas
Bool -- True <=> report unused bindings
-- (even if True, the warning only comes out
- -- if -fwarn-unused-matches is on)
+ -- if -Wunused-matches is on)
| LetMk -- Let bindings, incl top level
-- Do *not* check for unused bindings
diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs
index 521390b0f0..64bf2d5fe6 100644
--- a/compiler/typecheck/TcClassDcl.hs
+++ b/compiler/typecheck/TcClassDcl.hs
@@ -491,7 +491,7 @@ warnMissingAT :: Name -> TcM ()
warnMissingAT name
= do { warn <- woptM Opt_WarnMissingMethods
; traceTc "warn" (ppr name <+> ppr warn)
- ; warnTc warn -- Warn only if -fwarn-missing-methods
+ ; warnTc warn -- Warn only if -Wmissing-methods
(ptext (sLit "No explicit") <+> text "associated type"
<+> ptext (sLit "or default declaration for ")
<+> quotes (ppr name)) }
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 94b94e7327..6a0e6cbcdd 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -443,7 +443,7 @@ Consider this (see Trac #1954):
module Bug(P) where
newtype P a = MkP (IO a) deriving Monad
-If you compile with -fwarn-unused-binds you do not expect the warning
+If you compile with -Wunused-binds you do not expect the warning
"Defined but not used: data consructor MkP". Yet the newtype deriving
code does not explicitly mention MkP, but it should behave as if you
had written
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 672b499cad..717a6071d2 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -259,7 +259,7 @@ data ReportErrCtxt
, cec_expr_holes :: HoleChoice -- Holes in expressions
, cec_type_holes :: HoleChoice -- Holes in types
- , cec_warn_redundant :: Bool -- True <=> -fwarn-redundant-constraints
+ , cec_warn_redundant :: Bool -- True <=> -Wredundant-constraints
, cec_suppress :: Bool -- True <=> More important errors have occurred,
-- so create bindings if need be, but
@@ -590,7 +590,7 @@ maybeReportHoleError ctxt ct err
-- Otherwise this is a typed hole in an expression
| otherwise
- = -- If deferring, report a warning only if -fwarn-typed-holds is on
+ = -- If deferring, report a warning only if -Wtyped-holds is on
case cec_expr_holes ctxt of
HoleError -> reportError err
HoleWarn -> reportWarning err
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index 94ea445217..f4ab2a9e6e 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -340,7 +340,7 @@ How is this implemented? It's complicated! So we'll step through it all:
compilation should fail. These are handled as normal constraint resolution
failures from here-on (see step 6).
- Otherwise, we may be inferring safety (or using `-fwarn-unsafe`), and
+ Otherwise, we may be inferring safety (or using `-Wunsafe`), and
compilation should succeed, but print warnings and/or mark the compiled module
as `-XUnsafe`. In this case, we call `insertSafeOverlapFailureTcS` which adds
the unsafe (but resolved!) constraint to the `inert_safehask` field of
@@ -350,7 +350,7 @@ How is this implemented? It's complicated! So we'll step through it all:
constraint resolution. Once finished, we call `getSafeOverlapFailures` to
retrieve the list of overlapping instances that were successfully resolved,
but unsafe. Remember, this is only applicable for generating warnings
- (`-fwarn-unsafe`) or inferring a module unsafe. `-XSafe` and `-XTrustworthy`
+ (`-Wunsafe`) or inferring a module unsafe. `-XSafe` and `-XTrustworthy`
cause compilation failure by not resolving the unsafe constraint at all.
`simpl_top` returns a list of unresolved constraints (all types), and resolved
(but unsafe) resolved dictionary constraints.
diff --git a/docs/users_guide/7.12.1-notes.rst b/docs/users_guide/7.12.1-notes.rst
index 0604fef7e3..77d012ba60 100644
--- a/docs/users_guide/7.12.1-notes.rst
+++ b/docs/users_guide/7.12.1-notes.rst
@@ -160,6 +160,13 @@ Language
Compiler
~~~~~~~~
+- Warnings can now be controlled with ``-W(no-)...`` flags in addition to
+ the old ``-f(no-)warn...`` ones. This was done as the first part of a
+ rewrite of the warning system to provide better control over warnings,
+ better warning messages, and more common syntax compared to other
+ compilers. The old ``-f``-based warning flags will remain functional for
+ the forseeable future.
+
- Added the option ``-dth-dec-file``. This dumps out a .th.hs file of
all Template Haskell declarations in a corresponding .hs file. The
idea is that application developers can check this into their
@@ -184,14 +191,14 @@ Compiler
Enabling ``-fworker-wrapper`` while strictness analysis is disabled (by
``-fno-strictness``) has no effect.
-- Added the options ``-fwarn-missed-specialisations`` and
- ``-fwarn-all-missed-specialisations``. When enabled, the simplifier will
+- Added the options ``-Wmissed-specialisations`` and
+ ``-Wall-missed-specialisations``. When enabled, the simplifier will
produce a warning when a overloaded imported function cannot be
specialised (typically due to a missing ``INLINEABLE`` pragma). This
is intended to alert users to cases where they apply ``INLINEABLE`` but
may not get the speed-up they expect.
-- Added the option ``-fwarn-noncanonical-monad-instances`` which helps
+- Added the option ``-Wnoncanonical-monad-instances`` which helps
detect noncanonical ``Applicative``/``Monad`` instance definitions.
See flag description in :ref:`options-sanity` for more details.
@@ -204,19 +211,19 @@ Compiler
allows library authors eager to make their code future compatible to adapt
to new features before they even generate warnings.
-- Added the ``-fwarn-missing-monadfail-instance`` flag. When enabled, this
+- Added the ``-Wmissing-monadfail-instance`` flag. When enabled, this
will issue a warning if a failable pattern is used in a context that does
not have a ``MonadFail`` constraint. This flag represents phase 1 of the
`MonadFail Proposal (MFP)
<https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__.
-- Added the ``-fwarn-semigroup`` flag. When enabled, this
+- Added the ``-Wsemigroup`` flag. When enabled, this
will issue a warning if a type is an instance of ``Monoid`` but not
``Semigroup``, and when a custom definition ``(<>)`` is made. Fixing these
warnings makes sure the definition of ``Semigroup`` as a superclass of
``Monoid`` does not break any code.
-- Added the ``-fwarn-missing-pat-syn-sigs`` flag. When enabled, this will issue
+- Added the ``-Wmissing-pat-syn-sigs`` flag. When enabled, this will issue
a warning when a pattern synonym definition doesn't have a type signature.
It is turned off by default but enabled by ``-Wall``.
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index beb946ee2d..06cc7a2dc3 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -1372,7 +1372,7 @@ breakpoint. Note: GHC considers the TAB character to have a width of 1,
wherever it occurs; in other words it counts characters, rather than
columns. This matches what some editors do, and doesn't match others.
The best advice is to avoid tab characters in your source code
-altogether (see ``-fwarn-tabs`` in :ref:`options-sanity`).
+altogether (see ``-Wtabs`` in :ref:`options-sanity`).
If the module is omitted, then the most recently-loaded module is used.
@@ -2697,11 +2697,11 @@ Setting GHC command-line options in GHCi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Normal GHC command-line options may also be set using ``:set``. For
-example, to turn on ``-fwarn-missing-signatures``, you would say:
+example, to turn on ``-Wmissing-signatures``, you would say:
::
- Prelude> :set -fwarn-missing-signatures
+ Prelude> :set -Wmissing-signatures
Any GHC command-line option that is designated as dynamic (see the table
in :ref:`flag-reference`), may be set using ``:set``. To unset an
@@ -2712,7 +2712,7 @@ option, you can set the reverse option:
::
- Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
+ Prelude> :set -Wno-incomplete-patterns -XNoMultiParamTypeClasses
:ref:`flag-reference` lists the reverse for each option where
applicable.
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index f9bd20d2f8..30a1b68f2b 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -2029,7 +2029,7 @@ example, consider these two candidate definitions of ``absurd``:
We much prefer (B). Why? Because GHC can figure out that
``(True :~: False)`` is an empty type. So (B) has no partiality and GHC
-should be able to compile with ``-fwarn-incomplete-patterns``. (Though
+should be able to compile with ``-Wincomplete-patterns``. (Though
the pattern match checking is not yet clever enough to do that.) On the
other hand (A) looks dangerous, and GHC doesn't check to make sure that,
in fact, the function can never get called.
@@ -2156,7 +2156,7 @@ interests of supporting backward compatibility; for example, a newer
version of ``A`` might export ``g``, and you want ``B`` to work in
either case.
-The warning ``-fwarn-dodgy-imports``, which is off by default but
+The warning ``-Wdodgy-imports``, which is off by default but
included with ``-W``, warns if you hide something that the imported
module does not export.
@@ -4494,7 +4494,7 @@ methods.
This is
mostly useful in classes whose `minimal set <#minimal-pragma>`__ is
empty, and especially when writing
-`generic functions <#generic-programming>`__.
+`generic functions <#generic-programming>`__.
As an example, consider a simple pretty-printer class ``SPretty``, which outputs
pretty strings: ::
@@ -8510,7 +8510,7 @@ example:
newtype Swizzle' = MkSwizzle' (Ord a => [a] -> [a])
As of GHC 7.10, this is deprecated. The
-``-fwarn-context-quantification`` flag detects this situation and issues
+``-Wcontext-quantification`` flag detects this situation and issues
a warning. In GHC 8.0 this flag was deprecated and declarations such as
``MkSwizzle'`` will cause an out-of-scope error.
@@ -9264,7 +9264,7 @@ in a partial type signature, informing the programmer of the inferred
type. When the ``-XPartialTypeSignatures`` flag is enabled, the
type-checker will accept the inferred type for each hole, generating
warnings instead of errors. Additionally, these warnings can be silenced
-with the ``-fno-warn-partial-type-signatures`` flag.
+with the ``-Wno-partial-type-signatures`` flag.
.. _pts-syntax:
@@ -9563,7 +9563,7 @@ Enabling deferring of type errors
The flag ``-fdefer-type-errors`` controls whether type errors are
deferred to runtime. Type errors will still be emitted as warnings, but
will not prevent compilation. You can use
-``-fno-warn-deferred-type-errors`` to suppress these warnings.
+``-Wno-deferred-type-errors`` to suppress these warnings.
This flag implies the ``-fdefer-typed-holes`` flag, which enables this
behaviour for `typed holes <#typed-holes>`__. Should you so wish, it is
@@ -11250,7 +11250,7 @@ library in which one module gathers together and re-exports the exports
of several others.
You can suppress the warnings with the flag
-``-fno-warn-warnings-deprecations``.
+``-Wno-warnings-deprecations``.
.. _minimal-pragma:
@@ -11296,10 +11296,10 @@ If no ``MINIMAL`` pragma is given in the class declaration, it is just as if
a pragma ``{-# MINIMAL op1, op2, ..., opn #-}`` was given, where the
``opi`` are the methods (a) that lack a default method in the class
declaration, and (b) whose name that does not start with an underscore
-(c.f. ``-fwarn-missing-methods``, :ref:`options-sanity`).
+(c.f. ``-Wmissing-methods``, :ref:`options-sanity`).
This warning can be turned off with the flag
-``-fno-warn-missing-methods``.
+``-Wno-missing-methods``.
.. _inline-noinline-pragma:
@@ -12143,7 +12143,7 @@ been a better chance that ``f``\'s RULE might fire.
The way to get predictable behaviour is to use a NOINLINE pragma, or an
INLINE[⟨phase⟩] pragma, on ``f``, to ensure that it is not inlined until
its RULEs have had a chance to fire. The warning flag
-``-fwarn-inline-rule-shadowing`` (see :ref:`options-sanity`) warns about
+``-Winline-rule-shadowing`` (see :ref:`options-sanity`) warns about
this situation.
.. _conlike:
diff --git a/docs/users_guide/runghc.rst b/docs/users_guide/runghc.rst
index 0bf9690f62..d823e356df 100644
--- a/docs/users_guide/runghc.rst
+++ b/docs/users_guide/runghc.rst
@@ -28,7 +28,7 @@ directories in the system search path.
runghc will try to work out where the boundaries between
``[runghc flags]`` and ``[GHC flags]``, and ``[program args]`` and
``module`` are, but you can use a ``--`` flag if it doesn't get it
-right. For example, ``runghc -- -fwarn-unused-bindings Foo`` means
+right. For example, ``runghc -- -Wunused-bindings Foo`` means
runghc won't try to use ``warn-unused-bindings`` as the path to GHC, but
instead will pass the flag to GHC. If a GHC flag doesn't start with a
dash then you need to prefix it with ``--ghc-arg=`` or runghc will think
diff --git a/docs/users_guide/safe_haskell.rst b/docs/users_guide/safe_haskell.rst
index 7d1b844202..b54b1ec2a8 100644
--- a/docs/users_guide/safe_haskell.rst
+++ b/docs/users_guide/safe_haskell.rst
@@ -690,17 +690,17 @@ And one general flag:
And three warning flags:
-``-fwarn-unsafe``
+``-Wunsafe``
Issue a warning if the module being compiled is regarded to be
unsafe. Should be used to check the safety type of modules when
using safe inference.
-``-fwarn-safe``
+``-Wsafe``
Issue a warning if the module being compiled is regarded to be safe.
Should be used to check the safety type of modules when using safe
inference.
-``-fwarn-trustworthy-safe``
+``-Wtrustworthy-safe``
Issue a warning if the module being compiled is marked as
-XTrustworthy but it could instead be marked as
-XSafe , a more informative bound. Can be used to detect once a Safe Haskell
@@ -742,7 +742,7 @@ taken:
There is a more detailed discussion of the issues involved in
compilation safety and some potential solutions on the
:ghc-wiki:`GHC Wiki <SafeHaskell/SafeCompilation>`.
-
+
Additionally, the use of :ref:`annotations <annotation-pragmas>` is forbidden,
as that would allow bypassing Safe Haskell restrictions. See :ghc-ticket:`10826`
for details.
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst
index c8285d5e0d..074aad047f 100644
--- a/docs/users_guide/separate_compilation.rst
+++ b/docs/users_guide/separate_compilation.rst
@@ -1071,9 +1071,9 @@ module:
of the variables, type constructors, or classes that are free in the
left hand side of the rule are declared in ``M``.
-If you use the flag ``-fwarn-orphans``, GHC will warn you if you are
+If you use the flag ``-Worphans``, GHC will warn you if you are
creating an orphan module. Like any warning, you can switch the warning
-off with ``-fno-warn-orphans``, and ``-Werror`` will make the
+off with ``-Wno-orphans``, and ``-Werror`` will make the
compilation fail if the warning is issued.
You can identify an orphan module by looking in its interface file,
diff --git a/docs/users_guide/sooner.rst b/docs/users_guide/sooner.rst
index 8019a43425..87daefdd1e 100644
--- a/docs/users_guide/sooner.rst
+++ b/docs/users_guide/sooner.rst
@@ -130,7 +130,7 @@ Overloaded functions are not your friend:
Give explicit type signatures:
Signatures are the basic trick; putting them on exported, top-level
functions is good software-engineering practice, anyway. (Tip: using
- ``-fwarn-missing-signatures``-fwarn-missing-signatures option can
+ ``-Wmissing-signatures``-Wmissing-signatures option can
help enforce good signature-practice).
The automatic specialisation of overloaded functions (with ``-O``)
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 699c8fd2a4..9748e47fe5 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -11,25 +11,25 @@ GHC has a number of options that select which types of non-fatal error
messages, otherwise known as warnings, can be generated during
compilation. By default, you get a standard set of warnings which are
generally likely to indicate bugs in your program. These are:
-``-fwarn-overlapping-patterns``, ``-fwarn-warnings-deprecations``,
-``-fwarn-deprecated-flags``, ``-fwarn-unrecognised-pragmas``,
-``-fwarn-missed-specialisations``, ``-fwarn-duplicate-constraints``,
-``-fwarn-duplicate-exports``, ``-fwarn-overflowed-literals``,
-``-fwarn-empty-enumerations``, ``-fwarn-missing-fields``,
-``-fwarn-missing-methods``, ``-fwarn-wrong-do-bind``,
-``-fwarn-unsupported-calling-conventions``,
-``-fwarn-dodgy-foreign-imports``, ``-fwarn-inline-rule-shadowing``,
-``-fwarn-unsupported-llvm-version`` and ``-fwarn-tabs``. The following flags are
+``-Woverlapping-patterns``, ``-Wwarnings-deprecations``,
+``-Wdeprecated-flags``, ``-Wunrecognised-pragmas``,
+``-Wmissed-specialisations``, ``-Wduplicate-constraints``,
+``-Wduplicate-exports``, ``-Woverflowed-literals``,
+``-Wempty-enumerations``, ``-Wmissing-fields``,
+``-Wmissing-methods``, ``-Wwrong-do-bind``,
+``-Wunsupported-calling-conventions``,
+``-Wdodgy-foreign-imports``, ``-Winline-rule-shadowing``,
+``-Wunsupported-llvm-version`` and ``-Wtabs``. The following flags are
simple ways to select standard “packages” of warnings:
``-W``
.. index::
single: -W option
- Provides the standard warnings plus ``-fwarn-unused-binds``,
- ``-fwarn-unused-matches``, ``-fwarn-unused-imports``,
- ``-fwarn-incomplete-patterns``, ``-fwarn-dodgy-exports``, and
- ``-fwarn-dodgy-imports``.
+ Provides the standard warnings plus ``-Wunused-binds``,
+ ``-Wunused-matches``, ``-Wunused-imports``,
+ ``-Wincomplete-patterns``, ``-Wdodgy-exports``, and
+ ``-Wdodgy-imports``.
``-Wall``
.. index::
@@ -37,12 +37,12 @@ simple ways to select standard “packages” of warnings:
Turns on all warning options that indicate potentially suspicious
code. The warnings that are *not* enabled by ``-Wall`` are
- ``-fwarn-incomplete-uni-patterns``,
- ``-fwarn-incomplete-record-updates``,
- ``-fwarn-monomorphism-restriction``,
- ``-fwarn-implicit-prelude``, ``-fwarn-missing-local-sigs``,
- ``-fwarn-missing-exported-sigs``, ``-fwarn-missing-import-lists``
- and ``-fwarn-identities``.
+ ``-Wincomplete-uni-patterns``,
+ ``-Wincomplete-record-updates``,
+ ``-Wmonomorphism-restriction``,
+ ``-Wimplicit-prelude``, ``-Wmissing-local-sigs``,
+ ``-Wmissing-exported-sigs``, ``-Wmissing-import-lists``
+ and ``-Widentities``.
``-Wcompat``
.. index::
@@ -53,8 +53,8 @@ simple ways to select standard “packages” of warnings:
eager to make their code future compatible to adapt to new features before
they even generate warnings.
- This currently enables ``-fwarn-missing-monadfail-instance``,
- ``-fwarn-semigroup``, and ``-fwarn-noncanonical-monoid-instances``.
+ This currently enables ``-Wmissing-monadfail-instance``,
+ ``-Wsemigroup``, and ``-Wnoncanonical-monoid-instances``.
``-Wno-compat``
.. index::
@@ -84,12 +84,14 @@ simple ways to select standard “packages” of warnings:
default, but can be useful to negate a ``-Werror`` flag.
The full set of warning options is described below. To turn off any
-warning, simply give the corresponding ``-fno-warn-...`` option on the
-command line.
+warning, simply give the corresponding ``-Wno-...`` option on the
+command line. For backwards compatibility with GHC versions prior to 8.0,
+all these warnings can still be controlled with ``-f(no-)warn-*`` instead
+of ``-W(no-)*``.
-``-fwarn-typed-holes``
+``-Wtyped-holes``
.. index::
- single: -fwarn-typed-holes
+ single: -Wtyped-holes
single: warnings
Determines whether the compiler reports typed holes warnings. Has no
@@ -98,9 +100,9 @@ command line.
This warning is on by default.
-``-fwarn-type-errors``
+``-Wtype-errors``
.. index::
- single: -fwarn-type-errors
+ single: -Wtype-errors
single: warnings
Causes a warning to be reported when a type error is deferred until
@@ -130,11 +132,11 @@ command line.
``-fdefer-type-errors`` (which implies this option). See :ref:`typed-holes`
and :ref:`defer-type-errors`.
- Implied by ``-fdefer-type-errors``. See also ``-fwarn-typed-holes``.
+ Implied by ``-fdefer-type-errors``. See also ``-Wtyped-holes``.
-``-fwarn-partial-type-signatures``
+``-Wpartial-type-signatures``
.. index::
- single: -fwarn-partial-type-signatures
+ single: -Wpartial-type-signatures
single: warnings
Determines whether the compiler reports holes in partial type
@@ -155,9 +157,9 @@ command line.
This option is on by default.
-``-fwarn-unrecognised-pragmas``
+``-Wunrecognised-pragmas``
.. index::
- single: -fwarn-unrecognised-pragmas
+ single: -Wunrecognised-pragmas
single: warnings
single: pragmas
@@ -168,10 +170,10 @@ command line.
This option is on by default.
-``-fwarn-missed-specialisations``, ``-fwarn-all-missed-specialisations``
+``-Wmissed-specialisations``, ``-Wall-missed-specialisations``
.. index::
- single: -fwarn-missed-specialisations
- single: -fwarn-all-missed-specialisations
+ single: -Wmissed-specialisations
+ single: -Wall-missed-specialisations
single: warnings
single: pragmas
@@ -186,9 +188,9 @@ command line.
These options are both off by default.
-``-fwarn-warnings-deprecations``
+``-Wwarnings-deprecations``
.. index::
- single: -fwarn-warnings-deprecations
+ single: -Wwarnings-deprecations
single: warnings
single: deprecations
@@ -198,9 +200,9 @@ command line.
This option is on by default.
-``-fwarn-amp``
+``-Wamp``
.. index::
- single: -fwarn-amp
+ single: -Wamp
single: AMP
single: Applicative-Monad Proposal
@@ -209,9 +211,9 @@ command line.
Caused a warning to be emitted when a definition was in conflict with
the AMP (Applicative-Monad proosal).
-``-fwarn-noncanonical-monad-instances``
+``-Wnoncanonical-monad-instances``
.. index::
- single: -fwarn-noncanonical-monad-instances
+ single: -Wnoncanonical-monad-instances
Warn if noncanonical ``Applicative`` or ``Monad`` instances
declarations are detected.
@@ -231,9 +233,9 @@ command line.
This option is off by default.
-``-fwarn-noncanonical-monoid-instances``
+``-Wnoncanonical-monoid-instances``
.. index::
- single: -fwarn-noncanonical-monoid-instances
+ single: -Wnoncanonical-monoid-instances
Warn if noncanonical ``Semigroup`` or ``Monoid`` instances
declarations are detected.
@@ -253,9 +255,9 @@ command line.
This warning is off by default. However, it is part of the
``-Wcompat`` option group.
-``-fwarn-missing-monadfail-instance``
+``-Wmissing-monadfail-instance``
.. index::
- single: -fwarn-missing-monadfail-instance
+ single: -Wmissing-monadfail-instance
single: MFP
single: MonadFail Proposal
@@ -267,9 +269,9 @@ command line.
the `MonadFail Proposal (MFP)
<https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__.
-``-fwarn-semigroup``
+``-Wsemigroup``
.. index::
- single: -fwarn-semigroup
+ single: -Wsemigroup
single: semigroup
Warn when definitions are in conflict with the future inclusion of
@@ -282,9 +284,9 @@ command line.
Being part of the ``-Wcompat`` option group, this warning is off by
default, but will be switched on in a future GHC release.
-``-fwarn-deprecated-flags``
+``-Wdeprecated-flags``
.. index::
- single: -fwarn-deprecated-flags
+ single: -Wdeprecated-flags
single: deprecated-flags
Causes a warning to be emitted when a deprecated command-line flag
@@ -292,18 +294,18 @@ command line.
This option is on by default.
-``-fwarn-unsupported-calling-conventions``
+``-Wunsupported-calling-conventions``
.. index::
- single: -fwarn-unsupported-calling-conventions
+ single: -Wunsupported-calling-conventions
Causes a warning to be emitted for foreign declarations that use
unsupported calling conventions. In particular, if the ``stdcall``
calling convention is used on an architecture other than i386 then
it will be treated as ``ccall``.
-``-fwarn-dodgy-foreign-imports``
+``-Wdodgy-foreign-imports``
.. index::
- single: -fwarn-dodgy-foreign-imports
+ single: -Wdodgy-foreign-imports
Causes a warning to be emitted for foreign imports of the following
form:
@@ -325,9 +327,9 @@ command line.
that is hard to debug because it results in a crash, hence this
warning.
-``-fwarn-dodgy-exports``
+``-Wdodgy-exports``
.. index::
- single: -fwarn-dodgy-exports
+ single: -Wdodgy-exports
Causes a warning to be emitted when a datatype ``T`` is exported
with all constructors, i.e. ``T(..)``, but is it just a type
@@ -336,9 +338,9 @@ command line.
Also causes a warning to be emitted when a module is re-exported,
but that module exports nothing.
-``-fwarn-dodgy-imports``
+``-Wdodgy-imports``
.. index::
- single: -fwarn-dodgy-imports
+ single: -Wdodgy-imports
Causes a warning to be emitted in the following cases:
@@ -348,29 +350,29 @@ command line.
- When an ``import`` statement hides an entity that is not
exported.
-``-fwarn-overflowed-literals``
+``-Woverflowed-literals``
.. index::
- single: -fwarn-overflowed-literals
+ single: -Woverflowed-literals
Causes a warning to be emitted if a literal will overflow, e.g.
``300 :: Word8``.
-``-fwarn-empty-enumerations``
+``-Wempty-enumerations``
.. index::
- single: -fwarn-empty-enumerations
+ single: -Wempty-enumerations
Causes a warning to be emitted if an enumeration is empty, e.g.
``[5 .. 3]``.
-``-fwarn-lazy-unlifted-bindings``
+``-Wlazy-unlifted-bindings``
.. index::
- single: -fwarn-lazy-unlifted-bindings
+ single: -Wlazy-unlifted-bindings
This flag is a no-op, and will be removed in GHC 7.10.
-``-fwarn-duplicate-constraints``
+``-Wduplicate-constraints``
.. index::
- single: -fwarn-duplicate-constraints
+ single: -Wduplicate-constraints
single: duplicate constraints, warning
Have the compiler warn about duplicate constraints in a type
@@ -383,11 +385,11 @@ command line.
The warning will indicate the duplicated ``Eq a`` constraint.
This option is now deprecated in favour of
- ``-fwarn-redundant-constraints``.
+ ``-Wredundant-constraints``.
-``-fwarn-redundant-constraints``
+``-Wredundant-constraints``
.. index::
- single: -fwarn-redundant-constraints
+ single: -Wredundant-constraints
single: redundant constraints, warning
Have the compiler warn about redundant constraints in a type
@@ -417,7 +419,7 @@ command line.
declaration.
This option is on by default. As usual you can suppress it on a
- per-module basis with ``-fno-warn-redundant-constraints``.
+ per-module basis with ``-Wno-redundant-constraints``.
Occasionally you may specifically want a function to have a more
constrained signature than necessary, perhaps to leave yourself
wiggle-room for changing the implementation without changing the
@@ -434,9 +436,9 @@ command line.
Here the call to ``(==)`` makes GHC think that the ``(Eq a)``
constraint is needed, so no warning is issued.
-``-fwarn-duplicate-exports``
+``-Wduplicate-exports``
.. index::
- single: -fwarn-duplicate-exports
+ single: -Wduplicate-exports
single: duplicate exports, warning
single: export lists, duplicates
@@ -447,27 +449,27 @@ command line.
This option is on by default.
-``-fwarn-hi-shadowing``
+``-Whi-shadowing``
.. index::
- single: -fwarn-hi-shadowing
+ single: -Whi-shadowing
single: shadowing; interface files
Causes the compiler to emit a warning when a module or interface
file in the current directory is shadowing one with the same module
name in a library or other directory.
-``-fwarn-identities``
+``-Widentities``
.. index::
- single: -fwarn-identities
+ single: -Widentities
Causes the compiler to emit a warning when a Prelude numeric
conversion converts a type T to the same type T; such calls are
probably no-ops and can be omitted. The functions checked for are:
``toInteger``, ``toRational``, ``fromIntegral``, and ``realToFrac``.
-``-fwarn-implicit-prelude``
+``-Wimplicit-prelude``
.. index::
- single: -fwarn-implicit-prelude
+ single: -Wimplicit-prelude
single: implicit prelude, warning
Have the compiler warn if the Prelude is implicitly imported. This
@@ -485,17 +487,17 @@ command line.
This warning is off by default.
-``-fwarn-incomplete-patterns``, ``-fwarn-incomplete-uni-patterns``
+``-Wincomplete-patterns``, ``-Wincomplete-uni-patterns``
.. index::
- single: -fwarn-incomplete-patterns
- single: -fwarn-incomplete-uni-patterns
+ single: -Wincomplete-patterns
+ single: -Wincomplete-uni-patterns
single: incomplete patterns, warning
single: patterns, incomplete
- The option ``-fwarn-incomplete-patterns`` warns about places where a
+ The option ``-Wincomplete-patterns`` warns about places where a
pattern-match might fail at runtime. The function ``g`` below will
fail when applied to non-empty lists, so the compiler will emit a
- warning about this when ``-fwarn-incomplete-patterns`` is enabled.
+ warning about this when ``-Wincomplete-patterns`` is enabled.
::
@@ -506,7 +508,7 @@ command line.
generally considered good practice to cover all the cases in your
functions, and it is switched on by ``-W``.
- The flag ``-fwarn-incomplete-uni-patterns`` is similar, except that
+ The flag ``-Wincomplete-uni-patterns`` is similar, except that
it applies only to lambda-expressions and pattern bindings,
constructs that only allow a single pattern:
@@ -515,15 +517,15 @@ command line.
h = \[] -> 2
Just k = f y
-``-fwarn-incomplete-record-updates``
+``-Wincomplete-record-updates``
.. index::
- single: -fwarn-incomplete-record-updates
+ single: -Wincomplete-record-updates
single: incomplete record updates, warning
single: record updates, incomplete
The function ``f`` below will fail when applied to ``Bar``, so the
compiler will emit a warning about this when
- ``-fwarn-incomplete-record-updates`` is enabled.
+ ``-Wincomplete-record-updates`` is enabled.
::
@@ -536,9 +538,9 @@ command line.
This option isn't enabled by default because it can be very noisy,
and it often doesn't indicate a bug in the program.
-``-fwarn-missing-fields``
+``-Wmissing-fields``
.. index::
- single: -fwarn-missing-fields
+ single: -Wmissing-fields
single: missing fields, warning
single: fields, missing
@@ -548,9 +550,9 @@ command line.
fields are initialised with bottoms), it is often an indication of a
programmer error.
-``-fwarn-missing-import-lists``
+``-Wmissing-import-lists``
.. index::
- single: -fwarn-import-lists
+ single: -Wimport-lists
single: missing import lists, warning
single: import lists, missing
@@ -566,15 +568,15 @@ command line.
import qualified Z
p x = f x x
- The ``-fwarn-import-lists`` flag will warn about the import of ``Y``
+ The ``-Wimport-lists`` flag will warn about the import of ``Y``
but not ``X`` If module ``Y`` is later changed to export (say)
``f``, then the reference to ``f`` in ``M`` will become ambiguous.
No warning is produced for the import of ``Z`` because extending
``Z``\'s exports would be unlikely to produce ambiguity in ``M``.
-``-fwarn-missing-methods``
+``-Wmissing-methods``
.. index::
- single: -fwarn-missing-methods
+ single: -Wmissing-methods
single: missing methods, warning
single: methods, missing
@@ -600,51 +602,51 @@ command line.
methods will be required for instances of a particular class. See
:ref:`minimal-pragma`.
-``-fwarn-missing-signatures``
+``-Wmissing-signatures``
.. index::
- single: -fwarn-missing-signatures
+ single: -Wmissing-signatures
single: type signatures, missing
If you would like GHC to check that every top-level function/value
- has a type signature, use the ``-fwarn-missing-signatures`` option.
+ has a type signature, use the ``-Wmissing-signatures`` option.
As part of the warning GHC also reports the inferred type. The
option is off by default.
-``-fwarn-missing-exported-sigs``
+``-Wmissing-exported-sigs``
.. index::
- single: -fwarn-missing-exported-sigs
+ single: -Wmissing-exported-sigs
single: type signatures, missing
If you would like GHC to check that every exported top-level
function/value has a type signature, but not check unexported
- values, use the ``-fwarn-missing-exported-sigs`` option. This option
- takes precedence over ``-fwarn-missing-signatures``. As part of the
+ values, use the ``-Wmissing-exported-sigs`` option. This option
+ takes precedence over ``-Wmissing-signatures``. As part of the
warning GHC also reports the inferred type. The option is off by
default.
-``-fwarn-missing-local-sigs``
+``-Wmissing-local-sigs``
.. index::
- single: -fwarn-missing-local-sigs
+ single: -Wmissing-local-sigs
single: type signatures, missing
- If you use the ``-fwarn-missing-local-sigs`` flag GHC will warn you
+ If you use the ``-Wmissing-local-sigs`` flag GHC will warn you
about any polymorphic local bindings. As part of the warning GHC
also reports the inferred type. The option is off by default.
-``-fwarn-missing-pat-syn-sigs``
+``-Wmissing-pat-syn-sigs``
.. index ::
- single: -fwarn-missing-pat-syn-sigs
+ single: -Wmissing-pat-syn-sigs
single: type signatures, missing, pattern synonyms
If you would like GHC to check that every pattern synonym has a type
- signature, use the ``-fwarn-missing-pat-syn-sigs`` option. If this option is
- used in conjunction with ``-fwarn-missing-exported-sigs`` then only
+ signature, use the ``-Wmissing-pat-syn-sigs`` option. If this option is
+ used in conjunction with ``-Wmissing-exported-sigs`` then only
exported pattern synonyms must have a type signature. GHC also reports the
inferred type. This option is off by default.
-``-fwarn-name-shadowing``
+``-Wname-shadowing``
.. index::
- single: -fwarn-name-shadowing
+ single: -Wname-shadowing
single: shadowing, warning
This option causes a warning to be emitted whenever an inner-scope
@@ -661,9 +663,9 @@ command line.
f x = do { _ignore <- this; _ignore <- that; return (the other) }
-``-fwarn-orphans``
+``-Worphans``
.. index::
- single: -fwarn-orphans
+ single: -Worphans
single: orphan instances, warning
single: orphan rules, warning
@@ -680,12 +682,12 @@ command line.
or rules play a role, whether or not the module's interface would
otherwise be of any use. See :ref:`orphan-modules` for details.
- The flag ``-fwarn-orphans`` warns about user-written orphan rules or
+ The flag ``-Worphans`` warns about user-written orphan rules or
instances.
-``-fwarn-overlapping-patterns``
+``-Woverlapping-patterns``
.. index::
- single: -fwarn-overlapping-patterns
+ single: -Woverlapping-patterns
single: overlapping patterns, warning
single: patterns, overlapping
@@ -703,16 +705,16 @@ command line.
second pattern overlaps it. More often than not, redundant patterns
is a programmer mistake/error, so this option is enabled by default.
-``-fwarn-tabs``
+``-Wtabs``
.. index::
- single: -fwarn-tabs
+ single: -Wtabs
single: tabs, warning
Have the compiler warn if there are tabs in your source file.
-``-fwarn-type-defaults``
+``-Wtype-defaults``
.. index::
- single: -fwarn-type-defaults
+ single: -Wtype-defaults
single: defaulting mechanism, warning
Have the compiler warn/inform you where in your source the Haskell
@@ -726,9 +728,9 @@ command line.
This warning is off by default.
-``-fwarn-monomorphism-restriction``
+``-Wmonomorphism-restriction``
.. index::
- single: -fwarn-monomorphism-restriction
+ single: -Wmonomorphism-restriction
single: monomorphism restriction, warning
Have the compiler warn/inform you where in your source the Haskell
@@ -738,9 +740,9 @@ command line.
This warning is off by default.
-``-fwarn-unticked-promoted-constructors``
+``-Wunticked-promoted-constructors``
.. index::
- single: -fwarn-unticked-promoted-constructors
+ single: -Wunticked-promoted-constructors
single: promoted constructor, warning
Warn if a promoted data constructor is used without a tick preceding
@@ -761,22 +763,22 @@ command line.
This warning is is enabled by default in ``-Wall`` mode.
-``-fwarn-unused-binds``
+``-Wunused-binds``
.. index::
- single: -fwarn-unused-binds
+ single: -Wunused-binds
single: unused binds, warning
single: binds, unused
Report any function definitions (and local bindings) which are
unused. An alias for
- - ``-fwarn-unused-top-binds``
- - ``-fwarn-unused-local-binds``
- - ``-fwarn-unused-pattern-binds``
+ - ``-Wunused-top-binds``
+ - ``-Wunused-local-binds``
+ - ``-Wunused-pattern-binds``
-``-fwarn-unused-top-binds``
+``-Wunused-top-binds``
.. index::
- single: -fwarn-unused-top-binds
+ single: -Wunused-top-binds
single: unused binds, warning
single: binds, unused
@@ -806,9 +808,9 @@ command line.
-- right-hand side of another unused binding
_w = True -- No warning: _w starts with an underscore
-``-fwarn-unused-local-binds``
+``-Wunused-local-binds``
.. index::
- single: -fwarn-unused-local-binds
+ single: -Wunused-local-binds
single: unused binds, warning
single: binds, unused
@@ -820,9 +822,9 @@ command line.
f = let (p,q) = rhs1 in t p -- Warning: q is unused
g = h x -- No warning: g is unused, but is a top-level binding
-``-fwarn-unused-pattern-binds``
+``-Wunused-pattern-binds``
.. index::
- single: -fwarn-unused-pattern-binds
+ single: -Wunused-pattern-binds
single: unused binds, warning
single: binds, unused
@@ -842,9 +844,9 @@ command line.
lone banged wild-card pattern is useful as an alternative (to
``seq``) way to force evaluation.
-``-fwarn-unused-imports``
+``-Wunused-imports``
.. index::
- single: -fwarn-unused-imports
+ single: -Wunused-imports
single: unused imports, warning
single: imports, unused
@@ -853,9 +855,9 @@ command line.
import, because it is a useful idiom for importing instance
declarations, which are anonymous in Haskell.
-``-fwarn-unused-matches``
+``-Wunused-matches``
.. index::
- single: -fwarn-unused-matches
+ single: -Wunused-matches
single: unused matches, warning
single: matches, unused
@@ -868,9 +870,9 @@ command line.
f _x = True
-``-fwarn-unused-do-bind``
+``-Wunused-do-bind``
.. index::
- single: -fwarn-unused-do-bind
+ single: -Wunused-do-bind
single: unused do binding, warning
single: do binding, unused
@@ -893,9 +895,9 @@ command line.
do { mapM_ popInt xs ; return 10 }
-``-fwarn-wrong-do-bind``
+``-Wwrong-do-bind``
.. index::
- single: -fwarn-wrong-do-bind
+ single: -Wwrong-do-bind
single: apparently erroneous do binding, warning
single: do binding, apparently erroneous
@@ -920,9 +922,9 @@ command line.
do { popInt 10 ; return 10 }
-``-fwarn-inline-rule-shadowing``
+``-Winline-rule-shadowing``
.. index::
- single: -fwarn-inline-rule-shadowing
+ single: -Winline-rule-shadowing
Warn if a rewrite RULE might fail to fire because the function might
be inlined before the rule has a chance to fire. See
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst
index bf9cbd0e8f..a3379801be 100644
--- a/docs/users_guide/using.rst
+++ b/docs/users_guide/using.rst
@@ -98,14 +98,14 @@ Command line options in source files
Sometimes it is useful to make the connection between a source file and
the command-line options it requires quite tight. For instance, if a
Haskell source file deliberately uses name shadowing, it should be
-compiled with the ``-fno-warn-name-shadowing`` option. Rather than
+compiled with the ``-Wno-name-shadowing`` option. Rather than
maintaining the list of per-file options in a ``Makefile``, it is
possible to do this directly in the source file using the
``OPTIONS_GHC`` :ref:`pragma <options-pragma>`.
::
- {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+ {-# OPTIONS_GHC -Wno-name-shadowing #-}
module X where
...
@@ -678,7 +678,7 @@ See also the ``--help``, ``--version``, ``--numeric-version``, and
users should not need to worry about the subtleties here; ``~`` is
probably what you want. Without ``-fprint-equality-relations``, GHC
prints all of these as ``~``.
-
+
``-fprint-expanded-synonyms``
.. index::
single: -fprint-expanded-synonyms
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 43c789b26e..ef4c673aaa 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2093,18 +2093,18 @@ showDynFlags show_all dflags = do
showLanguages' show_all dflags
putStrLn $ showSDoc dflags $
text "GHCi-specific dynamic flag settings:" $$
- nest 2 (vcat (map (setting gopt) ghciFlags))
+ nest 2 (vcat (map (setting "-f" "-fno-" gopt) ghciFlags))
putStrLn $ showSDoc dflags $
text "other dynamic, non-language, flag settings:" $$
- nest 2 (vcat (map (setting gopt) others))
+ nest 2 (vcat (map (setting "-f" "-fno-" gopt) others))
putStrLn $ showSDoc dflags $
text "warning settings:" $$
- nest 2 (vcat (map (setting wopt) DynFlags.fWarningFlags))
+ nest 2 (vcat (map (setting "-W" "-Wno-" wopt) DynFlags.wWarningFlags))
where
- setting test flag
+ setting prefix noPrefix test flag
| quiet = empty
- | is_on = fstr name
- | otherwise = fnostr name
+ | is_on = text prefix <> text name
+ | otherwise = text noPrefix <> text name
where name = flagSpecName flag
f = flagSpecFlag flag
is_on = test f dflags
@@ -2112,9 +2112,6 @@ showDynFlags show_all dflags = do
default_dflags = defaultDynFlags (settings dflags)
- fstr str = text "-f" <> text str
- fnostr str = text "-fno-" <> text str
-
(ghciFlags,others) = partition (\f -> flagSpecFlag f `elem` flgs)
DynFlags.fFlags
flgs = [ Opt_PrintExplicitForalls
diff --git a/testsuite/tests/ghci/scripts/Makefile b/testsuite/tests/ghci/scripts/Makefile
index 730927b5f2..017555b78b 100644
--- a/testsuite/tests/ghci/scripts/Makefile
+++ b/testsuite/tests/ghci/scripts/Makefile
@@ -9,7 +9,7 @@ ghci024:
@echo "~~~~~~~~~~ Testing :set -a"
printf ":set -a\n" \
| '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci \
- | grep -E "^([^ ]| -fno-print-explicit-foralls| -fno-warn-implicit-prelude)"
+ | grep -E "^([^ ]| -fno-print-explicit-foralls| -Wno-implicit-prelude)"
@echo "~~~~~~~~~~ Testing :show languages"
printf ":show languages\n" \
| '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci
diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout b/testsuite/tests/ghci/scripts/ghci024.stdout
index 1624322d14..9fea9464b0 100644
--- a/testsuite/tests/ghci/scripts/ghci024.stdout
+++ b/testsuite/tests/ghci/scripts/ghci024.stdout
@@ -9,7 +9,7 @@ other dynamic, non-language, flag settings:
-fforce-recomp
-fimplicit-import-qualified
warning settings:
- -fno-warn-tabs
+ -Wno-tabs
~~~~~~~~~~ Testing :set -a
options currently set: none.
base language is: Haskell2010
@@ -18,7 +18,7 @@ GHCi-specific dynamic flag settings:
-fno-print-explicit-foralls
other dynamic, non-language, flag settings:
warning settings:
- -fno-warn-implicit-prelude
+ -Wno-implicit-prelude
~~~~~~~~~~ Testing :show languages
base language is: Haskell2010
with the following modifiers:
diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs
index cef654d6c1..e56e04115c 100644
--- a/utils/mkUserGuidePart/Options/Warnings.hs
+++ b/utils/mkUserGuidePart/Options/Warnings.hs
@@ -40,7 +40,7 @@ warningsOptions =
, flagDescription =
"Turn type errors into warnings, :ref:`deferring the error until "++
"runtime <defer-type-errors>`. Implies ``-fdefer-typed-holes``. "++
- "See also ``-fwarn-deferred-type-errors``"
+ "See also ``-Wdeferred-type-errors``"
, flagType = DynamicFlag
, flagReverse = "-fno-defer-type-errors"
}
@@ -49,7 +49,7 @@ warningsOptions =
"Convert :ref:`typed hole <typed-holes>` errors into warnings, "++
":ref:`deferring the error until runtime <defer-type-errors>`. "++
"Implied by ``-fdefer-type-errors``. "++
- "See also ``-fwarn-typed-holes``."
+ "See also ``-Wtyped-holes``."
, flagType = DynamicFlag
, flagReverse = "-fno-defer-typed-holes"
}
@@ -58,234 +58,234 @@ warningsOptions =
, flagType = DynamicFlag
, flagReverse = "-fno-helpful-errors"
}
- , flag { flagName = "-fwarn-deprecated-flags"
+ , flag { flagName = "-Wdeprecated-flags"
, flagDescription =
"warn about uses of commandline flags that are deprecated"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-deprecated-flags"
+ , flagReverse = "-Wno-deprecated-flags"
}
- , flag { flagName = "-fwarn-duplicate-constraints"
+ , flag { flagName = "-Wduplicate-constraints"
, flagDescription =
"warn when a constraint appears duplicated in a type signature"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-duplicate-constraints"
+ , flagReverse = "-Wno-duplicate-constraints"
}
- , flag { flagName = "-fwarn-duplicate-exports"
+ , flag { flagName = "-Wduplicate-exports"
, flagDescription = "warn when an entity is exported multiple times"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-duplicate-exports"
+ , flagReverse = "-Wno-duplicate-exports"
}
- , flag { flagName = "-fwarn-hi-shadowing"
+ , flag { flagName = "-Whi-shadowing"
, flagDescription =
"warn when a ``.hi`` file in the current directory shadows a library"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-hi-shadowing"
+ , flagReverse = "-Wno-hi-shadowing"
}
- , flag { flagName = "-fwarn-identities"
+ , flag { flagName = "-Widentities"
, flagDescription =
"warn about uses of Prelude numeric conversions that are probably "++
"the identity (and hence could be omitted)"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-identities"
+ , flagReverse = "-Wno-identities"
}
- , flag { flagName = "-fwarn-implicit-prelude"
+ , flag { flagName = "-Wimplicit-prelude"
, flagDescription = "warn when the Prelude is implicitly imported"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-implicit-prelude"
+ , flagReverse = "-Wno-implicit-prelude"
}
- , flag { flagName = "-fwarn-incomplete-patterns"
+ , flag { flagName = "-Wincomplete-patterns"
, flagDescription = "warn when a pattern match could fail"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-incomplete-patterns"
+ , flagReverse = "-Wno-incomplete-patterns"
}
- , flag { flagName = "-fwarn-incomplete-uni-patterns"
+ , flag { flagName = "-Wincomplete-uni-patterns"
, flagDescription =
"warn when a pattern match in a lambda expression or "++
"pattern binding could fail"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-incomplete-uni-patterns"
+ , flagReverse = "-Wno-incomplete-uni-patterns"
}
- , flag { flagName = "-fwarn-incomplete-record-updates"
+ , flag { flagName = "-Wincomplete-record-updates"
, flagDescription = "warn when a record update could fail"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-incomplete-record-updates"
+ , flagReverse = "-Wno-incomplete-record-updates"
}
- , flag { flagName = "-fwarn-lazy-unlifted-bindings"
+ , flag { flagName = "-Wlazy-unlifted-bindings"
, flagDescription =
"*(deprecated)* warn when a pattern binding looks lazy but "++
"must be strict"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-lazy-unlifted-bindings"
+ , flagReverse = "-Wno-lazy-unlifted-bindings"
}
- , flag { flagName = "-fwarn-missing-fields"
+ , flag { flagName = "-Wmissing-fields"
, flagDescription = "warn when fields of a record are uninitialised"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-fields"
+ , flagReverse = "-Wno-missing-fields"
}
- , flag { flagName = "-fwarn-missing-import-lists"
+ , flag { flagName = "-Wmissing-import-lists"
, flagDescription =
"warn when an import declaration does not explicitly list all the"++
"names brought into scope"
, flagType = DynamicFlag
, flagReverse = "-fnowarn-missing-import-lists"
}
- , flag { flagName = "-fwarn-missing-methods"
+ , flag { flagName = "-Wmissing-methods"
, flagDescription = "warn when class methods are undefined"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-methods"
+ , flagReverse = "-Wno-missing-methods"
}
- , flag { flagName = "-fwarn-missing-signatures"
+ , flag { flagName = "-Wmissing-signatures"
, flagDescription = "warn about top-level functions without signatures"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-signatures"
+ , flagReverse = "-Wno-missing-signatures"
}
- , flag { flagName = "-fwarn-missing-exported-sigs"
+ , flag { flagName = "-Wmissing-exported-sigs"
, flagDescription =
"warn about top-level functions without signatures, only if they "++
- "are exported. takes precedence over -fwarn-missing-signatures"
+ "are exported. takes precedence over -Wmissing-signatures"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-exported-sigs"
+ , flagReverse = "-Wno-missing-exported-sigs"
}
- , flag { flagName = "-fwarn-missing-local-sigs"
+ , flag { flagName = "-Wmissing-local-sigs"
, flagDescription =
"warn about polymorphic local bindings without signatures"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-local-sigs"
+ , flagReverse = "-Wno-missing-local-sigs"
}
- , flag { flagName = "-fwarn-missing-monadfail-instance"
+ , flag { flagName = "-Wmissing-monadfail-instance"
, flagDescription =
"warn when a failable pattern is used in a do-block that does " ++
"not have a ``MonadFail`` instance."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missing-monadfail-instance"
+ , flagReverse = "-Wno-missing-monadfail-instance"
}
- , flag { flagName = "-fwarn-semigroup"
+ , flag { flagName = "-Wsemigroup"
, flagDescription =
"warn when a ``Monoid`` is not ``Semigroup``, and on non-" ++
"``Semigroup`` definitions of ``(<>)``?"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-semigroup"
+ , flagReverse = "-Wno-semigroup"
}
- , flag { flagName = "-fwarn-missed-specialisations"
+ , flag { flagName = "-Wmissed-specialisations"
, flagDescription =
"warn when specialisation of an imported, overloaded function fails."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-missed-specialisations"
+ , flagReverse = "-Wno-missed-specialisations"
}
- , flag { flagName = "-fwarn-all-missed-specialisations"
+ , flag { flagName = "-Wall-missed-specialisations"
, flagDescription =
"warn when specialisation of any overloaded function fails."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-all-missed-specialisations"
+ , flagReverse = "-Wno-all-missed-specialisations"
}
- , flag { flagName = "-fwarn-monomorphism-restriction"
+ , flag { flagName = "-Wmonomorphism-restriction"
, flagDescription = "warn when the Monomorphism Restriction is applied"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-monomorphism-restriction"
+ , flagReverse = "-Wno-monomorphism-restriction"
}
- , flag { flagName = "-fwarn-name-shadowing"
+ , flag { flagName = "-Wname-shadowing"
, flagDescription = "warn when names are shadowed"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-name-shadowing"
+ , flagReverse = "-Wno-name-shadowing"
}
- , flag { flagName = "-fwarn-noncanonical-monad-instance"
+ , flag { flagName = "-Wnoncanonical-monad-instance"
, flagDescription =
"warn when ``Applicative`` or ``Monad`` instances have "++
"noncanonical definitions of ``return``, ``pure``, ``(>>)``, "++
"or ``(*>)``. "++
"See flag description in :ref:`options-sanity` for more details."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-noncanonical-monad-instance"
+ , flagReverse = "-Wno-noncanonical-monad-instance"
}
- , flag { flagName = "-fwarn-noncanonical-monoid-instance"
+ , flag { flagName = "-Wnoncanonical-monoid-instance"
, flagDescription =
"warn when ``Semigroup`` or ``Monoid`` instances have "++
"noncanonical definitions of ``(<>)`` or ``mappend``. "++
"See flag description in :ref:`options-sanity` for more details."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-noncanonical-monoid-instance"
+ , flagReverse = "-Wno-noncanonical-monoid-instance"
}
- , flag { flagName = "-fwarn-orphans"
+ , flag { flagName = "-Worphans"
, flagDescription =
"warn when the module contains :ref:`orphan instance declarations "++
"or rewrite rules <orphan-modules>`"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-orphans"
+ , flagReverse = "-Wno-orphans"
}
- , flag { flagName = "-fwarn-overlapping-patterns"
+ , flag { flagName = "-Woverlapping-patterns"
, flagDescription = "warn about overlapping patterns"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-overlapping-patterns"
+ , flagReverse = "-Wno-overlapping-patterns"
}
- , flag { flagName = "-fwarn-tabs"
+ , flag { flagName = "-Wtabs"
, flagDescription = "warn if there are tabs in the source file"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-tabs"
+ , flagReverse = "-Wno-tabs"
}
- , flag { flagName = "-fwarn-type-defaults"
+ , flag { flagName = "-Wtype-defaults"
, flagDescription = "warn when defaulting happens"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-type-defaults"
+ , flagReverse = "-Wno-type-defaults"
}
- , flag { flagName = "-fwarn-unrecognised-pragmas"
+ , flag { flagName = "-Wunrecognised-pragmas"
, flagDescription =
"warn about uses of pragmas that GHC doesn't recognise"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unrecognised-pragmas"
+ , flagReverse = "-Wno-unrecognised-pragmas"
}
- , flag { flagName = "-fwarn-unticked-promoted-constructors"
+ , flag { flagName = "-Wunticked-promoted-constructors"
, flagDescription = "warn if promoted constructors are not ticked"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unticked-promoted-constructors"
+ , flagReverse = "-Wno-unticked-promoted-constructors"
}
- , flag { flagName = "-fwarn-unused-binds"
+ , flag { flagName = "-Wunused-binds"
, flagDescription =
"warn about bindings that are unused. Alias for "++
- "``-fwarn-unused-top-binds``, ``-fwarn-unused-local-binds`` and "++
- "``-fwarn-unused-pattern-binds``"
+ "``-Wunused-top-binds``, ``-Wunused-local-binds`` and "++
+ "``-Wunused-pattern-binds``"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-binds"
+ , flagReverse = "-Wno-unused-binds"
}
- , flag { flagName = "-fwarn-unused-top-binds"
+ , flag { flagName = "-Wunused-top-binds"
, flagDescription = "warn about top-level bindings that are unused"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-top-binds"
+ , flagReverse = "-Wno-unused-top-binds"
}
- , flag { flagName = "-fwarn-unused-local-binds"
+ , flag { flagName = "-Wunused-local-binds"
, flagDescription = "warn about local bindings that are unused"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-local-binds"
+ , flagReverse = "-Wno-unused-local-binds"
}
- , flag { flagName = "-fwarn-unused-pattern-binds"
+ , flag { flagName = "-Wunused-pattern-binds"
, flagDescription = "warn about pattern match bindings that are unused"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-pattern-binds"
+ , flagReverse = "-Wno-unused-pattern-binds"
}
- , flag { flagName = "-fwarn-unused-imports"
+ , flag { flagName = "-Wunused-imports"
, flagDescription = "warn about unnecessary imports"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-imports"
+ , flagReverse = "-Wno-unused-imports"
}
- , flag { flagName = "-fwarn-unused-matches"
+ , flag { flagName = "-Wunused-matches"
, flagDescription = "warn about variables in patterns that aren't used"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-matches"
+ , flagReverse = "-Wno-unused-matches"
}
- , flag { flagName = "-fwarn-unused-do-bind"
+ , flag { flagName = "-Wunused-do-bind"
, flagDescription =
"warn about do bindings that appear to throw away values of types "++
"other than ``()``"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unused-do-bind"
+ , flagReverse = "-Wno-unused-do-bind"
}
- , flag { flagName = "-fwarn-wrong-do-bind"
+ , flag { flagName = "-Wwrong-do-bind"
, flagDescription =
"warn about do bindings that appear to throw away monadic values "++
"that you should have bound instead"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-wrong-do-bind"
+ , flagReverse = "-Wno-wrong-do-bind"
}
- , flag { flagName = "-fwarn-unsafe"
+ , flag { flagName = "-Wunsafe"
, flagDescription =
"warn if the module being compiled is regarded to be unsafe. "++
"Should be used to check the safety status of modules when using "++
@@ -294,9 +294,9 @@ warningsOptions =
"``-XTrustworthy``) and so can be used to have the compiler check "++
"any assumptions made."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-unsafe"
+ , flagReverse = "-Wno-unsafe"
}
- , flag { flagName = "-fwarn-safe"
+ , flag { flagName = "-Wsafe"
, flagDescription =
"warn if the module being compiled is regarded to be safe. Should "++
"be used to check the safety status of modules when using safe "++
@@ -305,63 +305,63 @@ warningsOptions =
"``-XTrustworthy``) and so can be used to have the compiler check "++
"any assumptions made."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-safe"
+ , flagReverse = "-Wno-safe"
}
- , flag { flagName = "-fwarn-trustworthy-safe"
+ , flag { flagName = "-Wtrustworthy-safe"
, flagDescription =
"warn if the module being compiled is marked as ``-XTrustworthy`` "++
"but it could instead be marked as ``-XSafe``, a more informative "++
"bound. Can be used to detect once a Safe Haskell bound can be "++
"improved as dependencies are updated."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-safe"
+ , flagReverse = "-Wno-safe"
}
- , flag { flagName = "-fwarn-warnings-deprecations"
+ , flag { flagName = "-Wwarnings-deprecations"
, flagDescription =
"warn about uses of functions & types that have warnings or "++
"deprecated pragmas"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-warnings-deprecations"
+ , flagReverse = "-Wno-warnings-deprecations"
}
- , flag { flagName = "-fwarn-amp"
+ , flag { flagName = "-Wamp"
, flagDescription =
"*(deprecated)* warn on definitions conflicting with the "++
"Applicative-Monad Proposal (AMP)"
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-amp"
+ , flagReverse = "-Wno-amp"
}
- , flag { flagName = "-fwarn-deferred-type-errors"
+ , flag { flagName = "-Wdeferred-type-errors"
, flagDescription =
"Report warnings when :ref:`deferred type errors "++
"<defer-type-errors>` are enabled. This option is enabled by "++
"default. See ``-fdefer-type-errors``."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-deferred-type-errors"
+ , flagReverse = "-Wno-deferred-type-errors"
}
- , flag { flagName = "-fwarn-typed-holes"
+ , flag { flagName = "-Wtyped-holes"
, flagDescription =
"Report warnings when :ref:`typed hole <typed-holes>` errors are "++
":ref:`deferred until runtime <defer-type-errors>`. See "++
"``-fdefer-typed-holes``."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-typed-holes"
+ , flagReverse = "-Wno-typed-holes"
}
- , flag { flagName = "-fwarn-partial-type-signatures"
+ , flag { flagName = "-Wpartial-type-signatures"
, flagDescription =
"warn about holes in partial type signatures when "++
"``-XPartialTypeSignatures`` is enabled. Not applicable when "++
"``-XPartialTypesignatures`` is not enabled, in which case errors "++
"are generated for such holes. See :ref:`partial-type-signatures`."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-partial-type-signatures"
+ , flagReverse = "-Wno-partial-type-signatures"
}
- , flag { flagName = "-fwarn-deriving-typeable"
+ , flag { flagName = "-Wderiving-typeable"
, flagDescription =
"warn when encountering a request to derive an instance of class "++
"``Typeable``. As of GHC 7.10, such declarations are unnecessary "++
"and are ignored by the compiler because GHC has a custom solver "++
"for discharging this type of constraint."
, flagType = DynamicFlag
- , flagReverse = "-fno-warn-deriving-typeable"
+ , flagReverse = "-Wno-deriving-typeable"
}
]