Skip to content

Commit

Permalink
Check MIN_VERSION_ghc instead
Browse files Browse the repository at this point in the history
Using `__GLASGOW_HASKELL__` goes wrong during cross-compilation, when we do

```
../9.10.1/bin/ghc .. '-package-id ghc-9.13-inplace' ..
```
  • Loading branch information
edsko committed Jan 12, 2025
1 parent 4416b54 commit 3b1dd76
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions trace-foreign-calls/src/Plugin/TraceForeignCalls/GHC/Shim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import GHC.Tc.Utils.Monad (TcGblEnv)
import Plugin.TraceForeignCalls.GHC.Util

mkLambda :: [LPat GhcRn] -> LHsExpr GhcRn -> LHsExpr GhcRn
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
mkLambda = mkHsLam . noLocValue
#else
mkLambda = mkHsLam
Expand All @@ -33,13 +33,13 @@ mkSimpleFunRhs name = FunRhs {
mc_fun = name
, mc_fixity = Prefix
, mc_strictness = NoSrcStrict
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
, mc_an = AnnFunRhs NoEpTok [] []
#endif
}

mkValBinds :: [(RecFlag, [LHsBind GhcRn])] -> [LSig GhcRn] -> HsValBinds GhcRn
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
mkValBinds bindingGroups sigs =
XValBindsLR $
NValBinds bindingGroups sigs
Expand All @@ -53,7 +53,7 @@ extendValBinds ::
[(RecFlag, [LHsBind GhcRn])]
-> [LSig GhcRn]
-> HsValBinds GhcRn -> HsValBinds GhcRn
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
extendValBinds newBindingGroups newSigs old =
case old of
XValBindsLR (NValBinds oldGroups oldSigs) ->
Expand Down Expand Up @@ -88,13 +88,13 @@ mkSimpleFunBind name freeVars args body = noLocValue $ FunBind {
mg_ext = Generated OtherExpansion SkipPmc
, mg_alts = noLocValue . map noLocValue $ [
Match {
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
m_ext = noValue
#else
m_ext = noAnn
#endif
#endif
, m_ctxt = mkSimpleFunRhs name
#if __GLASGOW_HASKELL__ >= 912
#if MIN_VERSION_ghc(9,12,1)
, m_pats = noLocValue $ map namedVarPat args
#else
, m_pats = map namedVarPat args
Expand Down

0 comments on commit 3b1dd76

Please sign in to comment.