diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-05-06 18:49:33 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-11 18:40:37 -0400 |
commit | 39f50bff3ea913a7f4b1d915660bcf77b9327e2e (patch) | |
tree | 333057c89bb94838cd12cf03deb7e7a5dda83339 /compiler/ghci | |
parent | fe7e7e4a950a77326cc16f4ade30a67d20d7cdd5 (diff) | |
download | haskell-39f50bff3ea913a7f4b1d915660bcf77b9327e2e.tar.gz |
Refine the GHCI macro into HAVE[_{INTERNAL, EXTERNAL}]_INTERPRETER
As discussed in #16331, the GHCI macro, defined through 'ghci' flags
in ghc.cabal.in, ghc-bin.cabal.in and ghci.cabal.in, is supposed to indicate
whether GHC is built with support for an internal interpreter, that runs in
the same process. It is however overloaded in a few places to mean
"there is an interpreter available", regardless of whether it's an internal
or external interpreter.
For the sake of clarity and with the hope of more easily being able to
build stage 1 GHCs with external interpreter support, this patch splits
the previous GHCI macro into 3 different ones:
- HAVE_INTERNAL_INTERPRETER: GHC is built with an internal interpreter
- HAVE_EXTERNAL_INTERPRETER: GHC is built with support for external interpreters
- HAVE_INTERPRETER: HAVE_INTERNAL_INTERPRETER || HAVE_EXTERNAL_INTERPRETER
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/GHCi.hs | 10 |
1 files changed, 5 insertions, 5 deletions
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 |