diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-07-11 18:42:35 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-04 21:45:49 -0400 |
commit | 0dded5ecd2f02e13292818ae3729d32832c014f3 (patch) | |
tree | ad5d985078d94e8bdc4ad5d65be2d052e6dd42c2 /compiler | |
parent | eb892b28b92351358dd7cb0ee6b0b1a1d7fcc98e (diff) | |
download | haskell-0dded5ecd2f02e13292818ae3729d32832c014f3.tar.gz |
Always enable the external interpreter
You can always just not use or even build `iserv`. I don't think the
maintenance cost of the CPP is worth...I can't even tell what the
benefit is.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghc.cabal.in | 11 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 17 | ||||
-rw-r--r-- | compiler/main/DynamicLoading.hs | 38 | ||||
-rw-r--r-- | compiler/main/HeaderInfo.hs | 10 | ||||
-rw-r--r-- | compiler/rename/RnExpr.hs | 2 | ||||
-rw-r--r-- | compiler/simplCore/SimplCore.hs | 4 | ||||
-rw-r--r-- | compiler/typecheck/TcPluginM.hs | 7 |
7 files changed, 15 insertions, 74 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index f191370071..a612733de6 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -25,11 +25,6 @@ Flag ghci Default: False Manual: True -Flag ext-interp - Description: Support external interpreter - Default: True - Manual: True - Flag stage1 Description: Is this stage 1? Default: False @@ -98,12 +93,6 @@ Library CPP-Options: -DHAVE_INTERNAL_INTERPRETER Include-Dirs: ../rts/dist/build @FFIIncludeDir@ - if flag(ext-interp) - CPP-Options: -DHAVE_EXTERNAL_INTERPRETER - - if flag(ghci) || flag(ext-interp) - CPP-Options: -DHAVE_INTERPRETER - -- sanity-check to ensure not more than one integer flag is set if flag(integer-gmp) && flag(integer-simple) build-depends: invalid-cabal-flag-settings<0 diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 9e9e70ad28..465dd2737b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -4360,26 +4360,25 @@ supportedLanguages = map (flagSpecName . snd) languageFlagsDeps supportedLanguageOverlays :: [String] supportedLanguageOverlays = map (flagSpecName . snd) safeHaskellFlagsDeps -supportedExtensions :: [String] -supportedExtensions = concatMap toFlagSpecNamePair xFlags +supportedExtensions :: PlatformMini -> [String] +supportedExtensions targetPlatformMini = concatMap toFlagSpecNamePair xFlags where toFlagSpecNamePair flg -#if !defined(HAVE_INTERPRETER) -- IMPORTANT! Make sure that `ghc --supported-extensions` omits -- "TemplateHaskell"/"QuasiQuotes" when it's known not to work out of the -- box. See also GHC #11102 and #16331 for more details about -- the rationale - | flagSpecFlag flg == LangExt.TemplateHaskell = [noName] - | flagSpecFlag flg == LangExt.QuasiQuotes = [noName] -#endif + | isAIX, flagSpecFlag flg == LangExt.TemplateHaskell = [noName] + | isAIX, flagSpecFlag flg == LangExt.QuasiQuotes = [noName] | otherwise = [name, noName] where + isAIX = platformMini_os targetPlatformMini == OSAIX noName = "No" ++ name name = flagSpecName flg -supportedLanguagesAndExtensions :: [String] -supportedLanguagesAndExtensions = - supportedLanguages ++ supportedLanguageOverlays ++ supportedExtensions +supportedLanguagesAndExtensions :: PlatformMini -> [String] +supportedLanguagesAndExtensions targetPlatformMini = + supportedLanguages ++ supportedLanguageOverlays ++ supportedExtensions targetPlatformMini -- | These -X<blah> flags cannot be reversed with -XNo<blah> languageFlagsDeps :: [(Deprecation, FlagSpec Language)] diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs index 64cc0a1216..ea09a8ceb5 100644 --- a/compiler/main/DynamicLoading.hs +++ b/compiler/main/DynamicLoading.hs @@ -3,7 +3,6 @@ -- | Dynamically lookup up values from modules and loading them. module DynamicLoading ( initializePlugins, -#if defined(HAVE_INTERPRETER) -- * Loading plugins loadFrontendPlugin, @@ -19,15 +18,11 @@ module DynamicLoading ( getValueSafely, getHValueSafely, lessUnsafeCoerce -#else - pluginError -#endif ) where import GhcPrelude import DynFlags -#if defined(HAVE_INTERPRETER) import Linker ( linkModule, getHValue ) import GHCi ( wormhole ) import SrcLoc ( noSrcSpan ) @@ -60,28 +55,11 @@ import Control.Monad ( when, unless ) import Data.Maybe ( mapMaybe ) import GHC.Exts ( unsafeCoerce# ) -#else - -import HscTypes ( HscEnv ) -import Module ( ModuleName, moduleNameString ) -import Panic - -import Data.List ( intercalate ) -import Control.Monad ( unless ) - -#endif - -- | Loads the plugins specified in the pluginModNames field of the dynamic -- flags. Should be called after command line arguments are parsed, but before -- actual compilation starts. Idempotent operation. Should be re-called if -- pluginModNames or pluginModNameOpts changes. initializePlugins :: HscEnv -> DynFlags -> IO DynFlags -#if !defined(HAVE_INTERPRETER) -initializePlugins _ df - = do let pluginMods = pluginModNames df - unless (null pluginMods) (pluginError pluginMods) - return df -#else initializePlugins hsc_env df | map lpModuleName (cachedPlugins df) == pluginModNames df -- plugins not changed @@ -93,10 +71,6 @@ initializePlugins hsc_env df = do loadedPlugins <- loadPlugins (hsc_env { hsc_dflags = df }) return $ df { cachedPlugins = loadedPlugins } where argumentsForPlugin p = map snd . filter ((== lpModuleName p) . fst) -#endif - - -#if defined(HAVE_INTERPRETER) loadPlugins :: HscEnv -> IO [LoadedPlugin] loadPlugins hsc_env @@ -302,15 +276,3 @@ throwCmdLineErrorS dflags = throwCmdLineError . showSDoc dflags throwCmdLineError :: String -> IO a throwCmdLineError = throwGhcExceptionIO . CmdLineError - -#else - -pluginError :: [ModuleName] -> a -pluginError modnames = throwGhcException (CmdLineError msg) - where - msg = "not built for interactive use - can't load plugins (" - -- module names are not z-encoded - ++ intercalate ", " (map moduleNameString modnames) - ++ ")" - -#endif diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index d534fab1d5..bd984618a4 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -22,6 +22,7 @@ module HeaderInfo ( getImports import GhcPrelude +import GHC.Platform import HscTypes import Parser ( parseHeader ) import Lexer @@ -306,10 +307,12 @@ checkExtension :: DynFlags -> Located FastString -> Located String checkExtension dflags (dL->L l ext) -- Checks if a given extension is valid, and if so returns -- its corresponding flag. Otherwise it throws an exception. - = let ext' = unpackFS ext in - if ext' `elem` supportedLanguagesAndExtensions + = if ext' `elem` supported then cL l ("-X"++ext') else unsupportedExtnError dflags l ext' + where + ext' = unpackFS ext + supported = supportedLanguagesAndExtensions $ platformMini $ targetPlatform dflags languagePragParseError :: DynFlags -> SrcSpan -> a languagePragParseError dflags loc = @@ -325,7 +328,8 @@ unsupportedExtnError dflags loc unsup = text "Unsupported extension: " <> text unsup $$ if null suggestions then Outputable.empty else text "Perhaps you meant" <+> quotedListWithOr (map text suggestions) where - suggestions = fuzzyMatch unsup supportedLanguagesAndExtensions + supported = supportedLanguagesAndExtensions $ platformMini $ targetPlatform dflags + suggestions = fuzzyMatch unsup supported optionsErrorMsgs :: DynFlags -> [String] -> [Located String] -> FilePath -> Messages diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index f2f0685159..3ec24a7a6d 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -211,8 +211,6 @@ rnExpr (NegApp _ e _) ------------------------------------------ -- Template Haskell extensions --- Don't ifdef-HAVE_INTERPRETER them because we want to fail gracefully --- (not with an rnExpr crash) in a stage-1 compiler. rnExpr e@(HsBracket _ br_body) = rnBracket e br_body rnExpr (HsSpliceE _ splice) = rnSpliceExpr splice diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 572084c420..b3af87b2af 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -462,11 +462,7 @@ doCorePass (CoreDoRuleCheck phase pat) = ruleCheckPass phase pat doCorePass CoreDoNothing = return doCorePass (CoreDoPasses passes) = runCorePasses passes -#if defined(HAVE_INTERPRETER) doCorePass (CoreDoPluginPass _ pass) = {-# SCC "Plugin" #-} pass -#else -doCorePass pass@CoreDoPluginPass {} = pprPanic "doCorePass" (ppr pass) -#endif doCorePass pass@CoreDesugar = pprPanic "doCorePass" (ppr pass) doCorePass pass@CoreDesugarOpt = pprPanic "doCorePass" (ppr pass) diff --git a/compiler/typecheck/TcPluginM.hs b/compiler/typecheck/TcPluginM.hs index 3785a4aac5..f4fe3013a3 100644 --- a/compiler/typecheck/TcPluginM.hs +++ b/compiler/typecheck/TcPluginM.hs @@ -3,7 +3,6 @@ -- access select functions of the 'TcM', principally those to do with -- reading parts of the state. module TcPluginM ( -#if defined(HAVE_INTERPRETER) -- * Basic TcPluginM functionality TcPluginM, tcPluginIO, @@ -49,10 +48,8 @@ module TcPluginM ( newEvVar, setEvBind, getEvBindsTcPluginM -#endif ) where -#if defined(HAVE_INTERPRETER) import GhcPrelude import qualified TcRnMonad as TcM @@ -190,7 +187,3 @@ setEvBind :: EvBind -> TcPluginM () setEvBind ev_bind = do tc_evbinds <- getEvBindsTcPluginM unsafeTcPluginTcM $ TcM.addTcEvBind tc_evbinds ev_bind -#else --- this dummy import is needed as a consequence of NoImplicitPrelude -import GhcPrelude () -#endif |