[project @ 2003-01-09 11:39:20 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / CmdLineOpts.lhs
index 7137d63..2cb7e44 100644 (file)
@@ -20,6 +20,7 @@ module CmdLineOpts (
 
        -- Manipulating DynFlags
        defaultDynFlags,                -- DynFlags
+       defaultHscLang,                 -- HscLang
        dopt,                           -- DynFlag -> DynFlags -> Bool
        dopt_set, dopt_unset,           -- DynFlags -> DynFlag -> DynFlags
        dopt_CoreToDo,                  -- DynFlags -> [CoreToDo]
@@ -76,6 +77,7 @@ module CmdLineOpts (
        opt_LiberateCaseThreshold,
        opt_StgDoLetNoEscapes,
        opt_UnfoldCasms,
+       opt_CprOff,
         opt_UsageSPOn,
        opt_UnboxStrictFields,
        opt_SimplNoPreInlining,
@@ -115,15 +117,15 @@ module CmdLineOpts (
 
 #include "HsVersions.h"
 
-import GlaExts
-import IOExts  ( IORef, readIORef, writeIORef )
 import Constants       -- Default values for some flags
 import Util
-import FastTypes
 import FastString      ( FastString, mkFastString )
 import Config
-
 import Maybes          ( firstJust )
+
+import GLAEXTS
+import DATA_IOREF      ( IORef, readIORef, writeIORef )
+import UNSAFE_IO       ( unsafePerformIO )
 \end{code}
 
 %************************************************************************
@@ -185,7 +187,7 @@ data CoreToDo               -- These are diff core-to-core passes,
   | CoreDoSpecialising
   | CoreDoSpecConstr
   | CoreDoUSPInf
-  | CoreDoCPResult
+  | CoreDoOldStrictness
   | CoreDoGlomBinds
   | CoreCSE
   | CoreDoRuleCheck Int{-CompilerPhase-} String        -- Check for non-application of rules 
@@ -256,6 +258,7 @@ data DynFlag
    | Opt_D_dump_stix
    | Opt_D_dump_simpl_stats
    | Opt_D_dump_tc_trace
+   | Opt_D_dump_splices
    | Opt_D_dump_BCOs
    | Opt_D_dump_vect
    | Opt_D_source_stats
@@ -268,6 +271,7 @@ data DynFlag
    | Opt_DoStgLinting
    | Opt_DoUSPLinting
 
+   | Opt_WarnIsError           -- -Werror; makes warnings fatal
    | Opt_WarnDuplicateExports
    | Opt_WarnHiShadows
    | Opt_WarnIncompletePatterns
@@ -290,7 +294,9 @@ data DynFlag
    | Opt_AllowIncoherentInstances
    | Opt_NoMonomorphismRestriction
    | Opt_GlasgowExts
+   | Opt_FFI
    | Opt_PArr                         -- syntactic support for parallel arrays
+   | Opt_With                         -- deprecated keyword for implicit parms
    | Opt_Generics
    | Opt_NoImplicitPrelude 
 
@@ -335,9 +341,15 @@ data HscLang
   | HscNothing
     deriving (Eq, Show)
 
+defaultHscLang
+  | cGhcWithNativeCodeGen == "YES" && 
+       (prefixMatch "i386" cTARGETPLATFORM ||
+        prefixMatch "sparc" cTARGETPLATFORM)   =  HscAsm
+  | otherwise                                  =  HscC
+
 defaultDynFlags = DynFlags {
   coreToDo = [], stgToDo = [], 
-  hscLang = HscC, 
+  hscLang = defaultHscLang, 
   hscOutName = "", 
   hscStubHOutName = "", hscStubCOutName = "",
   extCoreName = "",
@@ -356,7 +368,9 @@ defaultDynFlags = DynFlags {
   opt_I                 = [],
   opt_i                 = [],
 #endif
-  flags = standardWarnings,
+  flags = [Opt_Generics] ++ standardWarnings,
+       -- Generating the helper-functions for
+       -- generics is now on by default
   }
 
 {- 
@@ -533,7 +547,7 @@ unpacked_opts :: [String]
 unpacked_opts =
   concat $
   map (expandAts) $
-  map _UNPK_ argv  -- NOT ARGV any more: v_Static_hsc_opts
+  map unpackFS argv  -- NOT ARGV any more: v_Static_hsc_opts
   where
    expandAts ('@':fname) = words (unsafePerformIO (readFile fname))
    expandAts l = [l]
@@ -575,6 +589,8 @@ opt_Flatten                 = lookUp  FSLIT("-fflatten")
 opt_NoMethodSharing            = lookUp  FSLIT("-fno-method-sharing")
 opt_DoSemiTagging              = lookUp  FSLIT("-fsemi-tagging")
 opt_FoldrBuildOn               = lookUp  FSLIT("-ffoldr-build-on")
+opt_CprOff                     = lookUp  FSLIT("-fcpr-off")
+       -- Switch off CPR analysis in the new demand analyser
 opt_LiberateCaseThreshold      = lookup_def_int "-fliberate-case-threshold" (10::Int)
 opt_StgDoLetNoEscapes          = lookUp  FSLIT("-flet-no-escape")
 opt_UnfoldCasms                        = lookUp  FSLIT("-funfold-casms-in-hi-file")
@@ -588,7 +604,7 @@ opt_MaxWorkerArgs           = lookup_def_int "-fmax-worker-args" (10::Int)
    The Prelude, for example is compiled with '-inpackage std'
 -}
 opt_InPackage                  = case lookup_str "-inpackage=" of
-                                   Just p  -> _PK_ p
+                                   Just p  -> mkFastString p
                                    Nothing -> FSLIT("Main")    -- The package name if none is specified
 
 opt_EmitCExternDecls           = lookUp  FSLIT("-femit-extern-decls")
@@ -678,7 +694,8 @@ isStaticHscFlag f =
        "static",
        "funregisterised",
        "fext-core",
-       "frule-check"
+       "frule-check",
+       "fcpr-off"
        ]
   || any (flip prefixMatch f) [
        "fcontext-stack",