diff options
author | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-23 14:20:49 +0000 |
---|---|---|
committer | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-23 14:20:49 +0000 |
commit | 774e9d58f907675e2bbf86307f3311f05665f134 (patch) | |
tree | b9bfe00973240a820a89bed01fbb2ba41bc453ca /gcc | |
parent | e54d36c4826a4f567945ac4a962618bb9286d06b (diff) | |
download | gcc-774e9d58f907675e2bbf86307f3311f05665f134.tar.gz |
don't use TYPE_ARG_TYPES when calling c-family:check_function_arguments
gcc/
* c-typeck.c (build_function_call_vec): Tweak call to
check_function_arguments.
gcc/c-family/
* c-common.h (check_function_arguments): Tweak prototype of
check_function_arguments.
* c-common.c (check_function_arguments): Likewise. Adjust
calls to check_function_nonnull, check_function_format, and
check_function_sentinel.
(check_function_sentinel): Take a FUNCTION_TYPE rather than
separate attributes and typelist arguments. Use
FOREACH_FUNCTION_ARGS to iterate over argument types.
gcc/cp/
* call.c (build_over_call): Tweak call to check_function_arguments.
* typeck.c (cp_build_function_call_vec): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174067 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 25 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 2 | ||||
-rw-r--r-- | gcc/c-typeck.c | 3 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 3 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 3 |
8 files changed, 38 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62990819dbf..d045f3f5f92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-23 Nathan Froyd <froydnj@codesourcery.com> + + * c-typeck.c (build_function_call_vec): Tweak call to + check_function_arguments. + 2011-05-23 Richard Guenther <rguenther@suse.de> PR tree-optimization/49115 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 7fa73314501..5044c076833 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2011-05-23 Nathan Froyd <froydnj@codesourcery.com> + + * c-common.h (check_function_arguments): Tweak prototype of + check_function_arguments. + * c-common.c (check_function_arguments): Likewise. Adjust + calls to check_function_nonnull, check_function_format, and + check_function_sentinel. + (check_function_sentinel): Take a FUNCTION_TYPE rather than + separate attributes and typelist arguments. Use + FOREACH_FUNCTION_ARGS to iterate over argument types. + 2011-05-15 Paolo Carlini <paolo.carlini@oracle.com> * c-common.c (c_common_reswords): Reorder. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 8fc68eb6fea..fef8ded203f 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7479,20 +7479,23 @@ check_function_nonnull (tree attrs, int nargs, tree *argarray) array ARGARRAY. */ static void -check_function_sentinel (tree attrs, int nargs, tree *argarray, tree typelist) +check_function_sentinel (const_tree fntype, int nargs, tree *argarray) { - tree attr = lookup_attribute ("sentinel", attrs); + tree attr = lookup_attribute ("sentinel", TYPE_ATTRIBUTES (fntype)); if (attr) { int len = 0; int pos = 0; tree sentinel; + function_args_iterator iter; + tree t; /* Skip over the named arguments. */ - while (typelist && len < nargs) + FOREACH_FUNCTION_ARGS (fntype, t, iter) { - typelist = TREE_CHAIN (typelist); + if (len == nargs) + break; len++; } @@ -7937,26 +7940,24 @@ handle_no_split_stack_attribute (tree *node, tree name, return NULL_TREE; } -/* Check for valid arguments being passed to a function. - ATTRS is a list of attributes. There are NARGS arguments in the array - ARGARRAY. TYPELIST is the list of argument types for the function. - */ +/* Check for valid arguments being passed to a function with FNTYPE. + There are NARGS arguments in the array ARGARRAY. */ void -check_function_arguments (tree attrs, int nargs, tree *argarray, tree typelist) +check_function_arguments (const_tree fntype, int nargs, tree *argarray) { /* Check for null being passed in a pointer argument that must be non-null. We also need to do this if format checking is enabled. */ if (warn_nonnull) - check_function_nonnull (attrs, nargs, argarray); + check_function_nonnull (TYPE_ATTRIBUTES (fntype), nargs, argarray); /* Check for errors in format strings. */ if (warn_format || warn_missing_format_attribute) - check_function_format (attrs, nargs, argarray); + check_function_format (TYPE_ATTRIBUTES (fntype), nargs, argarray); if (warn_format) - check_function_sentinel (attrs, nargs, argarray, typelist); + check_function_sentinel (fntype, nargs, argarray); } /* Generic argument checking recursion routine. PARAM is the argument to diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 7136b017dcb..89d4b80bded 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -687,7 +687,7 @@ extern void finish_fname_decls (void); extern const char *fname_as_string (int); extern tree fname_decl (location_t, unsigned, tree); -extern void check_function_arguments (tree, int, tree *, tree); +extern void check_function_arguments (const_tree, int, tree *); extern void check_function_arguments_recurse (void (*) (void *, tree, unsigned HOST_WIDE_INT), diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6016db2783f..e609611ab58 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2808,8 +2808,7 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params, return error_mark_node; /* Check that the arguments to the function are valid. */ - check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, - TYPE_ARG_TYPES (fntype)); + check_function_arguments (fntype, nargs, argarray); if (name != NULL_TREE && !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 20c98083e9f..168f43a245d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-23 Nathan Froyd <froydnj@codesourcery.com> + + * call.c (build_over_call): Tweak call to check_function_arguments. + * typeck.c (cp_build_function_call_vec): Likewise. + 2011-05-23 Jonathan Wakely <jwakely.gcc@gmail.com> PR c++/18016 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 09ad4aea25e..972dca376ee 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6477,8 +6477,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) gcc_assert (j <= nargs); nargs = j; - check_function_arguments (TYPE_ATTRIBUTES (TREE_TYPE (fn)), - nargs, argarray, TYPE_ARG_TYPES (TREE_TYPE (fn))); + check_function_arguments (TREE_TYPE (fn), nargs, argarray); /* Avoid actually calling copy constructors and copy assignment operators, if possible. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index dd1cc3b127c..81ee63d7efd 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3271,8 +3271,7 @@ cp_build_function_call_vec (tree function, VEC(tree,gc) **params, /* Check for errors in format strings and inappropriately null parameters. */ - check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, - parm_types); + check_function_arguments (fntype, nargs, argarray); ret = build_cxx_call (function, nargs, argarray); |