From 8d7c806e16b98781a3762b5680b4dc64764da1b8 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sat, 28 Dec 2013 08:47:43 +0000 Subject: Simpler, more robust emulation of calls to variadic functions: - C function types and Cminor signatures annotated by calling conventions. esp. vararg / not vararg - Cshmgen: generate correct code for function call where there are more arguments than listed in the function prototype. This is still undefined behavior according to the formal semantics, but correct code is generated. - C2C, */PrintAsm.ml: remove "printf$iif" hack. - powerpc/, checklink/: don't generate stubs for variadic functions. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2386 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- backend/PrintCminor.ml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'backend/PrintCminor.ml') diff --git a/backend/PrintCminor.ml b/backend/PrintCminor.ml index 33c38f5..4c53c5e 100644 --- a/backend/PrintCminor.ml +++ b/backend/PrintCminor.ml @@ -172,12 +172,13 @@ let name_of_type = function | Tlong -> "long" | Tsingle -> "single" -let rec print_sig p = function - | {sig_args = []; sig_res = None} -> fprintf p "void" - | {sig_args = []; sig_res = Some ty} -> fprintf p "%s" (name_of_type ty) - | {sig_args = t1 :: tl; sig_res = tres} -> - fprintf p "%s ->@ " (name_of_type t1); - print_sig p {sig_args = tl; sig_res = tres} +let print_sig p sg = + List.iter + (fun t -> fprintf p "%s ->@ " (name_of_type t)) + sg.sig_args; + match sg.sig_res with + | None -> fprintf p "void" + | Some ty -> fprintf p "%s" (name_of_type ty) let rec just_skips s = match s with -- cgit v1.2.3