From 3b69d50e4d2746d462dc656e44a6f8c872daf943 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 6 Apr 1994 07:47:24 -0400 Subject: [PATCH] (push_function_context): Use current_function_varargs. (pop_function_context): Likewise. (assign_parms): Respect current_function_varargs. Save args_so_far in any case. From-SVN: r6983 --- gcc/function.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gcc/function.c b/gcc/function.c index 22ea58b6d49..8c9cc5f9eb5 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -456,6 +456,7 @@ push_function_context () p->args_size = current_function_args_size; p->pretend_args_size = current_function_pretend_args_size; p->arg_offset_rtx = current_function_arg_offset_rtx; + p->varargs = current_function_varargs; p->uses_const_pool = current_function_uses_const_pool; p->uses_pic_offset_table = current_function_uses_pic_offset_table; p->internal_arg_pointer = current_function_internal_arg_pointer; @@ -522,6 +523,7 @@ pop_function_context () current_function_args_size = p->args_size; current_function_pretend_args_size = p->pretend_args_size; current_function_arg_offset_rtx = p->arg_offset_rtx; + current_function_varargs = p->varargs; current_function_uses_const_pool = p->uses_const_pool; current_function_uses_pic_offset_table = p->uses_pic_offset_table; current_function_internal_arg_pointer = p->internal_arg_pointer; @@ -3062,8 +3064,9 @@ assign_parms (fndecl, second_time) /* Nonzero if the last arg is named `__builtin_va_alist', which is used on some machines for old-fashioned non-ANSI varargs.h; this should be stuck onto the stack as if it had arrived there. */ - int vararg - = (fnargs + int hide_last_arg + = (current_function_varargs + && fnargs && (parm = tree_last (fnargs)) != 0 && DECL_NAME (parm) && (! strcmp (IDENTIFIER_POINTER (DECL_NAME (parm)), @@ -3139,7 +3142,7 @@ assign_parms (fndecl, second_time) anonymous args. We treat it as if it were anonymous too. */ int last_named = ((TREE_CHAIN (parm) == 0 || DECL_NAME (TREE_CHAIN (parm)) == 0) - && (vararg || stdarg)); + && (stdarg || current_function_varargs)); if (TREE_TYPE (parm) == error_mark_node /* This can happen after weird syntax errors @@ -3155,7 +3158,7 @@ assign_parms (fndecl, second_time) /* For varargs.h function, save info about regs and stack space used by the individual args, not including the va_alist arg. */ - if (vararg && last_named) + if (hide_last_arg && last_named) current_function_args_info = args_so_far; /* Find mode of arg as it is passed, and mode of arg @@ -3784,10 +3787,10 @@ assign_parms (fndecl, second_time) current_function_pops_args = RETURN_POPS_ARGS (TREE_TYPE (fndecl), current_function_args_size); - /* For stdarg.h function, save info about regs and stack space - used by the named args. */ + /* For stdarg.h function, save info about + regs and stack space used by the named args. */ - if (stdarg) + if (!hide_last_arg) current_function_args_info = args_so_far; /* Set the rtx used for the function return value. Put this in its -- 2.30.2