aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-12-04 10:29:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2001-12-04 10:29:54 +0100
commit108b7d3d316599861369de7c7f9bfaef915c7bd3 (patch)
tree27efd51a80236ef18a93dcf862e04a438428403d /gcc/function.c
parent5402e639e2ab451ded1157f210909f42d1441e89 (diff)
downloadgcc-108b7d3d316599861369de7c7f9bfaef915c7bd3.zip
gcc-108b7d3d316599861369de7c7f9bfaef915c7bd3.tar.gz
gcc-108b7d3d316599861369de7c7f9bfaef915c7bd3.tar.bz2
function.c (assign_parms): Set last_named only for last named argument.
* function.c (assign_parms): Set last_named only for last named argument. * g++.dg/other/stdarg1.C: New test. From-SVN: r47601
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 04f8ca6..653e2ab 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