summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-01-18 14:33:52 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-28 02:57:59 -0500
commit56c1bd986ac13e3a1fe1149f011480e44f857f5a (patch)
treec5cf6a50a461de93072b9f338f4381be8ed47ec1 /compiler/GHC/HsToCore
parent77fdbd3f7798ae7095a6a22c3674c08c86a91c6c (diff)
downloadhaskell-56c1bd986ac13e3a1fe1149f011480e44f857f5a.tar.gz
Revert "CApiFFI: add ConstPtr for encoding const-qualified pointer return types (#22043)"
This reverts commit 99aca26b652603bc62953157a48e419f737d352d.
Diffstat (limited to 'compiler/GHC/HsToCore')
-rw-r--r--compiler/GHC/HsToCore/Foreign/C.hs12
1 files changed, 2 insertions, 10 deletions
diff --git a/compiler/GHC/HsToCore/Foreign/C.hs b/compiler/GHC/HsToCore/Foreign/C.hs
index 28ef42e2b9..160e9acc97 100644
--- a/compiler/GHC/HsToCore/Foreign/C.hs
+++ b/compiler/GHC/HsToCore/Foreign/C.hs
@@ -246,18 +246,10 @@ dsFCall :: Id -> Coercion -> ForeignCall -> Maybe Header
-> DsM ([(Id, Expr TyVar)], CHeader, CStub)
dsFCall fn_id co fcall mDeclHeader = do
let
- (ty,ty1) = (coercionLKind co, coercionRKind co)
+ ty = coercionLKind co
(tv_bndrs, rho) = tcSplitForAllTyVarBinders ty
(arg_tys, io_res_ty) = tcSplitFunTys rho
- let constQual -- provide 'const' qualifier (#22034)
- | (_, res_ty1) <- tcSplitFunTys ty1
- , newty <- maybe res_ty1 snd (tcSplitIOType_maybe res_ty1)
- , Just (ptr, _) <- splitTyConApp_maybe newty
- , tyConName ptr `elem` [constPtrConName]
- = text "const"
- | otherwise = empty
-
args <- newSysLocalsDs arg_tys -- no FFI representation polymorphism
(val_args, arg_wrappers) <- mapAndUnzipM unboxArg (map Var args)
@@ -285,7 +277,7 @@ dsFCall fn_id co fcall mDeclHeader = do
includes = vcat [ text "#include \"" <> ftext h
<> text "\""
| Header _ h <- nub headers ]
- fun_proto = constQual <+> cResType <+> pprCconv <+> ppr wrapperName <> parens argTypes
+ fun_proto = cResType <+> pprCconv <+> ppr wrapperName <> parens argTypes
cRet
| isVoidRes = cCall
| otherwise = text "return" <+> cCall