Commit 4b9be1db authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Small refactoring

parent 9bebd4ea
...@@ -254,7 +254,7 @@ pprStmt platform stmt = case stmt of ...@@ -254,7 +254,7 @@ pprStmt platform stmt = case stmt of
pprCFunType :: SDoc -> CCallConv -> [HintedCmmFormal] -> [HintedCmmActual] -> SDoc pprCFunType :: SDoc -> CCallConv -> [HintedCmmFormal] -> [HintedCmmActual] -> SDoc
pprCFunType ppr_fn cconv ress args pprCFunType ppr_fn cconv ress args
= res_type ress <+> = res_type ress <+>
parens (text (ccallConvAttribute cconv) <> ppr_fn) <> parens (ccallConvAttribute cconv <> ppr_fn) <>
parens (commafy (map arg_type args)) parens (commafy (map arg_type args))
where where
res_type [] = ptext (sLit "void") res_type [] = ptext (sLit "void")
......
...@@ -509,10 +509,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc ...@@ -509,10 +509,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
int64TyConKey, word64TyConKey] int64TyConKey, word64TyConKey]
-- Now we can cook up the prototype for the exported function. -- Now we can cook up the prototype for the exported function.
pprCconv = case cc of pprCconv = ccallConvAttribute cc
CCallConv -> empty
StdCallConv -> text (ccallConvAttribute cc)
_ -> panic ("mkFExportCBits/pprCconv " ++ showPpr cc)
header_bits = ptext (sLit "extern") <+> fun_proto <> semi header_bits = ptext (sLit "extern") <+> fun_proto <> semi
......
...@@ -175,9 +175,9 @@ Generate the gcc attribute corresponding to the given ...@@ -175,9 +175,9 @@ Generate the gcc attribute corresponding to the given
calling convention (used by PprAbsC): calling convention (used by PprAbsC):
\begin{code} \begin{code}
ccallConvAttribute :: CCallConv -> String ccallConvAttribute :: CCallConv -> SDoc
ccallConvAttribute StdCallConv = "__attribute__((__stdcall__))" ccallConvAttribute StdCallConv = text "__attribute__((__stdcall__))"
ccallConvAttribute CCallConv = "" ccallConvAttribute CCallConv = empty
ccallConvAttribute (CmmCallConv {}) = panic "ccallConvAttribute CmmCallConv" ccallConvAttribute (CmmCallConv {}) = panic "ccallConvAttribute CmmCallConv"
ccallConvAttribute (PrimCallConv {}) = panic "ccallConvAttribute PrimCallConv" ccallConvAttribute (PrimCallConv {}) = panic "ccallConvAttribute PrimCallConv"
\end{code} \end{code}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment