summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-04 09:29:54 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-04 09:29:54 +0000
commitd06f5fba02544a6918059089574c3dfc4c01e2c6 (patch)
tree27efd51a80236ef18a93dcf862e04a438428403d /gcc/function.c
parentfb318f2f6a77e8d187e20cc7a7ff43e0b9a4fac5 (diff)
downloadgcc-d06f5fba02544a6918059089574c3dfc4c01e2c6.tar.gz
* function.c (assign_parms): Set last_named only for last named
argument. * g++.dg/other/stdarg1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 04f8ca62003..653e2abe140 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4307,16 +4307,25 @@ assign_parms (fndecl)
tree passed_type = DECL_ARG_TYPE (parm);
tree nominal_type = TREE_TYPE (parm);
int pretend_named;
+ int last_named = 0, named_arg;
- /* Set LAST_NAMED if this is last named arg before some
+ /* Set LAST_NAMED if this is last named arg before last
anonymous args. */
- int last_named = ((TREE_CHAIN (parm) == 0
- || DECL_NAME (TREE_CHAIN (parm)) == 0)
- && (stdarg || current_function_varargs));
+ if (stdarg || current_function_varargs)
+ {
+ tree tem;
+
+ for (tem = TREE_CHAIN (parm); tem; tem = TREE_CHAIN (tem))
+ if (DECL_NAME (tem))
+ break;
+
+ if (tem == 0)
+ last_named = 1;
+ }
/* Set NAMED_ARG if this arg should be treated as a named arg. For
most machines, if this is a varargs/stdarg function, then we treat
the last named arg as if it were anonymous too. */
- int named_arg = STRICT_ARGUMENT_NAMING ? 1 : ! last_named;
+ named_arg = STRICT_ARGUMENT_NAMING ? 1 : ! last_named;
if (TREE_TYPE (parm) == error_mark_node
/* This can happen after weird syntax errors