Implement -fwarn-dodgy-imports
[ghc-hetmet.git] / compiler / main / DynFlags.hs
index cd373f9..28943ab 100644 (file)
@@ -166,8 +166,8 @@ data DynFlag
    | Opt_MonomorphismRestriction
    | Opt_MonoPatBinds
    | Opt_ExtendedDefaultRules          -- Use GHC's extended rules for defaulting
-   | Opt_GlasgowExts
    | Opt_FFI
+   | Opt_UnliftedFFITypes
    | Opt_PArr                          -- Syntactic support for parallel arrays
    | Opt_Arrows                                -- Arrow-notation syntax
    | Opt_TH
@@ -175,6 +175,7 @@ data DynFlag
    | Opt_Generics
    | Opt_ImplicitPrelude 
    | Opt_ScopedTypeVariables
+   | Opt_UnboxedTuples
    | Opt_BangPatterns
    | Opt_TypeFamilies
    | Opt_OverloadedStrings
@@ -183,9 +184,31 @@ data DynFlag
    | Opt_RecordPuns
    | Opt_GADTs
    | Opt_RelaxedPolyRec                        -- -X=RelaxedPolyRec
+   | Opt_StandaloneDeriving
+   | Opt_DeriveDataTypeable
+   | Opt_TypeSynonymInstances
+   | Opt_FlexibleContexts
+   | Opt_FlexibleInstances
+   | Opt_ConstrainedClassMethods
+   | Opt_MultiParamTypeClasses
+   | Opt_FunctionalDependencies
+   | Opt_UnicodeSyntax
+   | Opt_PolymorphicComponents
+   | Opt_ExistentialQuantification
    | Opt_MagicHash
    | Opt_EmptyDataDecls
    | Opt_KindSignatures
+   | Opt_PatternSignatures
+   | Opt_ParallelListComp
+   | Opt_GeneralizedNewtypeDeriving
+   | Opt_RecursiveDo
+   | Opt_PatternGuards
+   | Opt_PartiallyAppliedClosedTypeSynonyms
+   | Opt_Rank2Types
+   | Opt_RankNTypes
+   | Opt_TypeOperators
+
+   | Opt_PrintExplicitForalls
 
    -- optimisation opts
    | Opt_Strictness
@@ -653,6 +676,7 @@ data CoreToDo               -- These are diff core-to-core passes,
   | CoreCSE
   | CoreDoRuleCheck Int{-CompilerPhase-} String        -- Check for non-application of rules 
                                                -- matching this string
+  | CoreDoVectorisation
   | CoreDoNothing               -- Useful when building up 
   | CoreDoPasses [CoreToDo]     -- lists of these things
 
@@ -688,6 +712,7 @@ getCoreToDo dflags
     spec_constr   = dopt Opt_SpecConstr dflags
     liberate_case = dopt Opt_LiberateCase dflags
     rule_check    = ruleCheck dflags
+    vectorisation = dopt Opt_Vectorise dflags
 
     core_todo = 
      if opt_level == 0 then
@@ -715,6 +740,15 @@ getCoreToDo dflags
            MaxSimplifierIterations max_iter
        ],
 
+
+        -- We run vectorisation here for now, but we might also try to run
+        -- it later
+        runWhen vectorisation (CoreDoPasses [
+                  CoreDoVectorisation,
+                  CoreDoSimplify SimplGently
+                                  [NoCaseOfCase,
+                                   MaxSimplifierIterations max_iter]]),
+
        -- Specialisation is best done before full laziness
        -- so that overloaded functions have all their dictionary lambdas manifest
        CoreDoSpecialising,
