diff options
| -rw-r--r-- | compiler/cmm/PprC.hs | 2 | ||||
| -rw-r--r-- | compiler/deSugar/DsForeign.lhs | 5 | ||||
| -rw-r--r-- | compiler/prelude/ForeignCall.lhs | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index a2ffd18649..fc97be214e 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -254,7 +254,7 @@ pprStmt platform stmt = case stmt of pprCFunType :: SDoc -> CCallConv -> [HintedCmmFormal] -> [HintedCmmActual] -> SDoc pprCFunType ppr_fn cconv ress args = res_type ress <+> - parens (text (ccallConvAttribute cconv) <> ppr_fn) <> + parens (ccallConvAttribute cconv <> ppr_fn) <> parens (commafy (map arg_type args)) where res_type [] = ptext (sLit "void") diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs index 318d1df44b..75c2dc4418 100644 --- a/compiler/deSugar/DsForeign.lhs +++ b/compiler/deSugar/DsForeign.lhs @@ -509,10 +509,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc int64TyConKey, word64TyConKey] -- Now we can cook up the prototype for the exported function. - pprCconv = case cc of - CCallConv -> empty - StdCallConv -> text (ccallConvAttribute cc) - _ -> panic ("mkFExportCBits/pprCconv " ++ showPpr cc) + pprCconv = ccallConvAttribute cc header_bits = ptext (sLit "extern") <+> fun_proto <> semi diff --git a/compiler/prelude/ForeignCall.lhs b/compiler/prelude/ForeignCall.lhs index 5e0f9ec5c0..458e7c6747 100644 --- a/compiler/prelude/ForeignCall.lhs +++ b/compiler/prelude/ForeignCall.lhs @@ -175,9 +175,9 @@ Generate the gcc attribute corresponding to the given calling convention (used by PprAbsC): \begin{code} -ccallConvAttribute :: CCallConv -> String -ccallConvAttribute StdCallConv = "__attribute__((__stdcall__))" -ccallConvAttribute CCallConv = "" +ccallConvAttribute :: CCallConv -> SDoc +ccallConvAttribute StdCallConv = text "__attribute__((__stdcall__))" +ccallConvAttribute CCallConv = empty ccallConvAttribute (CmmCallConv {}) = panic "ccallConvAttribute CmmCallConv" ccallConvAttribute (PrimCallConv {}) = panic "ccallConvAttribute PrimCallConv" \end{code} |
