From a45ddea290008a8a340f3a2b076268e04f80bab4 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 9 Mar 2018 14:41:15 +0100 Subject: StructPassing and annotations, continued struct/union arguments to annotations should not be transformed at top level, but the regular function calls contained within must be transformed recursively. --- cparser/StructPassing.ml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cparser/StructPassing.ml') diff --git a/cparser/StructPassing.ml b/cparser/StructPassing.ml index 10aa6fd5..5c6454f0 100644 --- a/cparser/StructPassing.ml +++ b/cparser/StructPassing.ml @@ -317,23 +317,21 @@ let rec transf_expr env ctx e = and transf_call env ctx opt_lhs fn args ty = let ty' = transf_type env ty in let fn' = transf_expr env Val fn in - let (assignments, args') = transf_arguments env args in let opt_eassign e = match opt_lhs with | None -> e | Some lhs -> eassign lhs e in match fn with - | {edesc = EVar { C.name = "__builtin_annot" + | {edesc = EVar { C.name = "__builtin_va_arg" + | "__builtin_annot" | "__builtin_annot_intval" | "__builtin_ais_annot" } } -> - (* Do not transform the call in this case, just use the default - pass-by-reference mode for struct/union arguments. *) - opt_eassign {edesc = ECall(fn, args); etyp = ty} - | {edesc = EVar { C.name = "__builtin_va_arg" } } -> - (* Do not transform the call in this case, just use the default - pass-by-reference mode for struct/union arguments. *) - opt_eassign {edesc = ECall(fn, args'); etyp = ty} + (* Do not transform the call in this case, just use the default + pass-by-reference mode for struct/union arguments. *) + let args' = List.map (fun arg -> transf_expr env Val arg) args in + opt_eassign {edesc = ECall(fn, args'); etyp = ty} | _ -> + let (assignments, args') = transf_arguments env args in let call = match classify_return env ty with | Ret_scalar -> -- cgit