diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-10-27 04:06:46 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-10-27 20:55:50 +0000 |
commit | 5a6f3c285b986891b8b56f8f1b29901892ca4e15 (patch) | |
tree | 55addb41e4608890c406b93456c4b02465cf060d /compiler | |
parent | 638f65482ca5265c268aa97abfcc14cdc27e46ba (diff) | |
download | haskell-wip/clean-compiler-includes.tar.gz |
Avoid GHC_STAGE and other include bitswip/clean-compiler-includes
We should strive to make our includes in terms of the RTS as much as
possible. One place there that is not possible, the llvm version, we
make a new tiny header
Stage numbers are somewhat arbitrary, if we simple need a newer RTS, we
should say so.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/CmmToLlvm/Base.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Data/FastString.hs | 12 | ||||
-rw-r--r-- | compiler/GHC/Driver/Pipeline.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Driver/Pipeline/Execute.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Utils/GlobalVars.hs | 5 | ||||
-rw-r--r-- | compiler/cbits/genSym.c | 5 | ||||
-rw-r--r-- | compiler/ghc-llvm-version.h.in | 12 | ||||
-rw-r--r-- | compiler/ghc.cabal.in | 1 |
8 files changed, 25 insertions, 15 deletions
diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs index 2095e3d606..33798acf72 100644 --- a/compiler/GHC/CmmToLlvm/Base.hs +++ b/compiler/GHC/CmmToLlvm/Base.hs @@ -39,7 +39,7 @@ module GHC.CmmToLlvm.Base ( aliasify, llvmDefLabel ) where -#include "ghcautoconf.h" +#include "ghc-llvm-version.h" import GHC.Prelude import GHC.Utils.Panic diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs index 262ddd3ada..1b2f21c415 100644 --- a/compiler/GHC/Data/FastString.hs +++ b/compiler/GHC/Data/FastString.hs @@ -111,9 +111,6 @@ module GHC.Data.FastString lengthPS ) where --- For GHC_STAGE -#include "ghcplatform.h" - import GHC.Prelude as Prelude import GHC.Utils.Encoding @@ -143,7 +140,7 @@ import Data.Semigroup as Semi import Foreign -#if GHC_STAGE >= 2 +#if MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) import GHC.Conc.Sync (sharedCAF) #endif @@ -384,13 +381,14 @@ stringTable = unsafePerformIO $ do -- use the support wired into the RTS to share this CAF among all images of -- libHSghc -#if GHC_STAGE < 2 +#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) return tab #else sharedCAF tab getOrSetLibHSghcFastStringTable --- from the RTS; thus we cannot use this mechanism when GHC_STAGE<2; the previous --- RTS might not have this symbol +-- from the 9.3 RTS; the previouss RTS before might not have this symbol. The +-- right way to do this however would be to define some HAVE_FAST_STRING_TABLE +-- or similar rather than use (odd parity) development versions. foreign import ccall unsafe "getOrSetLibHSghcFastStringTable" getOrSetLibHSghcFastStringTable :: Ptr a -> IO (Ptr a) #endif diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index 55b6a28970..53bf0333fb 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -48,7 +48,6 @@ module GHC.Driver.Pipeline ( ) where -#include "ghcplatform.h" import GHC.Prelude import GHC.Platform diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs index 25aac65d85..08a63c0125 100644 --- a/compiler/GHC/Driver/Pipeline/Execute.hs +++ b/compiler/GHC/Driver/Pipeline/Execute.hs @@ -5,7 +5,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GADTs #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} -#include "ghcplatform.h" +#include <ghcplatform.h> {- Functions for providing the default interpretation of the 'TPhase' actions -} diff --git a/compiler/GHC/Utils/GlobalVars.hs b/compiler/GHC/Utils/GlobalVars.hs index 19496d5d82..ad02bc45b1 100644 --- a/compiler/GHC/Utils/GlobalVars.hs +++ b/compiler/GHC/Utils/GlobalVars.hs @@ -22,9 +22,6 @@ module GHC.Utils.GlobalVars ) where --- For GHC_STAGE -#include "ghcplatform.h" - import GHC.Prelude import GHC.Conc.Sync ( sharedCAF ) @@ -60,7 +57,7 @@ foreign import ccall unsafe saccessor \ -#if GHC_STAGE < 2 +#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) GLOBAL_VAR(v_unsafeHasPprDebug, False, Bool) GLOBAL_VAR(v_unsafeHasNoDebugOutput, False, Bool) diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c index 19697de25e..9bdadc5a99 100644 --- a/compiler/cbits/genSym.c +++ b/compiler/cbits/genSym.c @@ -1,11 +1,14 @@ #include <Rts.h> #include <assert.h> #include "Unique.h" -#include "ghcversion.h" +#include <ghcversion.h> // These global variables have been moved into the RTS. It allows them to be // shared with plugins even if two different instances of the GHC library are // loaded at the same time (#19940) +// +// The CPP is thus about the RTS version GHC is linked against, and not the +// version of the GHC being built. #if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0) HsInt ghc_unique_counter = 0; HsInt ghc_unique_inc = 1; diff --git a/compiler/ghc-llvm-version.h.in b/compiler/ghc-llvm-version.h.in new file mode 100644 index 0000000000..241ce53e32 --- /dev/null +++ b/compiler/ghc-llvm-version.h.in @@ -0,0 +1,12 @@ +#if !defined(__GHC_LLVM_VERSION_H__) +#define __GHC_LLVM_VERSION_H__ + +/* The maximum supported LLVM version number */ +#undef sUPPORTED_LLVM_VERSION_MAX + +/* The minimum supported LLVM version number */ +#undef sUPPORTED_LLVM_VERSION_MIN + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef size_t +#endif /* __GHC_LLVM_VERSION_H__ */ diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index ed5851a667..e273110576 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -78,6 +78,7 @@ Library -- MachRegs.h -- hits #error, skip -- target sensative, should not be used MachDeps.h + ghc-llvm-version.h Build-Depends: base >= 4.11 && < 4.17, deepseq >= 1.4 && < 1.5, |