summaryrefslogtreecommitdiff
path: root/backend/PrintCminor.ml
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-28 08:47:43 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-28 08:47:43 +0000
commit8d7c806e16b98781a3762b5680b4dc64764da1b8 (patch)
tree82fb3ecd34e451e4e96f57e2103a694c9acc0830 /backend/PrintCminor.ml
parentad12162ff1f0d50c43afefc45e1593f27f197402 (diff)
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
Diffstat (limited to 'backend/PrintCminor.ml')
-rw-r--r--backend/PrintCminor.ml13
1 files changed, 7 insertions, 6 deletions
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