- CmmLit (CmmLabel lbl) | not (isMathFun lbl) ->
- ptext (sLit ";EI_(") <+> pprCLabel lbl <> char ')' <> semi
- -- we declare all called functions as data labels,
- -- and then cast them to the right type when calling.
- -- This is because the label might already have a
- -- declaration as a data label in the same file,
- -- e.g. Foreign.Marshal.Alloc declares 'free' as
- -- both a data label and a function label.
+ CmmLit (CmmLabel lbl)
+ | StdCallConv <- cconv -> (real_fun_proto lbl, pprCLabel lbl)
+ -- stdcall functions must be declared with
+ -- a function type, otherwise the C compiler
+ -- doesn't add the @n suffix to the label. We
+ -- can't add the @n suffix ourselves, because
+ -- it isn't valid C.
+ | CmmNeverReturns <- ret -> (real_fun_proto lbl, pprCLabel lbl)
+ | not (isMathFun lbl) -> (data_proto lbl, cast_fn)
+ -- we declare all other called functions as
+ -- data labels, and then cast them to the
+ -- right type when calling. This is because
+ -- the label might already have a declaration
+ -- as a data label in the same file,
+ -- e.g. Foreign.Marshal.Alloc declares 'free'
+ -- as both a data label and a function label.