[project @ 2001-02-20 11:04:42 by simonmar]
authorsimonmar <unknown>
Tue, 20 Feb 2001 11:04:42 +0000 (11:04 +0000)
committersimonmar <unknown>
Tue, 20 Feb 2001 11:04:42 +0000 (11:04 +0000)
Make the warning package options (-W, -w, -Wall) dynamic.

ghc/compiler/main/CmdLineOpts.lhs
ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/Main.hs

index 573850b..f3c271a 100644 (file)
@@ -35,6 +35,11 @@ module CmdLineOpts (
        dopt_HscLang,
        dopt_OutName,
 
+       -- sets of warning opts
+       standardWarnings,
+       minusWOpts,
+       minusWallOpts,
+
        -- profiling opts
        opt_AutoSccsOnAllToplevs,
        opt_AutoSccsOnExportedToplevs,
@@ -66,9 +71,7 @@ module CmdLineOpts (
        opt_SimplNoPreInlining,
        opt_SimplDoEtaReduction,
        opt_SimplDoLambdaEtaExpansion,
-       opt_SimplCaseOfCase,
        opt_SimplCaseMerge,
-       opt_SimplPedanticBottoms,
        opt_SimplExcessPrecision,
 
        -- Unfolding control
@@ -279,8 +282,6 @@ data DynFlag
    | Opt_Generics
    | Opt_NoImplicitPrelude 
 
-   -- misc
-   | Opt_ReportCompile
    deriving (Eq)
 
 data DynFlags = DynFlags {
@@ -317,7 +318,7 @@ defaultDynFlags = DynFlags {
   opt_c                        = [],
   opt_a                        = [],
   opt_m                        = [],
-  flags = []
+  flags = standardWarnings,
   }
 
 {- 
@@ -356,6 +357,38 @@ dopt_HscLang = hscLang
 
 %************************************************************************
 %*                                                                     *
+\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}
 %*                                                                     *
 %************************************************************************
@@ -476,9 +509,7 @@ opt_SimplNoPreInlining              = lookUp SLIT("-fno-pre-inlining")
        -- 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
@@ -539,12 +570,9 @@ isStaticHscFlag f =
        "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",
index 3282b50..f9ff637 100644 (file)
@@ -1,7 +1,7 @@
 {-# 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
 --
@@ -258,12 +258,6 @@ static_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) )
@@ -434,6 +428,12 @@ dynamic_flags = [
   ,  ( "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) )
@@ -468,8 +468,7 @@ fFlags = [
   ( "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)
index ab07095..36ac74b 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $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
 --
@@ -119,43 +119,6 @@ GLOBAL_VAR(v_Hi_on_stdout,         False,  Bool)
 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)
@@ -190,7 +153,6 @@ hsc_minusO_flags =
        "-ffoldr-build-on",
         "-fdo-eta-reduction",
        "-fdo-lambda-eta-expansion",
-       "-fcase-of-case",
        "-fcase-merge",
        "-flet-to-case",
        "-flet-no-escape"
index 2fec738..df50f1c 100644 (file)
@@ -1,6 +1,6 @@
 {-# 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
 --
@@ -196,15 +196,6 @@ main =
    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).
 
@@ -237,8 +228,7 @@ main =
                        }
 
        -- 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