FIX #1110: the linker also needs the workaround
[ghc-hetmet.git] / compiler / main / DynFlags.hs
index f10d2f9..1b39d5d 100644 (file)
@@ -17,7 +17,7 @@ module DynFlags (
        -- Dynamic flags
        DynFlag(..),
        DynFlags(..),
-       HscTarget(..), isObjectTarget,
+       HscTarget(..), isObjectTarget, defaultObjectTarget,
        GhcMode(..), isOneShot,
        GhcLink(..), isNoLink,
        PackageFlag(..),
@@ -85,10 +85,6 @@ import Util          ( split )
 import Data.Char       ( isUpper )
 import System.IO        ( hPutStrLn, stderr )
 
-#ifdef GHCI
-import Breakpoints      ( BkptHandler )
-import Module           ( ModuleName )
-#endif
 -- -----------------------------------------------------------------------------
 -- DynFlags
 
@@ -143,6 +139,7 @@ data DynFlag
    | Opt_WarnIsError           -- -Werror; makes warnings fatal
    | Opt_WarnDuplicateExports
    | Opt_WarnHiShadows
+   | Opt_WarnImplicitPrelude
    | Opt_WarnIncompletePatterns
    | Opt_WarnIncompletePatternsRecUpd
    | Opt_WarnMissingFields
@@ -152,6 +149,7 @@ data DynFlag
    | Opt_WarnOverlappingPatterns
    | Opt_WarnSimplePatterns
    | Opt_WarnTypeDefaults
+   | Opt_WarnMonomorphism
    | Opt_WarnUnusedBinds
    | Opt_WarnUnusedImports
    | Opt_WarnUnusedMatches
@@ -177,7 +175,7 @@ data DynFlag
    | Opt_ImplicitPrelude 
    | Opt_ScopedTypeVariables
    | Opt_BangPatterns
-   | Opt_IndexedTypes
+   | Opt_TypeFamilies
    | Opt_OverloadedStrings
 
    -- optimisation opts
@@ -195,6 +193,7 @@ data DynFlag
    | Opt_CaseMerge
    | Opt_UnboxStrictFields
    | Opt_DictsCheap
+   | Opt_RewriteRules
 
    -- misc opts
    | Opt_Cpp
@@ -208,12 +207,10 @@ data DynFlag
    | Opt_SplitObjs
    | Opt_StgStats
    | Opt_HideAllPackages
-#if defined(GHCI) && defined(DEBUGGER)
-   | Opt_Debugging
-#endif
    | Opt_PrintBindResult
    | Opt_Haddock
    | Opt_Hpc_No_Auto
+   | Opt_BreakOnException
 
    -- keeping stuff
    | Opt_KeepHiDiffs
@@ -321,11 +318,6 @@ data DynFlags = DynFlags {
   
   -- message output
   log_action            :: Severity -> SrcSpan -> PprStyle -> Message -> IO ()
-
-#ifdef GHCI
-  -- breakpoint handling
- ,bkptHandler           :: Maybe (BkptHandler Module)
-#endif
  }
 
 data HscTarget
@@ -376,7 +368,11 @@ data PackageFlag
   | IgnorePackage  String
   deriving Eq
 
-defaultHscTarget
+defaultHscTarget = defaultObjectTarget
+
+-- | the 'HscTarget' value corresponding to the default way to create
+-- object files on the current platform.
+defaultObjectTarget
   | cGhcWithNativeCodeGen == "YES"     =  HscAsm
   | otherwise                          =  HscC
 
@@ -446,9 +442,6 @@ defaultDynFlags =
        packageFlags            = [],
         pkgDatabase             = Nothing,
         pkgState                = panic "no package state yet: call GHC.setSessionDynFlags",
-#ifdef GHCI
-        bkptHandler             = Nothing,
-#endif
        flags = [ 
            Opt_ReadUserPackageConf,
     
@@ -574,12 +567,16 @@ optLevelFlags :: [([Int], DynFlag)]
 optLevelFlags
   = [ ([0],    Opt_IgnoreInterfacePragmas)
     , ([0],     Opt_OmitInterfacePragmas)
+
     , ([1,2],  Opt_IgnoreAsserts)
+    , ([1,2],  Opt_RewriteRules)       -- Off for -O0; see Note [Scoping for Builtin rules]
+                                       --              in PrelRules
     , ([1,2],  Opt_DoEtaReduction)
     , ([1,2],  Opt_CaseMerge)
     , ([1,2],  Opt_Strictness)
     , ([1,2],  Opt_CSE)
     , ([1,2],  Opt_FullLaziness)
+
     , ([2],    Opt_LiberateCase)
     , ([2],    Opt_SpecConstr)
 
@@ -1029,6 +1026,7 @@ dynamic_flags = [
 fFlags = [
   ( "warn-duplicate-exports",          Opt_WarnDuplicateExports ),
   ( "warn-hi-shadowing",               Opt_WarnHiShadows ),
+  ( "warn-implicit-prelude",            Opt_WarnImplicitPrelude ),
   ( "warn-incomplete-patterns",        Opt_WarnIncompletePatterns ),
   ( "warn-incomplete-record-updates",          Opt_WarnIncompletePatternsRecUpd ),
   ( "warn-missing-fields",             Opt_WarnMissingFields ),
@@ -1038,6 +1036,7 @@ fFlags = [
   ( "warn-overlapping-patterns",       Opt_WarnOverlappingPatterns ),
   ( "warn-simple-patterns",            Opt_WarnSimplePatterns ),
   ( "warn-type-defaults",              Opt_WarnTypeDefaults ),
+  ( "warn-monomorphism-restriction",           Opt_WarnMonomorphism ),
   ( "warn-unused-binds",               Opt_WarnUnusedBinds ),
   ( "warn-unused-imports",             Opt_WarnUnusedImports ),
   ( "warn-unused-matches",             Opt_WarnUnusedMatches ),
@@ -1053,7 +1052,7 @@ fFlags = [
   ( "scoped-type-variables",           Opt_ScopedTypeVariables ),
   ( "bang-patterns",                   Opt_BangPatterns ),
   ( "overloaded-strings",              Opt_OverloadedStrings ),
-  ( "indexed-types",                   Opt_IndexedTypes ),
+  ( "type-families",                   Opt_TypeFamilies ),
   ( "monomorphism-restriction",                Opt_MonomorphismRestriction ),
   ( "mono-pat-binds",                  Opt_MonoPatBinds ),
   ( "extended-default-rules",          Opt_ExtendedDefaultRules ),
@@ -1079,11 +1078,10 @@ fFlags = [
   ( "excess-precision",                        Opt_ExcessPrecision ),
   ( "asm-mangling",                    Opt_DoAsmMangling ),
   ( "print-bind-result",               Opt_PrintBindResult ),
-#if defined(GHCI) && defined(DEBUGGER)
-  ( "debugging",                        Opt_Debugging),
-#endif
   ( "force-recomp",                    Opt_ForceRecomp ),
-  ( "hpc-no-auto",                     Opt_Hpc_No_Auto )
+  ( "hpc-no-auto",                     Opt_Hpc_No_Auto ),
+  ( "rewrite-rules",                   Opt_RewriteRules ),
+  ( "break-on-exception",               Opt_BreakOnException )
   ]
 
 
@@ -1092,7 +1090,7 @@ glasgowExtsFlags = [
   Opt_FFI, 
   Opt_ImplicitParams, 
   Opt_ScopedTypeVariables,
-  Opt_IndexedTypes ]
+  Opt_TypeFamilies ]
 
 isFFlag f = f `elem` (map fst fFlags)
 getFFlag f = fromJust (lookup f fFlags)