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/main | |
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/main')
-rw-r--r-- | compiler/main/DynFlags.hs | 17 | ||||
-rw-r--r-- | compiler/main/DynamicLoading.hs | 38 | ||||
-rw-r--r-- | compiler/main/HeaderInfo.hs | 10 |
3 files changed, 15 insertions, 50 deletions
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 |