@@ -1048,6 +1082,7 @@ dynamic_flags = [
 -- these -f<blah> flags can all be reversed with -fno-<blah>
 
 fFlags = [
+  ( "warn-dodgy-imports",              Opt_WarnDodgyImports ),
   ( "warn-duplicate-exports",          Opt_WarnDuplicateExports ),
   ( "warn-hi-shadowing",               Opt_WarnHiShadows ),
   ( "warn-implicit-prelude",            Opt_WarnImplicitPrelude ),
@@ -1067,6 +1102,7 @@ fFlags = [
   ( "warn-deprecations",               Opt_WarnDeprecations ),
   ( "warn-orphans",                    Opt_WarnOrphans ),
   ( "warn-tabs",                       Opt_WarnTabs ),
+  ( "print-explicit-foralls", Opt_PrintExplicitForalls ),
   ( "strictness",                      Opt_Strictness ),
   ( "full-laziness",                   Opt_FullLaziness ),
   ( "liberate-case",                   Opt_LiberateCase ),
@@ -1095,13 +1131,26 @@ fFlags = [
 -- These -X<blah> flags can all be reversed with -Xno-<blah>
 xFlags :: [(String, DynFlag)]
 xFlags = [
+  ( "CPP",                              Opt_Cpp ),
+  ( "PatternGuards",                    Opt_PatternGuards ),
+  ( "UnicodeSyntax",                    Opt_UnicodeSyntax ),
   ( "MagicHash",                        Opt_MagicHash ),
+  ( "PolymorphicComponents",            Opt_PolymorphicComponents ),
+  ( "ExistentialQuantification",        Opt_ExistentialQuantification ),
   ( "KindSignatures",                   Opt_KindSignatures ),
+  ( "PatternSignatures",                Opt_PatternSignatures ),
   ( "EmptyDataDecls",                   Opt_EmptyDataDecls ),
+  ( "ParallelListComp",                 Opt_ParallelListComp ),
   ( "FI",                              Opt_FFI ),  -- support `-ffi'...
   ( "FFI",                             Opt_FFI ),  -- ...and also `-fffi'
   ( "ForeignFunctionInterface",                Opt_FFI ),
+  ( "UnliftedFFITypes",                 Opt_UnliftedFFITypes ),
 
+  ( "PartiallyAppliedClosedTypeSynonyms", Opt_PartiallyAppliedClosedTypeSynonyms ),
+  ( "Rank2Types",                       Opt_Rank2Types ),
+  ( "RankNTypes",                       Opt_RankNTypes ),
+  ( "TypeOperators",                    Opt_TypeOperators ),
+  ( "RecursiveDo",                      Opt_RecursiveDo ),
   ( "Arrows",                          Opt_Arrows ), -- arrow syntax
   ( "Parr",                            Opt_PArr ),
 
@@ -1126,6 +1175,16 @@ xFlags = [
   ( "ExtendedDefaultRules",            Opt_ExtendedDefaultRules ),
   ( "ImplicitParams",                  Opt_ImplicitParams ),
   ( "ScopedTypeVariables",             Opt_ScopedTypeVariables ),
+  ( "UnboxedTuples",                Opt_UnboxedTuples ),
+  ( "StandaloneDeriving",           Opt_StandaloneDeriving ),
+  ( "DeriveDataTypeable",           Opt_DeriveDataTypeable ),
+  ( "TypeSynonymInstances",         Opt_TypeSynonymInstances ),
+  ( "FlexibleContexts",             Opt_FlexibleContexts ),
+  ( "FlexibleInstances",            Opt_FlexibleInstances ),
+  ( "ConstrainedClassMethods",      Opt_ConstrainedClassMethods ),
+  ( "MultiParamTypeClasses",        Opt_MultiParamTypeClasses ),
+  ( "FunctionalDependencies",        Opt_FunctionalDependencies ),
+  ( "GeneralizedNewtypeDeriving",   Opt_GeneralizedNewtypeDeriving ),
   ( "AllowOverlappingInstances",       Opt_AllowOverlappingInstances ),
   ( "AllowUndecidableInstances",       Opt_AllowUndecidableInstances ),
   ( "AllowIncoherentInstances",        Opt_AllowIncoherentInstances )
@@ -1136,14 +1195,36 @@ impliedFlags = [
   ( Opt_GADTs, [Opt_RelaxedPolyRec] )  -- We want type-sig variables to be completely rigid for GADTs
   ]
 
-glasgowExtsFlags = [ Opt_GlasgowExts 
+glasgowExtsFlags = [
+             Opt_PrintExplicitForalls
                   , Opt_FFI 
+           , Opt_UnliftedFFITypes
                   , Opt_GADTs
                   , Opt_ImplicitParams 
                   , Opt_ScopedTypeVariables
+           , Opt_UnboxedTuples
+           , Opt_TypeSynonymInstances
+           , Opt_StandaloneDeriving
+           , Opt_DeriveDataTypeable
+           , Opt_FlexibleContexts
+           , Opt_FlexibleInstances
+           , Opt_ConstrainedClassMethods
+           , Opt_MultiParamTypeClasses
+           , Opt_FunctionalDependencies
                   , Opt_MagicHash
+           , Opt_PolymorphicComponents
+           , Opt_ExistentialQuantification
+           , Opt_UnicodeSyntax
+           , Opt_PatternGuards
+           , Opt_PartiallyAppliedClosedTypeSynonyms
+           , Opt_RankNTypes
+           , Opt_TypeOperators
+           , Opt_RecursiveDo
+           , Opt_ParallelListComp
            , Opt_EmptyDataDecls
            , Opt_KindSignatures
+           , Opt_PatternSignatures
+           , Opt_GeneralizedNewtypeDeriving
                   , Opt_TypeFamilies ]
 
 ------------------