From 3b1dd763f9576a70d559c920638bcc2ee3b4cbe7 Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Sun, 12 Jan 2025 14:25:11 +0100 Subject: [PATCH] Check `MIN_VERSION_ghc` instead Using `__GLASGOW_HASKELL__` goes wrong during cross-compilation, when we do ``` ../9.10.1/bin/ghc .. '-package-id ghc-9.13-inplace' .. ``` --- .../src/Plugin/TraceForeignCalls/GHC/Shim.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/trace-foreign-calls/src/Plugin/TraceForeignCalls/GHC/Shim.hs b/trace-foreign-calls/src/Plugin/TraceForeignCalls/GHC/Shim.hs index eb9741c..8905607 100644 --- a/trace-foreign-calls/src/Plugin/TraceForeignCalls/GHC/Shim.hs +++ b/trace-foreign-calls/src/Plugin/TraceForeignCalls/GHC/Shim.hs @@ -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 @@ -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 @@ -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) -> @@ -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