diff options
author | Ian Lynagh <igloo@earth.li> | 2008-06-16 14:29:17 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-06-16 14:29:17 +0000 |
commit | 0f5e104c36b1dc3d8deeec5fef3d65e7b3a1b5ad (patch) | |
tree | cb2319df6f3669fd22e95029a0de98cd308feec4 | |
parent | 1363f4121ceaa38ac50eac42381b976f89d5ea96 (diff) | |
download | haskell-0f5e104c36b1dc3d8deeec5fef3d65e7b3a1b5ad.tar.gz |
More commandline flag improvements
* Allow -ffoo flags to be deprecated
* Mark some -ffoo flags as deprecated
* Avoid using deprecated flags in error messages, in the build system, etc
* Add a flag to en/disable the deprecated flag warning
34 files changed, 262 insertions, 248 deletions
diff --git a/compat/Makefile b/compat/Makefile index 3804dd4b6b..a95e161c44 100644 --- a/compat/Makefile +++ b/compat/Makefile @@ -96,7 +96,13 @@ SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/ # Make the #includes in the stubs independent of the current location SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries -SRC_HC_OPTS += -fglasgow-exts -fforce-recomp +SRC_HC_OPTS += -fglasgow-exts + +ifeq "$(ghc_ge_609)" "YES" +SRC_HC_OPTS += -fforce-recomp +else +SRC_HC_OPTS += -no-recomp +endif ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" Compat/Directory_HC_OPTS += -\#include shlobj.h diff --git a/compiler/Makefile b/compiler/Makefile index 30ec286013..fdde6f8a4b 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -568,9 +568,13 @@ SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR) # ----------------------------------------------------------------------------- # Haskell compilations -SRC_HC_OPTS += \ - -cpp -fglasgow-exts -fno-generics -Rghc-timing \ - -I. -Iparser -Iutil +SRC_HC_OPTS += -cpp -fglasgow-exts -Rghc-timing -I. -Iparser -Iutil + +ifeq "$(ghc_ge_609)" "NO" +SRC_HC_OPTS += -fno-generics +else +SRC_HC_OPTS += -XNoGenerics +endif # Omitted: -I$(GHC_INCLUDE_DIR) # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS, diff --git a/compiler/Makefile.ghcbin b/compiler/Makefile.ghcbin index cbee57a19d..379a725a28 100644 --- a/compiler/Makefile.ghcbin +++ b/compiler/Makefile.ghcbin @@ -23,7 +23,7 @@ SRC_HC_OPTS += -Wall SRC_HC_OPTS += -package ghc SRC_HC_OPTS += -Istage$(stage) SRC_HC_OPTS += \ - -cpp -fglasgow-exts -fno-generics -Rghc-timing \ + -cpp -fglasgow-exts -XNoGenerics -Rghc-timing \ -I. -IcodeGen -InativeGen -Iparser SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage$(stage)HcOpts) ifeq "$(TargetOS_CPP)" "openbsd" diff --git a/compiler/cmm/ZipDataflow.hs b/compiler/cmm/ZipDataflow.hs index 8365cabcf4..b9d791f5a3 100644 --- a/compiler/cmm/ZipDataflow.hs +++ b/compiler/cmm/ZipDataflow.hs @@ -1,5 +1,5 @@ {-# LANGUAGE MultiParamTypeClasses, ScopedTypeVariables #-} -{-# OPTIONS -fno-allow-overlapping-instances -fglasgow-exts #-} +{-# OPTIONS -fglasgow-exts #-} -- -fglagow-exts for kind signatures module ZipDataflow diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index cacbce2446..2e474bef7b 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -1406,12 +1406,12 @@ setCmd "" vcat (text "other dynamic, non-language, flag settings:" :map (flagSetting dflags) nonLanguageDynFlags) )) - where flagSetting dflags (str,f) + where flagSetting dflags (str, f, _) | dopt f dflags = text " " <> text "-f" <> text str | otherwise = text " " <> text "-fno-" <> text str - (ghciFlags,others) = partition (\(_,f)->f `elem` flags) + (ghciFlags,others) = partition (\(_, f, _) -> f `elem` flags) DynFlags.fFlags - nonLanguageDynFlags = filterOut (\(_,f) -> f `elem` languageOptions) + nonLanguageDynFlags = filterOut (\(_, f, _) -> f `elem` languageOptions) others flags = [Opt_PrintExplicitForalls ,Opt_PrintBindResult @@ -1689,7 +1689,7 @@ completeWord w start end = do (s,r') = span isBreak r in (n,w):words' isBreak (n+length w+length s) r' -- In a Haskell expression we want to parse 'a-b' as three words - -- where a compiler flag (ie. -fno-monomorphism-restriction) should + -- where a compiler flag (e.g. -ddump-simpl) should -- only be a single word. selectWord [] = (0,w) selectWord ((offset,x):xs) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index bc0496951c..ed2fdc0491 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -71,7 +71,7 @@ import Constants ( mAX_CONTEXT_REDUCTION_DEPTH ) import Panic ( panic, GhcException(..) ) import UniqFM ( UniqFM ) import Util -import Maybes ( orElse, fromJust ) +import Maybes ( orElse ) import SrcLoc ( SrcSpan ) import Outputable import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) @@ -169,6 +169,7 @@ data DynFlag | Opt_WarnUnusedImports | Opt_WarnUnusedMatches | Opt_WarnDeprecations + | Opt_WarnDeprecatedFlags | Opt_WarnDodgyImports | Opt_WarnOrphans | Opt_WarnTabs @@ -742,6 +743,7 @@ optLevelFlags standardWarnings :: [DynFlag] standardWarnings = [ Opt_WarnDeprecations, + Opt_WarnDeprecatedFlags, Opt_WarnOverlappingPatterns, Opt_WarnMissingFields, Opt_WarnMissingMethods, @@ -1015,7 +1017,7 @@ allFlags = map ('-':) $ map ("XNo"++) supportedLanguages where ok (PrefixPred _ _) = False ok _ = True - flags = map fst fFlags + flags = [ name | (name, _, _) <- fFlags ] dynamic_flags :: [Flag DynP] dynamic_flags = [ @@ -1336,124 +1338,115 @@ dynamic_flags = [ Supported , Flag "fno-glasgow-exts" (NoArg (mapM_ unSetDynFlag glasgowExtsFlags)) Supported - - -- XXX We need to flatten these: - - -- the rest of the -f* and -fno-* flags - , Flag "f" - (PrefixPred (isFlag fFlags) - (\f -> setDynFlag (getFlag fFlags f))) - Supported - , Flag "f" - (PrefixPred (isPrefFlag "no-" fFlags) - (\f -> unSetDynFlag (getPrefFlag "no-" fFlags f))) - Supported ] - ++ -- -X* - map xFlagToFlag xFlags - ++ -- -XNo* - map xNoFlagToFlag xFlags - -xFlagToFlag :: (String, DynFlag, Deprecated) -> Flag DynP -xFlagToFlag = xMaybeFlagToFlag setDynFlag - -xNoFlagToFlag :: (String, DynFlag, Deprecated) -> Flag DynP -xNoFlagToFlag = xMaybeFlagToFlag unSetDynFlag - -xMaybeFlagToFlag :: (DynFlag -> DynP ()) -> (String, DynFlag, Deprecated) - -> Flag DynP -xMaybeFlagToFlag f (name, dynflag, deprecated) - = Flag ('X' : name) (NoArg (f dynflag)) deprecated + ++ map (mkFlag True "f" setDynFlag ) fFlags + ++ map (mkFlag False "fno-" unSetDynFlag) fFlags + ++ map (mkFlag True "X" setDynFlag ) xFlags + ++ map (mkFlag False "XNo" unSetDynFlag) xFlags + +mkFlag :: Bool -- True => turn it on, False => turn it off + -> String + -> (DynFlag -> DynP ()) + -> (String, DynFlag, Bool -> Deprecated) + -> Flag DynP +mkFlag turnOn flagPrefix f (name, dynflag, deprecated) + = Flag (flagPrefix ++ name) (NoArg (f dynflag)) (deprecated turnOn) + +deprecatedForLanguage :: String -> Bool -> Deprecated +deprecatedForLanguage lang turnOn = + Deprecated ("Use the " ++ prefix ++ lang ++ " language instead") + where prefix = if turnOn then "" else "No" -- these -f<blah> flags can all be reversed with -fno-<blah> -fFlags :: [(String, DynFlag)] +fFlags :: [(String, DynFlag, Bool -> Deprecated)] fFlags = [ - ( "warn-dodgy-imports", Opt_WarnDodgyImports ), - ( "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 ), - ( "warn-missing-methods", Opt_WarnMissingMethods ), - ( "warn-missing-signatures", Opt_WarnMissingSigs ), - ( "warn-name-shadowing", Opt_WarnNameShadowing ), - ( "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 ), - ( "warn-deprecations", Opt_WarnDeprecations ), - ( "warn-orphans", Opt_WarnOrphans ), - ( "warn-tabs", Opt_WarnTabs ), - ( "print-explicit-foralls", Opt_PrintExplicitForalls ), - ( "strictness", Opt_Strictness ), - ( "static-argument-transformation", Opt_StaticArgumentTransformation ), - ( "full-laziness", Opt_FullLaziness ), - ( "liberate-case", Opt_LiberateCase ), - ( "spec-constr", Opt_SpecConstr ), - ( "cse", Opt_CSE ), - ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas ), - ( "omit-interface-pragmas", Opt_OmitInterfacePragmas ), - ( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion ), - ( "ignore-asserts", Opt_IgnoreAsserts ), - ( "do-eta-reduction", Opt_DoEtaReduction ), - ( "case-merge", Opt_CaseMerge ), - ( "unbox-strict-fields", Opt_UnboxStrictFields ), - ( "method-sharing", Opt_MethodSharing ), - ( "dicts-cheap", Opt_DictsCheap ), - ( "excess-precision", Opt_ExcessPrecision ), - ( "asm-mangling", Opt_DoAsmMangling ), - ( "print-bind-result", Opt_PrintBindResult ), - ( "force-recomp", Opt_ForceRecomp ), - ( "hpc-no-auto", Opt_Hpc_No_Auto ), - ( "rewrite-rules", Opt_RewriteRules ), - ( "break-on-exception", Opt_BreakOnException ), - ( "break-on-error", Opt_BreakOnError ), - ( "print-evld-with-show", Opt_PrintEvldWithShow ), - ( "print-bind-contents", Opt_PrintBindContents ), - ( "run-cps", Opt_RunCPSZ ), - ( "convert-to-zipper-and-back", Opt_ConvertToZipCfgAndBack), - ( "vectorise", Opt_Vectorise ), - ( "regs-graph", Opt_RegsGraph), - ( "regs-iterative", Opt_RegsIterative), - -- Deprecated in favour of -XTemplateHaskell: - ( "th", Opt_TemplateHaskell ), - -- Deprecated in favour of -XForeignFunctionInterface: - ( "fi", Opt_ForeignFunctionInterface ), - -- Deprecated in favour of -XForeignFunctionInterface: - ( "ffi", Opt_ForeignFunctionInterface ), - -- Deprecated in favour of -XArrows: - ( "arrows", Opt_Arrows ), - -- Deprecated in favour of -XGenerics: - ( "generics", Opt_Generics ), - -- Deprecated in favour of -XImplicitPrelude: - ( "implicit-prelude", Opt_ImplicitPrelude ), - -- Deprecated in favour of -XBangPatterns: - ( "bang-patterns", Opt_BangPatterns ), - -- Deprecated in favour of -XMonomorphismRestriction: - ( "monomorphism-restriction", Opt_MonomorphismRestriction ), - -- Deprecated in favour of -XMonoPatBinds: - ( "mono-pat-binds", Opt_MonoPatBinds ), - -- Deprecated in favour of -XExtendedDefaultRules: - ( "extended-default-rules", Opt_ExtendedDefaultRules ), - -- Deprecated in favour of -XImplicitParams: - ( "implicit-params", Opt_ImplicitParams ), - -- Deprecated in favour of -XScopedTypeVariables: - ( "scoped-type-variables", Opt_ScopedTypeVariables ), - -- Deprecated in favour of -XPArr: - ( "parr", Opt_PArr ), - -- Deprecated in favour of -XOverlappingInstances: - ( "allow-overlapping-instances", Opt_OverlappingInstances ), - -- Deprecated in favour of -XUndecidableInstances: - ( "allow-undecidable-instances", Opt_UndecidableInstances ), - -- Deprecated in favour of -XIncoherentInstances: - ( "allow-incoherent-instances", Opt_IncoherentInstances ), - ( "gen-manifest", Opt_GenManifest ), - ( "embed-manifest", Opt_EmbedManifest ) + ( "warn-dodgy-imports", Opt_WarnDodgyImports, const Supported ), + ( "warn-duplicate-exports", Opt_WarnDuplicateExports, const Supported ), + ( "warn-hi-shadowing", Opt_WarnHiShadows, const Supported ), + ( "warn-implicit-prelude", Opt_WarnImplicitPrelude, const Supported ), + ( "warn-incomplete-patterns", Opt_WarnIncompletePatterns, const Supported ), + ( "warn-incomplete-record-updates", Opt_WarnIncompletePatternsRecUpd, const Supported ), + ( "warn-missing-fields", Opt_WarnMissingFields, const Supported ), + ( "warn-missing-methods", Opt_WarnMissingMethods, const Supported ), + ( "warn-missing-signatures", Opt_WarnMissingSigs, const Supported ), + ( "warn-name-shadowing", Opt_WarnNameShadowing, const Supported ), + ( "warn-overlapping-patterns", Opt_WarnOverlappingPatterns, const Supported ), + ( "warn-simple-patterns", Opt_WarnSimplePatterns, const Supported ), + ( "warn-type-defaults", Opt_WarnTypeDefaults, const Supported ), + ( "warn-monomorphism-restriction", Opt_WarnMonomorphism, const Supported ), + ( "warn-unused-binds", Opt_WarnUnusedBinds, const Supported ), + ( "warn-unused-imports", Opt_WarnUnusedImports, const Supported ), + ( "warn-unused-matches", Opt_WarnUnusedMatches, const Supported ), + ( "warn-deprecations", Opt_WarnDeprecations, const Supported ), + ( "warn-deprecated-flags", Opt_WarnDeprecatedFlags, const Supported ), + ( "warn-orphans", Opt_WarnOrphans, const Supported ), + ( "warn-tabs", Opt_WarnTabs, const Supported ), + ( "print-explicit-foralls", Opt_PrintExplicitForalls, const Supported ), + ( "strictness", Opt_Strictness, const Supported ), + ( "static-argument-transformation", Opt_StaticArgumentTransformation, const Supported ), + ( "full-laziness", Opt_FullLaziness, const Supported ), + ( "liberate-case", Opt_LiberateCase, const Supported ), + ( "spec-constr", Opt_SpecConstr, const Supported ), + ( "cse", Opt_CSE, const Supported ), + ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas, const Supported ), + ( "omit-interface-pragmas", Opt_OmitInterfacePragmas, const Supported ), + ( "do-lambda-eta-expansion", Opt_DoLambdaEtaExpansion, const Supported ), + ( "ignore-asserts", Opt_IgnoreAsserts, const Supported ), + ( "do-eta-reduction", Opt_DoEtaReduction, const Supported ), + ( "case-merge", Opt_CaseMerge, const Supported ), + ( "unbox-strict-fields", Opt_UnboxStrictFields, const Supported ), + ( "method-sharing", Opt_MethodSharing, const Supported ), + ( "dicts-cheap", Opt_DictsCheap, const Supported ), + ( "excess-precision", Opt_ExcessPrecision, const Supported ), + ( "asm-mangling", Opt_DoAsmMangling, const Supported ), + ( "print-bind-result", Opt_PrintBindResult, const Supported ), + ( "force-recomp", Opt_ForceRecomp, const Supported ), + ( "hpc-no-auto", Opt_Hpc_No_Auto, const Supported ), + ( "rewrite-rules", Opt_RewriteRules, const Supported ), + ( "break-on-exception", Opt_BreakOnException, const Supported ), + ( "break-on-error", Opt_BreakOnError, const Supported ), + ( "print-evld-with-show", Opt_PrintEvldWithShow, const Supported ), + ( "print-bind-contents", Opt_PrintBindContents, const Supported ), + ( "run-cps", Opt_RunCPSZ, const Supported ), + ( "convert-to-zipper-and-back", Opt_ConvertToZipCfgAndBack, const Supported ), + ( "vectorise", Opt_Vectorise, const Supported ), + ( "regs-graph", Opt_RegsGraph, const Supported ), + ( "regs-iterative", Opt_RegsIterative, const Supported ), + ( "th", Opt_TemplateHaskell, + deprecatedForLanguage "TemplateHaskell" ), + ( "fi", Opt_ForeignFunctionInterface, + deprecatedForLanguage "ForeignFunctionInterface" ), + ( "ffi", Opt_ForeignFunctionInterface, + deprecatedForLanguage "ForeignFunctionInterface" ), + ( "arrows", Opt_Arrows, + deprecatedForLanguage "Arrows" ), + ( "generics", Opt_Generics, + deprecatedForLanguage "Generics" ), + ( "implicit-prelude", Opt_ImplicitPrelude, + deprecatedForLanguage "ImplicitPrelude" ), + ( "bang-patterns", Opt_BangPatterns, + deprecatedForLanguage "BangPatterns" ), + ( "monomorphism-restriction", Opt_MonomorphismRestriction, + deprecatedForLanguage "MonomorphismRestriction" ), + ( "mono-pat-binds", Opt_MonoPatBinds, + deprecatedForLanguage "MonoPatBinds" ), + ( "extended-default-rules", Opt_ExtendedDefaultRules, + deprecatedForLanguage "ExtendedDefaultRules" ), + ( "implicit-params", Opt_ImplicitParams, + deprecatedForLanguage "ImplicitParams" ), + ( "scoped-type-variables", Opt_ScopedTypeVariables, + deprecatedForLanguage "ScopedTypeVariables" ), + ( "parr", Opt_PArr, + deprecatedForLanguage "PArr" ), + ( "allow-overlapping-instances", Opt_OverlappingInstances, + deprecatedForLanguage "OverlappingInstances" ), + ( "allow-undecidable-instances", Opt_UndecidableInstances, + deprecatedForLanguage "UndecidableInstances" ), + ( "allow-incoherent-instances", Opt_IncoherentInstances, + deprecatedForLanguage "IncoherentInstances" ), + ( "gen-manifest", Opt_GenManifest, const Supported ), + ( "embed-manifest", Opt_EmbedManifest, const Supported ) ] supportedLanguages :: [String] @@ -1464,65 +1457,65 @@ languageOptions :: [DynFlag] languageOptions = [ dynFlag | (_, dynFlag, _) <- xFlags ] -- These -X<blah> flags can all be reversed with -XNo<blah> -xFlags :: [(String, DynFlag, Deprecated)] +xFlags :: [(String, DynFlag, Bool -> Deprecated)] xFlags = [ - ( "CPP", Opt_Cpp, Supported ), - ( "PatternGuards", Opt_PatternGuards, Supported ), - ( "UnicodeSyntax", Opt_UnicodeSyntax, Supported ), - ( "MagicHash", Opt_MagicHash, Supported ), - ( "PolymorphicComponents", Opt_PolymorphicComponents, Supported ), - ( "ExistentialQuantification", Opt_ExistentialQuantification, Supported ), - ( "KindSignatures", Opt_KindSignatures, Supported ), - ( "PatternSignatures", Opt_PatternSignatures, Supported ), - ( "EmptyDataDecls", Opt_EmptyDataDecls, Supported ), - ( "ParallelListComp", Opt_ParallelListComp, Supported ), - ( "TransformListComp", Opt_TransformListComp, Supported ), - ( "ForeignFunctionInterface", Opt_ForeignFunctionInterface, Supported ), - ( "UnliftedFFITypes", Opt_UnliftedFFITypes, Supported ), - ( "LiberalTypeSynonyms", Opt_LiberalTypeSynonyms, Supported ), - ( "Rank2Types", Opt_Rank2Types, Supported ), - ( "RankNTypes", Opt_RankNTypes, Supported ), - ( "ImpredicativeTypes", Opt_ImpredicativeTypes, Supported ), - ( "TypeOperators", Opt_TypeOperators, Supported ), - ( "RecursiveDo", Opt_RecursiveDo, Supported ), - ( "Arrows", Opt_Arrows, Supported ), - ( "PArr", Opt_PArr, Supported ), - ( "TemplateHaskell", Opt_TemplateHaskell, Supported ), - ( "QuasiQuotes", Opt_QuasiQuotes, Supported ), - ( "Generics", Opt_Generics, Supported ), + ( "CPP", Opt_Cpp, const Supported ), + ( "PatternGuards", Opt_PatternGuards, const Supported ), + ( "UnicodeSyntax", Opt_UnicodeSyntax, const Supported ), + ( "MagicHash", Opt_MagicHash, const Supported ), + ( "PolymorphicComponents", Opt_PolymorphicComponents, const Supported ), + ( "ExistentialQuantification", Opt_ExistentialQuantification, const Supported ), + ( "KindSignatures", Opt_KindSignatures, const Supported ), + ( "PatternSignatures", Opt_PatternSignatures, const Supported ), + ( "EmptyDataDecls", Opt_EmptyDataDecls, const Supported ), + ( "ParallelListComp", Opt_ParallelListComp, const Supported ), + ( "TransformListComp", Opt_TransformListComp, const Supported ), + ( "ForeignFunctionInterface", Opt_ForeignFunctionInterface, const Supported ), + ( "UnliftedFFITypes", Opt_UnliftedFFITypes, const Supported ), + ( "LiberalTypeSynonyms", Opt_LiberalTypeSynonyms, const Supported ), + ( "Rank2Types", Opt_Rank2Types, const Supported ), + ( "RankNTypes", Opt_RankNTypes, const Supported ), + ( "ImpredicativeTypes", Opt_ImpredicativeTypes, const Supported ), + ( "TypeOperators", Opt_TypeOperators, const Supported ), + ( "RecursiveDo", Opt_RecursiveDo, const Supported ), + ( "Arrows", Opt_Arrows, const Supported ), + ( "PArr", Opt_PArr, const Supported ), + ( "TemplateHaskell", Opt_TemplateHaskell, const Supported ), + ( "QuasiQuotes", Opt_QuasiQuotes, const Supported ), + ( "Generics", Opt_Generics, const Supported ), -- On by default: - ( "ImplicitPrelude", Opt_ImplicitPrelude, Supported ), - ( "RecordWildCards", Opt_RecordWildCards, Supported ), - ( "NamedFieldPuns", Opt_RecordPuns, Supported ), + ( "ImplicitPrelude", Opt_ImplicitPrelude, const Supported ), + ( "RecordWildCards", Opt_RecordWildCards, const Supported ), + ( "NamedFieldPuns", Opt_RecordPuns, const Supported ), ( "RecordPuns", Opt_RecordPuns, - Deprecated "Use the NamedFieldPuns language instead" ), - ( "DisambiguateRecordFields", Opt_DisambiguateRecordFields, Supported ), - ( "OverloadedStrings", Opt_OverloadedStrings, Supported ), - ( "GADTs", Opt_GADTs, Supported ), - ( "ViewPatterns", Opt_ViewPatterns, Supported ), - ( "TypeFamilies", Opt_TypeFamilies, Supported ), - ( "BangPatterns", Opt_BangPatterns, Supported ), + deprecatedForLanguage "NamedFieldPuns" ), + ( "DisambiguateRecordFields", Opt_DisambiguateRecordFields, const Supported ), + ( "OverloadedStrings", Opt_OverloadedStrings, const Supported ), + ( "GADTs", Opt_GADTs, const Supported ), + ( "ViewPatterns", Opt_ViewPatterns, const Supported ), + ( "TypeFamilies", Opt_TypeFamilies, const Supported ), + ( "BangPatterns", Opt_BangPatterns, const Supported ), -- On by default: - ( "MonomorphismRestriction", Opt_MonomorphismRestriction, Supported ), + ( "MonomorphismRestriction", Opt_MonomorphismRestriction, const Supported ), -- On by default (which is not strictly H98): - ( "MonoPatBinds", Opt_MonoPatBinds, Supported ), - ( "RelaxedPolyRec", Opt_RelaxedPolyRec, Supported ), - ( "ExtendedDefaultRules", Opt_ExtendedDefaultRules, Supported ), - ( "ImplicitParams", Opt_ImplicitParams, Supported ), - ( "ScopedTypeVariables", Opt_ScopedTypeVariables, Supported ), - ( "UnboxedTuples", Opt_UnboxedTuples, Supported ), - ( "StandaloneDeriving", Opt_StandaloneDeriving, Supported ), - ( "DeriveDataTypeable", Opt_DeriveDataTypeable, Supported ), - ( "TypeSynonymInstances", Opt_TypeSynonymInstances, Supported ), - ( "FlexibleContexts", Opt_FlexibleContexts, Supported ), - ( "FlexibleInstances", Opt_FlexibleInstances, Supported ), - ( "ConstrainedClassMethods", Opt_ConstrainedClassMethods, Supported ), - ( "MultiParamTypeClasses", Opt_MultiParamTypeClasses, Supported ), - ( "FunctionalDependencies", Opt_FunctionalDependencies, Supported ), - ( "GeneralizedNewtypeDeriving", Opt_GeneralizedNewtypeDeriving, Supported ), - ( "OverlappingInstances", Opt_OverlappingInstances, Supported ), - ( "UndecidableInstances", Opt_UndecidableInstances, Supported ), - ( "IncoherentInstances", Opt_IncoherentInstances, Supported ) + ( "MonoPatBinds", Opt_MonoPatBinds, const Supported ), + ( "RelaxedPolyRec", Opt_RelaxedPolyRec, const Supported ), + ( "ExtendedDefaultRules", Opt_ExtendedDefaultRules, const Supported ), + ( "ImplicitParams", Opt_ImplicitParams, const Supported ), + ( "ScopedTypeVariables", Opt_ScopedTypeVariables, const Supported ), + ( "UnboxedTuples", Opt_UnboxedTuples, const Supported ), + ( "StandaloneDeriving", Opt_StandaloneDeriving, const Supported ), + ( "DeriveDataTypeable", Opt_DeriveDataTypeable, const Supported ), + ( "TypeSynonymInstances", Opt_TypeSynonymInstances, const Supported ), + ( "FlexibleContexts", Opt_FlexibleContexts, const Supported ), + ( "FlexibleInstances", Opt_FlexibleInstances, const Supported ), + ( "ConstrainedClassMethods", Opt_ConstrainedClassMethods, const Supported ), + ( "MultiParamTypeClasses", Opt_MultiParamTypeClasses, const Supported ), + ( "FunctionalDependencies", Opt_FunctionalDependencies, const Supported ), + ( "GeneralizedNewtypeDeriving", Opt_GeneralizedNewtypeDeriving, const Supported ), + ( "OverlappingInstances", Opt_OverlappingInstances, const Supported ), + ( "UndecidableInstances", Opt_UndecidableInstances, const Supported ), + ( "IncoherentInstances", Opt_IncoherentInstances, const Supported ) ] impliedFlags :: [(DynFlag, [DynFlag])] @@ -1567,25 +1560,6 @@ glasgowExtsFlags = [ , Opt_GeneralizedNewtypeDeriving , Opt_TypeFamilies ] ------------------- -isFlag :: [(String,a)] -> String -> Bool -isFlag flags f = any (\(ff,_) -> ff == f) flags - -isPrefFlag :: String -> [(String,a)] -> String -> Bool -isPrefFlag pref flags no_f - | Just f <- maybePrefixMatch pref no_f = isFlag flags f - | otherwise = False - ------------------- -getFlag :: [(String,a)] -> String -> a -getFlag flags f = case [ opt | (ff, opt) <- flags, ff == f] of - (o:_) -> o - [] -> panic ("get_flag " ++ f) - -getPrefFlag :: String -> [(String,a)] -> String -> a -getPrefFlag pref flags f = getFlag flags (fromJust (maybePrefixMatch pref f)) --- We should only be passed flags which match the prefix - -- ----------------------------------------------------------------------------- -- Parsing the dynamic flags. diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index b9e739f1de..fdabacf571 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -176,8 +176,13 @@ printBagOfWarnings dflags bag_of_warns GT -> False handleFlagWarnings :: DynFlags -> [String] -> IO () -handleFlagWarnings _ [] = return () handleFlagWarnings dflags warns + = when (dopt Opt_WarnDeprecatedFlags dflags) + (handleFlagWarnings' dflags warns) + +handleFlagWarnings' :: DynFlags -> [String] -> IO () +handleFlagWarnings' _ [] = return () +handleFlagWarnings' dflags warns = do -- It would be nicer if warns :: [Message], but that has circular -- import problems. let warns' = map text warns diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 8d88037e2d..f531a16bbe 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -649,7 +649,7 @@ way_details = , "-package concurrent" ]), (WayNDP, Way "ndp" False "Nested data parallelism" - [ "-fparr" + [ "-XParr" , "-fvectorise"]), (WayUser_a, Way "a" False "User way 'a'" ["$WAY_a_REAL_OPTS"]), diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index dfef90a7d8..6362bf3e20 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -504,8 +504,8 @@ data Token | ITvocurly | ITvccurly | ITobrack - | ITopabrack -- [:, for parallel arrays with -fparr - | ITcpabrack -- :], for parallel arrays with -fparr + | ITopabrack -- [:, for parallel arrays with -XParr + | ITcpabrack -- :], for parallel arrays with -XParr | ITcbrack | IToparen | ITcparen @@ -1550,7 +1550,7 @@ getLexState :: P Int getLexState = P $ \s@PState{ lex_state=ls:_ } -> POk s ls -- for reasons of efficiency, flags indicating language extensions (eg, --- -fglasgow-exts or -fparr) are represented by a bitmap stored in an unboxed +-- -fglasgow-exts or -XParr) are represented by a bitmap stored in an unboxed -- integer genericsBit, ffiBit, parrBit :: Int diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index 67b1dd1ec7..e79bfba2b0 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -926,7 +926,7 @@ isModuleExported implicit_prelude mod (GRE { gre_name = name, gre_prov = prov }) -- They just clutter up the environment (esp tuples), and the parser -- will generate Exact RdrNames for them, so the cluttered -- envt is no use. To avoid doing this filter all the time, - -- we use -fno-implicit-prelude as a clue that the filter is + -- we use -XNoImplicitPrelude as a clue that the filter is -- worth while. Really, it's only useful for GHC.Base and GHC.Tuple. -- -- It's worth doing because it makes the environment smaller for @@ -1038,7 +1038,7 @@ a) It might be a WiredInName; in that case we may not load its interface (although we could). b) It might be GHC.Real.fromRational, or GHC.Num.fromInteger - These are seen as "used" by the renamer (if -fno-implicit-prelude) + These are seen as "used" by the renamer (if -XNoImplicitPrelude) is on), but the typechecker may discard their uses if in fact the in-scope fromRational is GHC.Read.fromRational, (see tcPat.tcOverloadedLit), and the typechecker sees that the type diff --git a/compiler/rename/RnPat.lhs b/compiler/rename/RnPat.lhs index 55155d7498..42a14873c7 100644 --- a/compiler/rename/RnPat.lhs +++ b/compiler/rename/RnPat.lhs @@ -447,7 +447,7 @@ badDotDot str = ptext (sLit "You cannot use `..' in record") <+> text str badPun :: Located RdrName -> SDoc badPun fld = vcat [ptext (sLit "Illegal use of punning for field") <+> quotes (ppr fld), - ptext (sLit "Use -XRecordPuns to permit this")] + ptext (sLit "Use -XNamedFieldPuns to permit this")] -- wrappers diff --git a/compiler/typecheck/Inst.lhs b/compiler/typecheck/Inst.lhs index d41e36f63e..31a93540dc 100644 --- a/compiler/typecheck/Inst.lhs +++ b/compiler/typecheck/Inst.lhs @@ -401,7 +401,7 @@ newMethodFromName :: InstOrigin -> BoxyRhoType -> Name -> TcM TcId newMethodFromName origin ty name = do id <- tcLookupId name -- Use tcLookupId not tcLookupGlobalId; the method is almost - -- always a class op, but with -fno-implicit-prelude GHC is + -- always a class op, but with -XNoImplicitPrelude GHC is -- meant to find whatever thing is in scope, and that may -- be an ordinary function. loc <- getInstLoc origin @@ -862,7 +862,7 @@ tcGetInstEnvs = do { eps <- getEps; env <- getGblEnv; %* * %************************************************************************ -Suppose we are doing the -fno-implicit-prelude thing, and we encounter +Suppose we are doing the -XNoImplicitPrelude thing, and we encounter a do-expression. We have to find (>>) in the current environment, which is done by the rename. Then we have to check that it has the same type as Control.Monad.(>>). Or, more precisely, a compatible type. One 'customer' had diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs index 2cfb1b2bcb..7cafd3c1c5 100644 --- a/compiler/typecheck/TcBinds.lhs +++ b/compiler/typecheck/TcBinds.lhs @@ -630,14 +630,14 @@ tcLhs sig_fn (FunBind { fun_id = L nm_loc name, fun_infix = inf, fun_matches = m tcLhs sig_fn (PatBind { pat_lhs = pat, pat_rhs = grhss }) = do { mb_sigs <- mapM (tcInstSig_maybe sig_fn) names ; mono_pat_binds <- doptM Opt_MonoPatBinds - -- With -fmono-pat-binds, we do no generalisation of pattern bindings + -- With -XMonoPatBinds, we do no generalisation of pattern bindings -- But the signature can still be polymoprhic! -- data T = MkT (forall a. a->a) -- x :: forall a. a->a -- MkT x = <rhs> -- The function get_sig_ty decides whether the pattern-bound variables - -- should have exactly the type in the type signature (-fmono-pat-binds), - -- or the instantiated version (-fmono-pat-binds) + -- should have exactly the type in the type signature (-XMonoPatBinds), + -- or the instantiated version (-XMonoPatBinds) ; let nm_sig_prs = names `zip` mb_sigs get_sig_ty | mono_pat_binds = idType . sig_id diff --git a/compiler/typecheck/TcClassDcl.lhs b/compiler/typecheck/TcClassDcl.lhs index 80adaa503b..8b43ad6a72 100644 --- a/compiler/typecheck/TcClassDcl.lhs +++ b/compiler/typecheck/TcClassDcl.lhs @@ -794,7 +794,7 @@ notSimple inst_tys notGeneric :: TyCon -> SDoc notGeneric tycon = vcat [ptext (sLit "because the instance type constructor") <+> quotes (ppr tycon) <+> - ptext (sLit "was not compiled with -fgenerics")] + ptext (sLit "was not compiled with -XGenerics")] badGenericInstanceType :: LHsBinds Name -> SDoc badGenericInstanceType binds diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs index b1a281994f..6930b681fe 100644 --- a/compiler/typecheck/TcDeriv.lhs +++ b/compiler/typecheck/TcDeriv.lhs @@ -971,7 +971,7 @@ inferInstanceContexts oflag infer_specs iterate_deriv :: Int -> [ThetaType] -> TcM [DerivSpec] iterate_deriv n current_solns | n > 20 -- Looks as if we are in an infinite loop - -- This can happen if we have -fallow-undecidable-instances + -- This can happen if we have -XUndecidableInstances -- (See TcSimplify.tcSimplifyDeriv.) = pprPanic "solveDerivEqns: probable loop" (vcat (map pprDerivSpec infer_specs) $$ ppr current_solns) diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index 1290e03cb6..865c749131 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -1595,7 +1595,7 @@ predUndecErr pred msg = sep [msg, nomoreMsg, smallerMsg, undecidableMsg :: SDoc nomoreMsg = ptext (sLit "Variable occurs more often in a constraint than in the instance head") smallerMsg = ptext (sLit "Constraint is no smaller than the instance head") -undecidableMsg = ptext (sLit "Use -fallow-undecidable-instances to permit this") +undecidableMsg = ptext (sLit "Use -XUndecidableInstances to permit this") \end{code} @@ -1635,7 +1635,7 @@ should have only type-variable constraints. Here is another example: data Fix f = In (f (Fix f)) deriving( Eq ) -Here, if we are prepared to allow -fallow-undecidable-instances we +Here, if we are prepared to allow -XUndecidableInstances we could derive the instance instance Eq (f (Fix f)) => Eq (Fix f) but this is so delicate that I don't think it should happen inside @@ -1672,7 +1672,7 @@ validDerivPred _ = False \begin{code} -- Check that a "type instance" is well-formed (which includes decidability --- unless -fallow-undecidable-instances is given). +-- unless -XUndecidableInstances is given). -- checkValidTypeInst :: [Type] -> Type -> TcM () checkValidTypeInst typats rhs diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs index fbd676f0a6..f651e0f6fe 100644 --- a/compiler/typecheck/TcSimplify.lhs +++ b/compiler/typecheck/TcSimplify.lhs @@ -2670,7 +2670,7 @@ disambiguate doc interactive dflags insts | extended_defaulting = any isInteractiveClass clss | otherwise = all is_std_class clss && (any is_num_class clss) - -- In interactive mode, or with -fextended-default-rules, + -- In interactive mode, or with -XExtendedDefaultRules, -- we default Show a to Show () to avoid graututious errors on "show []" isInteractiveClass cls = is_num_class cls || (classKey cls `elem` [showClassKey, eqClassKey, ordClassKey]) @@ -2736,7 +2736,7 @@ getDefaultTys extended_deflts ovl_strings Note [Default unitTy] ~~~~~~~~~~~~~~~~~~~~~ -In interative mode (or with -fextended-default-rules) we add () as the first type we +In interative mode (or with -XExtendedDefaultRules) we add () as the first type we try when defaulting. This has very little real impact, except in the following case. Consider: Text.Printf.printf "hello" @@ -2962,7 +2962,7 @@ report_no_instances tidy_env mb_what insts ASSERT( not (null unifiers) ) parens (vcat [ptext (sLit "The choice depends on the instantiation of") <+> quotes (pprWithCommas ppr (varSetElems (tyVarsOfInst dict))), - ptext (sLit "To pick the first instance above, use -fallow-incoherent-instances"), + ptext (sLit "To pick the first instance above, use -XIncoherentInstances"), ptext (sLit "when compiling the other instance declarations")])] where ispecs = [ispec | (ispec, _) <- matches] @@ -3061,8 +3061,8 @@ monomorphism_fix dflags = ptext (sLit "Probable fix:") <+> vcat [ptext (sLit "give these definition(s) an explicit type signature"), if dopt Opt_MonomorphismRestriction dflags - then ptext (sLit "or use -fno-monomorphism-restriction") - else empty] -- Only suggest adding "-fno-monomorphism-restriction" + then ptext (sLit "or use -XNoMonomorphismRestriction") + else empty] -- Only suggest adding "-XNoMonomorphismRestriction" -- if it is not already set! warnDefault :: [(Inst, Class, Var)] -> Type -> TcM () diff --git a/compiler/utils/LazyUniqFM.lhs b/compiler/utils/LazyUniqFM.lhs index d8132e3cd5..55b438f62d 100644 --- a/compiler/utils/LazyUniqFM.lhs +++ b/compiler/utils/LazyUniqFM.lhs @@ -11,7 +11,8 @@ Basically, the things need to be in class @Uniquable@, and we use the @getUnique@ method to grab their @Uniques@. \begin{code} -{-# OPTIONS -Wall -fno-warn-name-shadowing -Werror -fallow-undecidable-instances #-} +{-# OPTIONS -Wall -fno-warn-name-shadowing -Werror #-} +{-# LANGUAGE UndecidableInstances #-} module LazyUniqFM ( UniqFM, -- abstract type diff --git a/docs/comm/exts/ndp.html b/docs/comm/exts/ndp.html index 0c94c3960b..2c79d728d5 100644 --- a/docs/comm/exts/ndp.html +++ b/docs/comm/exts/ndp.html @@ -32,8 +32,8 @@ <h2>More Sugar: Special Syntax for Array Comprehensions</h2> <p> - The option <code>-fparr</code>, which is a dynamic hsc option that can - be reversed with <code>-fno-parr</code>, enables special syntax for + The option <code>-XParr</code>, which is a dynamic hsc option that can + be reversed with <code>-XNoParr</code>, enables special syntax for parallel arrays, which is not essential to using parallel arrays, but makes for significantly more concise programs. The switch works by making the lexical analyser (located in <a @@ -326,7 +326,7 @@ mapFilterP :: (a -> Maybe b) -> [:a:] -> [:b:]</pre> flattening (just like profiling does), there is a <em>compiler way</em> <code>"ndp"</code>, which can be selected using the way option code <code>-ndp</code>. This option will automagically select - <code>-fparr</code> and <code>-fflatten</code>. + <code>-XParr</code> and <code>-fflatten</code>. <h4><code>FlattenMonad</code></h4> <p> diff --git a/docs/users_guide/bugs.xml b/docs/users_guide/bugs.xml index 50ffb399a4..fdeeaa87cc 100644 --- a/docs/users_guide/bugs.xml +++ b/docs/users_guide/bugs.xml @@ -98,7 +98,7 @@ main = do args <- getArgs <para>GHC's typechecker makes all pattern bindings monomorphic by default; this behaviour can be disabled with - <option>-fno-mono-pat-binds</option>. See <xref + <option>-XNoMonoPatBinds</option>. See <xref linkend="options-language" />.</para> </sect3> diff --git a/docs/users_guide/ffi-chap.xml b/docs/users_guide/ffi-chap.xml index 49896b92e0..12aea555df 100644 --- a/docs/users_guide/ffi-chap.xml +++ b/docs/users_guide/ffi-chap.xml @@ -9,11 +9,8 @@ Foreign function interface (FFI) <para>GHC (mostly) conforms to the Haskell 98 Foreign Function Interface Addendum 1.0, whose definition is available from <ulink url="http://www.haskell.org/"><literal>http://www.haskell.org/</literal></ulink>.</para> - <para>To enable FFI support in GHC, give the <option>-fffi</option><indexterm><primary><option>-fffi</option></primary> - </indexterm> flag, or -the <option>-fglasgow-exts</option><indexterm><primary><option>-fglasgow-exts</option></primary> - </indexterm> flag which implies <option>-fffi</option> -.</para> + <para>To enable FFI support in GHC, give the <option>-XForeignFunctionInterface</option><indexterm><primary><option>-XForeignFunctionInterface</option></primary> + </indexterm> flag.</para> <para>GHC implements a number of GHC-specific extensions to the FFI Addendum. These extensions are described in <xref linkend="ffi-ghcexts" />, but please note that programs using diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 9b1e272d9b..8da67f887c 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -881,10 +881,10 @@ <entry><option>-XNoRecordWildCards</option></entry> </row> <row> - <entry><option>-XRecordPuns</option></entry> + <entry><option>-XNamedFieldPuns</option></entry> <entry>Enable <link linkend="record-puns">record puns</link>.</entry> <entry>dynamic</entry> - <entry><option>-XNoRecordPuns</option></entry> + <entry><option>-XNoNamedFieldPuns</option></entry> </row> <row> <entry><option>-XDisambiguateRecordFields</option></entry> @@ -1012,6 +1012,13 @@ </row> <row> + <entry><option>-fwarn-deprecated-flags</option></entry> + <entry>warn about uses of commandline flags that are deprecated</entry> + <entry>dynamic</entry> + <entry><option>-fno-warn-deprecated-flags</option></entry> + </row> + + <row> <entry><option>-fwarn-duplicate-exports</option></entry> <entry>warn when an entity is exported multiple times</entry> <entry>dynamic</entry> diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 6b8a20b486..a100e43e77 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -1410,7 +1410,7 @@ records from different modules that use the same field name. </title> <para> -Record puns are enabled by the flag <literal>-XRecordPuns</literal>. +Record puns are enabled by the flag <literal>-XNamedFieldPuns</literal>. </para> <para> @@ -3269,7 +3269,7 @@ corresponding type in the instance declaration. These restrictions ensure that context reduction terminates: each reduction step makes the problem smaller by at least one constructor. Both the Paterson Conditions and the Coverage Condition are lifted -if you give the <option>-fallow-undecidable-instances</option> +if you give the <option>-XUndecidableInstances</option> flag (<xref linkend="undecidable-instances"/>). You can find lots of background material about the reason for these restrictions in the paper <ulink diff --git a/docs/users_guide/gone_wrong.xml b/docs/users_guide/gone_wrong.xml index ce778f2ebe..619d8acd90 100644 --- a/docs/users_guide/gone_wrong.xml +++ b/docs/users_guide/gone_wrong.xml @@ -55,7 +55,7 @@ example, if it picks up a non-standard <filename>Prelude.hi</filename> file, pretty terrible things will happen. If you turn on - <option>-fno-implicit-prelude</option><indexterm><primary>-fno-implicit-prelude + <option>-XNoImplicitPrelude</option><indexterm><primary>-XNoImplicitPrelude option</primary></indexterm>, the compiler will almost surely die, unless you know what you are doing.</para> diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 21e5205022..ef62d59118 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -842,6 +842,7 @@ ghc -c Foo.hs</screen> program. These are: <option>-fwarn-overlapping-patterns</option>, <option>-fwarn-deprecations</option>, + <option>-fwarn-deprecated-flags</option>, <option>-fwarn-duplicate-exports</option>, <option>-fwarn-missing-fields</option>, and <option>-fwarn-missing-methods</option>. The following flags are @@ -931,6 +932,19 @@ ghc -c Foo.hs</screen> </varlistentry> <varlistentry> + <term><option>-fwarn-deprecated-flags</option>:</term> + <listitem> + <indexterm><primary><option>-fwarn-deprecated-flags</option></primary> + </indexterm> + <indexterm><primary>deprecated-flags</primary></indexterm> + <para>Causes a warning to be emitted when a deprecated + commandline flag is used.</para> + + <para>This option is on by default.</para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>-fwarn-dodgy-imports</option>:</term> <listitem> <indexterm><primary><option>-fwarn-dodgy-imports</option></primary> @@ -982,11 +996,11 @@ ghc -c Foo.hs</screen> imported. This happens unless either the Prelude module is explicitly imported with an <literal>import ... Prelude ...</literal> line, or this implicit import is disabled (either by - <option>-fno-implicit-prelude</option> or a + <option>-XNoImplicitPrelude</option> or a <literal>LANGUAGE NoImplicitPrelude</literal> pragma).</para> <para>Note that no warning is given for syntax that implicitly - refers to the Prelude, even if <option>-fno-implicit-prelude</option> + refers to the Prelude, even if <option>-XNoImplicitPrelude</option> would change whether it refers to the Prelude. For example, no warning is given when <literal>368</literal> means diff --git a/libraries/Makefile b/libraries/Makefile index 0ca6cdd768..ac92a526de 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -90,6 +90,10 @@ space=$(empty) $(empty) # ----------------------------------------------------------------------------- +ifeq "$(ghc_ge_609)" "YES" +GhcLibHcOpts += -fno-warn-deprecated-flags +endif + ifeq "$(RelocatableBuild)" "YES" # On Windows we want to make moveable bindists, but we need to tell # ghc-pkg where the haddock docs are. Therefore we completely ignore diff --git a/libraries/Makefile.local b/libraries/Makefile.local index 57dbfefa5d..b263059dbb 100644 --- a/libraries/Makefile.local +++ b/libraries/Makefile.local @@ -15,6 +15,8 @@ GHC := $(SAVE_GHC) AR := $(SAVE_AR) LD := $(SAVE_LD) +GhcLibHcOpts += -fno-warn-deprecated-flags + # Now add flags from the GHC build system to the Cabal build: GHC_CC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS)) GHC_OPTS += $(SRC_HC_OPTS) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 620b4ebffe..911f5025ec 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -35,7 +35,7 @@ SRC_HC_OPTS = -O -H64m GhcStage1HcOpts = -O -fasm GhcStage2HcOpts = -O2 -fasm GhcHcOpts = -Rghc-timing -GhcLibHcOpts = -O2 -fgenerics +GhcLibHcOpts = -O2 -XGenerics GhcLibWays = p endif diff --git a/mk/config.mk.in b/mk/config.mk.in index 406810b26a..783f4f91f9 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -402,12 +402,12 @@ GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO) # -O(2) is pretty desirable, otherwise no inlining of prelude # things (incl "+") happens when compiling with this compiler # -# -fgenerics switches on generation of support code for +# -XGenerics switches on generation of support code for # derivable type classes. This is now off by default, # but we switch it on for the libraries so that we generate # the code in case someone importing wants it -GhcLibHcOpts=-O2 -Rghc-timing -fgenerics +GhcLibHcOpts=-O2 -Rghc-timing -XGenerics # Win32 only: Enable the RTS and libraries to be built as DLLs DLLized=@EnableWin32DLLs@ diff --git a/mk/package.mk b/mk/package.mk index 094b6a5748..f17f9e03e5 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -129,12 +129,12 @@ SRC_HC_OPTS += $(GhcLibHcOpts) SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) endif -# -fgenerics switches on generation of support code for +# -XGenerics switches on generation of support code for # derivable type classes. This is now off by default, # but we switch it on for the libraries so that we generate # the code in case someone importing wants it. ifeq "$(NON_HS_PACKAGE)" "" -SRC_HC_OPTS += -fgenerics +SRC_HC_OPTS += -XGenerics endif ifndef LIBRARY diff --git a/utils/ext-core/lib/GHC_ExtCore/Unicode.hs b/utils/ext-core/lib/GHC_ExtCore/Unicode.hs index 84c88d4bf7..13c24db431 100644 --- a/utils/ext-core/lib/GHC_ExtCore/Unicode.hs +++ b/utils/ext-core/lib/GHC_ExtCore/Unicode.hs @@ -2,7 +2,7 @@ -- Replacement for GHC.Unicode module -{-# OPTIONS -fno-implicit-prelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS -#include "WCsubst.h" #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index d228045ad9..ffd10ff7ba 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -465,9 +465,9 @@ gen_latex_doc (Info defaults entries) gen_wrappers :: Info -> String gen_wrappers (Info _ entries) - = "{-# OPTIONS -fno-implicit-prelude #-}\n" + = "{-# LANGUAGE NoImplicitPrelude #-}\n" -- Dependencies on Prelude must be explicit in libraries/base, but we - -- don't need the Prelude here so we add -fno-implicit-prelude. + -- don't need the Prelude here so we add NoImplicitPrelude. ++ "module GHC.PrimopWrappers where\n" ++ "import qualified GHC.Prim\n" ++ unlines (map f (filter (not.dodgy) (filter is_primop entries))) diff --git a/utils/hsc2hs/Main.hs b/utils/hsc2hs/Main.hs index a939f319d1..978cc4beb7 100644 --- a/utils/hsc2hs/Main.hs +++ b/utils/hsc2hs/Main.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -fffi -cpp #-} +{-# LANGUAGE CPP, ForeignFunctionInterface #-} ------------------------------------------------------------------------ -- Program for converting .hsc files to .hs files, by converting the diff --git a/utils/runghc/runghc.hs b/utils/runghc/runghc.hs index e2cea31231..5a40b622de 100644 --- a/utils/runghc/runghc.hs +++ b/utils/runghc/runghc.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -cpp -fffi #-} +{-# LANGUAGE CPP, ForeignFunctionInterface #-} #if __GLASGOW_HASKELL__ < 603 #include "config.h" #else |