diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghc.cabal.in | 13 | ||||
-rw-r--r-- | compiler/ghci/GHCi.hs | 10 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 6 | ||||
-rw-r--r-- | compiler/main/DynamicLoading.hs | 8 | ||||
-rw-r--r-- | compiler/rename/RnExpr.hs | 2 | ||||
-rw-r--r-- | compiler/simplCore/SimplCore.hs | 2 | ||||
-rw-r--r-- | compiler/typecheck/TcAnnotations.hs | 2 | ||||
-rw-r--r-- | compiler/typecheck/TcPluginM.hs | 4 | ||||
-rw-r--r-- | compiler/utils/Util.hs | 2 |
9 files changed, 30 insertions, 19 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index e8e6bf7317..e1f0bec2b0 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -25,6 +25,11 @@ 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 @@ -90,9 +95,15 @@ Library -Wnoncanonical-monoid-instances if flag(ghci) - CPP-Options: -DGHCI + 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/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index 7ec07fec78..8795b30973 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -51,7 +51,7 @@ module GHCi import GhcPrelude import GHCi.Message -#if defined(GHCI) +#if defined(HAVE_INTERNAL_INTERPRETER) import GHCi.Run #endif import GHCi.RemoteTypes @@ -157,7 +157,7 @@ Other Notes on Remote GHCi * Note [Remote Template Haskell] in libraries/ghci/GHCi/TH.hs -} -#if !defined(GHCI) +#if !defined(HAVE_INTERNAL_INTERPRETER) needExtInt :: IO a needExtInt = throwIO (InstallationError "this operation requires -fexternal-interpreter") @@ -175,7 +175,7 @@ iservCmd hsc_env@HscEnv{..} msg uninterruptibleMask_ $ do -- Note [uninterruptibleMask_] iservCall iserv msg | otherwise = -- Just run it directly -#if defined(GHCI) +#if defined(HAVE_INTERNAL_INTERPRETER) run msg #else needExtInt @@ -391,7 +391,7 @@ lookupSymbol hsc_env@HscEnv{..} str writeIORef iservLookupSymbolCache $! addToUFM cache str p return (Just p) | otherwise = -#if defined(GHCI) +#if defined(HAVE_INTERNAL_INTERPRETER) fmap fromRemotePtr <$> run (LookupSymbol (unpackFS str)) #else needExtInt @@ -642,7 +642,7 @@ wormholeRef dflags _r | gopt Opt_ExternalInterpreter dflags = throwIO (InstallationError "this operation requires -fno-external-interpreter") -#if defined(GHCI) +#if defined(HAVE_INTERNAL_INTERPRETER) | otherwise = localRef _r #else diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5217fced5f..0b2b32d5bb 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -320,8 +320,8 @@ import qualified EnumSet import GHC.Foreign (withCString, peekCString) import qualified GHC.LanguageExtensions as LangExt -#if defined(GHCI) -import Foreign (Ptr) -- needed for 2nd stage +#if defined(HAVE_INTERPRETER) +import Foreign (Ptr) #endif -- Note [Updating flag description in the User's Guide] @@ -4342,7 +4342,7 @@ supportedExtensions :: [String] supportedExtensions = concatMap toFlagSpecNamePair xFlags where toFlagSpecNamePair flg -#if !defined(GHCI) +#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 diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs index 0a5264e3f2..64cc0a1216 100644 --- a/compiler/main/DynamicLoading.hs +++ b/compiler/main/DynamicLoading.hs @@ -3,7 +3,7 @@ -- | Dynamically lookup up values from modules and loading them. module DynamicLoading ( initializePlugins, -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) -- * Loading plugins loadFrontendPlugin, @@ -27,7 +27,7 @@ module DynamicLoading ( import GhcPrelude import DynFlags -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) import Linker ( linkModule, getHValue ) import GHCi ( wormhole ) import SrcLoc ( noSrcSpan ) @@ -76,7 +76,7 @@ import Control.Monad ( unless ) -- actual compilation starts. Idempotent operation. Should be re-called if -- pluginModNames or pluginModNameOpts changes. initializePlugins :: HscEnv -> DynFlags -> IO DynFlags -#if !defined(GHCI) +#if !defined(HAVE_INTERPRETER) initializePlugins _ df = do let pluginMods = pluginModNames df unless (null pluginMods) (pluginError pluginMods) @@ -96,7 +96,7 @@ initializePlugins hsc_env df #endif -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) loadPlugins :: HscEnv -> IO [LoadedPlugin] loadPlugins hsc_env diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 7b00a62403..98d487df2d 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -208,7 +208,7 @@ rnExpr (NegApp _ e _) ------------------------------------------ -- Template Haskell extensions --- Don't ifdef-GHCI them because we want to fail gracefully +-- 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 diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index ade9816a1b..572084c420 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -462,7 +462,7 @@ doCorePass (CoreDoRuleCheck phase pat) = ruleCheckPass phase pat doCorePass CoreDoNothing = return doCorePass (CoreDoPasses passes) = runCorePasses passes -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) doCorePass (CoreDoPluginPass _ pass) = {-# SCC "Plugin" #-} pass #else doCorePass pass@CoreDoPluginPass {} = pprPanic "doCorePass" (ppr pass) diff --git a/compiler/typecheck/TcAnnotations.hs b/compiler/typecheck/TcAnnotations.hs index 050c5db977..60f21ccce7 100644 --- a/compiler/typecheck/TcAnnotations.hs +++ b/compiler/typecheck/TcAnnotations.hs @@ -28,7 +28,7 @@ import Outputable -- Some platforms don't support the external interpreter, and -- compilation on those platforms shouldn't fail just due to -- annotations -#ifndef GHCI +#if !defined(HAVE_INTERNAL_INTERPRETER) tcAnnotations :: [LAnnDecl GhcRn] -> TcM [Annotation] tcAnnotations anns = do dflags <- getDynFlags diff --git a/compiler/typecheck/TcPluginM.hs b/compiler/typecheck/TcPluginM.hs index a112003ef9..3785a4aac5 100644 --- a/compiler/typecheck/TcPluginM.hs +++ b/compiler/typecheck/TcPluginM.hs @@ -3,7 +3,7 @@ -- access select functions of the 'TcM', principally those to do with -- reading parts of the state. module TcPluginM ( -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) -- * Basic TcPluginM functionality TcPluginM, tcPluginIO, @@ -52,7 +52,7 @@ module TcPluginM ( #endif ) where -#if defined(GHCI) +#if defined(HAVE_INTERPRETER) import GhcPrelude import qualified TcRnMonad as TcM diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index b9a138902f..5770f2ffdc 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -188,7 +188,7 @@ the flags are off. -} ghciSupported :: Bool -#if defined(GHCI) +#if defined(HAVE_INTERNAL_INTERPRETER) ghciSupported = True #else ghciSupported = False |