Make the warning package options (-W, -w, -Wall) dynamic.
dopt_HscLang,
dopt_OutName,
+ -- sets of warning opts
+ standardWarnings,
+ minusWOpts,
+ minusWallOpts,
+
-- profiling opts
opt_AutoSccsOnAllToplevs,
opt_AutoSccsOnExportedToplevs,
opt_SimplNoPreInlining,
opt_SimplDoEtaReduction,
opt_SimplDoLambdaEtaExpansion,
- opt_SimplCaseOfCase,
opt_SimplCaseMerge,
- opt_SimplPedanticBottoms,
opt_SimplExcessPrecision,
-- Unfolding control
| Opt_Generics
| Opt_NoImplicitPrelude
- -- misc
- | Opt_ReportCompile
deriving (Eq)
data DynFlags = DynFlags {
opt_c = [],
opt_a = [],
opt_m = [],
- flags = []
+ flags = standardWarnings,
}
{-
%************************************************************************
%* *
+\subsection{Warnings}
+%* *
+%************************************************************************
+
+\begin{code}
+standardWarnings
+ = [ Opt_WarnDeprecations,
+ Opt_WarnOverlappingPatterns,
+ Opt_WarnMissingFields,
+ Opt_WarnMissingMethods,
+ Opt_WarnDuplicateExports
+ ]
+
+minusWOpts
+ = standardWarnings ++
+ [ Opt_WarnUnusedBinds,
+ Opt_WarnUnusedMatches,
+ Opt_WarnUnusedImports,
+ Opt_WarnIncompletePatterns
+ ]
+
+minusWallOpts
+ = minusWOpts ++
+ [ Opt_WarnTypeDefaults,
+ Opt_WarnNameShadowing,
+ Opt_WarnMissingSigs,
+ Opt_WarnHiShadows
+ ]
+\end{code}
+
+%************************************************************************
+%* *
\subsection{Classifying command-line options}
%* *
%************************************************************************
-- get if you don't do it!
opt_SimplDoEtaReduction = lookUp SLIT("-fdo-eta-reduction")
opt_SimplDoLambdaEtaExpansion = lookUp SLIT("-fdo-lambda-eta-expansion")
-opt_SimplCaseOfCase = lookUp SLIT("-fcase-of-case")
opt_SimplCaseMerge = lookUp SLIT("-fcase-merge")
-opt_SimplPedanticBottoms = lookUp SLIT("-fpedantic-bottoms")
opt_SimplExcessPrecision = lookUp SLIT("-fexcess-precision")
-- Unfolding control
"fno-pre-inlining",
"fdo-eta-reduction",
"fdo-lambda-eta-expansion",
- "fcase-of-case",
"fcase-merge",
- "fpedantic-bottoms",
"fexcess-precision",
"funfolding-update-in-place",
- "freport-compile",
"fno-prune-decls",
"fno-prune-tydecls",
"static",
{-# OPTIONS -#include "hschooks.h" #-}
-----------------------------------------------------------------------------
--- $Id: DriverFlags.hs,v 1.43 2001/01/30 15:28:25 simonmar Exp $
+-- $Id: DriverFlags.hs,v 1.44 2001/02/20 11:04:42 simonmar Exp $
--
-- Driver flags
--
, ( "optl" , HasArg (add v_Opt_l) )
, ( "optdll" , HasArg (add v_Opt_dll) )
- ------ Warning opts -------------------------------------------------
- , ( "W" , NoArg (writeIORef v_Warning_opt W_) )
- , ( "Wall" , NoArg (writeIORef v_Warning_opt W_all) )
- , ( "Wnot" , NoArg (writeIORef v_Warning_opt W_not) )
- , ( "w" , NoArg (writeIORef v_Warning_opt W_not) )
-
----- Linker --------------------------------------------------------
, ( "static" , NoArg (writeIORef v_Static True) )
, ( "dynamic" , NoArg (writeIORef v_Static False) )
, ( "monly-3-regs", NoArg (updDynFlags (\s -> s{stolen_x86_regs = 3}) ))
, ( "monly-4-regs", NoArg (updDynFlags (\s -> s{stolen_x86_regs = 4}) ))
+ ------ Warning opts -------------------------------------------------
+ , ( "W" , NoArg (mapM_ setDynFlag minusWOpts) )
+ , ( "Wall" , NoArg (mapM_ setDynFlag minusWallOpts) )
+ , ( "Wnot" , NoArg (mapM_ unSetDynFlag minusWallOpts) ) /* DEPREC */
+ , ( "w" , NoArg (mapM_ unSetDynFlag minusWallOpts) )
+
------ Compiler flags -----------------------------------------------
, ( "fasm", AnySuffix (\_ -> setLang HscAsm) )
( "glasgow-exts", Opt_GlasgowExts ),
( "allow-overlapping-instances", Opt_AllowOverlappingInstances ),
( "allow-undecidable-instances", Opt_AllowUndecidableInstances ),
- ( "fgenerics", Opt_Generics ),
- ( "report-compile", Opt_ReportCompile )
+ ( "fgenerics", Opt_Generics )
]
isFFlag f = f `elem` (map fst fFlags)
-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.26 2001/02/01 11:47:53 simonmar Exp $
+-- $Id: DriverState.hs,v 1.27 2001/02/20 11:04:42 simonmar Exp $
--
-- Settings for the driver
--
GLOBAL_VAR(v_Hi_suf, "hi", String)
-----------------------------------------------------------------------------
--- Warnings & sanity checking
-
--- Warning packages that are controlled by -W and -Wall. The 'standard'
--- warnings that you get all the time are
---
--- -fwarn-overlapping-patterns
--- -fwarn-missing-methods
--- -fwarn-missing-fields
--- -fwarn-deprecations
--- -fwarn-duplicate-exports
---
--- these are turned off by -Wnot.
-
-
-standardWarnings = [ "-fwarn-overlapping-patterns"
- , "-fwarn-missing-methods"
- , "-fwarn-missing-fields"
- , "-fwarn-deprecations"
- , "-fwarn-duplicate-exports"
- ]
-minusWOpts = standardWarnings ++
- [ "-fwarn-unused-binds"
- , "-fwarn-unused-matches"
- , "-fwarn-incomplete-patterns"
- , "-fwarn-unused-imports"
- ]
-minusWallOpts = minusWOpts ++
- [ "-fwarn-type-defaults"
- , "-fwarn-name-shadowing"
- , "-fwarn-missing-signatures"
- , "-fwarn-hi-shadowing"
- ]
-
-data WarningState = W_default | W_ | W_all | W_not
-GLOBAL_VAR(v_Warning_opt, W_default, WarningState)
-
------------------------------------------------------------------------------
-- Compiler optimisation options
GLOBAL_VAR(v_OptLevel, 0, Int)
"-ffoldr-build-on",
"-fdo-eta-reduction",
"-fdo-lambda-eta-expansion",
- "-fcase-of-case",
"-fcase-merge",
"-flet-to-case",
"-flet-no-escape"
{-# OPTIONS -fno-warn-incomplete-patterns #-}
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.53 2001/02/14 11:36:07 sewardj Exp $
+-- $Id: Main.hs,v 1.54 2001/02/20 11:04:42 simonmar Exp $
--
-- GHC Driver program
--
static_opts <- buildStaticHscOpts
writeIORef v_Static_hsc_opts static_opts
- -- warnings
- warn_level <- readIORef v_Warning_opt
-
- let warn_opts = case warn_level of
- W_default -> standardWarnings
- W_ -> minusWOpts
- W_all -> minusWallOpts
- W_not -> []
-
-- build the default DynFlags (these may be adjusted on a per
-- module basis by OPTIONS pragmas and settings in the interpreter).
}
-- the rest of the arguments are "dynamic"
- srcs <- processArgs dynamic_flags (way_non_static ++
- non_static ++ warn_opts) []
+ srcs <- processArgs dynamic_flags (way_non_static ++ non_static) []
-- save the "initial DynFlags" away
init_dyn_flags <- readIORef v_DynFlags
writeIORef v_InitDynFlags init_dyn_flags