From 31caa091ba19b8216dc7d26cfc47530c860514fa Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 9 Mar 2018 11:07:39 +0100 Subject: StructPassing: do not transform arguments to annotation built-ins Make sure struct/union arguments to __builtin_annot and related builtins are always passed by reference using the default passing mode, regardless of the ABI for passing struct/unions to "real" functions. This ensures portability of annotations across ABIs, and avoids mismatches between the annotation text and the actual number of arguments (when a struct/union argument is passed as N integer arguments). A similar special case already existed for __builtin_va_arg. --- cparser/StructPassing.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cparser/StructPassing.ml') diff --git a/cparser/StructPassing.ml b/cparser/StructPassing.ml index 3de05e19..e431d9f9 100644 --- a/cparser/StructPassing.ml +++ b/cparser/StructPassing.ml @@ -323,8 +323,12 @@ and transf_call env ctx opt_lhs fn args ty = | None -> e | Some lhs -> eassign lhs e in match fn with - | {edesc = EVar {C.name = "__builtin_va_arg"}} -> - (* Do not transform the call in this case *) + | {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} | _ -> let call = -- cgit