Making -fhpc work with a stage1 build, via the compat 'package'.
[ghc-hetmet.git] / compiler / main / DynFlags.hs
index 605474f..7b06a48 100644 (file)
@@ -177,6 +177,9 @@ data DynFlag
    | Opt_BangPatterns
    | Opt_TypeFamilies
    | Opt_OverloadedStrings
+   | Opt_DisambiguateRecordFields
+   | Opt_RecordDotDot
+   | Opt_RecordPuns
    | Opt_GADTs
    | Opt_RelaxedPolyRec                        -- -X=RelaxedPolyRec
 
@@ -558,13 +561,14 @@ data Option
 updOptLevel :: Int -> DynFlags -> DynFlags
 -- Set dynflags appropriate to the optimisation level
 updOptLevel n dfs
-  = dfs2{ optLevel = n }
+  = dfs2{ optLevel = final_n }
   where
+   final_n = max 0 (min 2 n)   -- Clamp to 0 <= n <= 2
    dfs1 = foldr (flip dopt_unset) dfs  remove_dopts
    dfs2 = foldr (flip dopt_set)   dfs1 extra_dopts
 
-   extra_dopts  = [ f | (ns,f) <- optLevelFlags, n `elem` ns ]
-   remove_dopts = [ f | (ns,f) <- optLevelFlags, n `notElem` ns ]
+   extra_dopts  = [ f | (ns,f) <- optLevelFlags, final_n `elem` ns ]
+   remove_dopts = [ f | (ns,f) <- optLevelFlags, final_n `notElem` ns ]
        
 optLevelFlags :: [([Int], DynFlag)]
 optLevelFlags
@@ -1026,6 +1030,7 @@ dynamic_flags = [
 
        -- For now, allow -X flags with -f; ToDo: report this as deprecated
   ,  ( "f",            PrefixPred (isFlag xFlags) (\f ->  setDynFlag (getFlag xFlags f)) )
+  ,  ( "f",            PrefixPred (isNoFlag xFlags) (\f -> unSetDynFlag (getNoFlag xFlags f)) )
 
        -- the rest of the -X* and -Xno-* flags
   ,  ( "X",            PrefixPred (isFlag xFlags)   (\f -> setDynFlag   (getFlag xFlags f)) )
@@ -1117,6 +1122,7 @@ impliedFlags = [
 
 glasgowExtsFlags = [ Opt_GlasgowExts 
                   , Opt_FFI 
+                  , Opt_GADTs
                   , Opt_ImplicitParams 
                   , Opt_ScopedTypeVariables
                   , Opt_TypeFamilies ]