diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-02-24 21:41:54 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-02-24 21:41:54 +0100 |
commit | 4227c9adf01d5ada5eb7c868aa104167c2a01983 (patch) | |
tree | 29e5c16f08052689b4d790b7167660e37137ba27 /gcc/c | |
parent | 5713d448534698c8ac23aa52f015b2c88185cb40 (diff) | |
download | gcc-4227c9adf01d5ada5eb7c868aa104167c2a01983.zip gcc-4227c9adf01d5ada5eb7c868aa104167c2a01983.tar.gz gcc-4227c9adf01d5ada5eb7c868aa104167c2a01983.tar.bz2 |
re PR c++/79588 (ICE in warn_for_restrict with -Wrestrict)
PR c++/79588
c-family/
* c-common.c (check_function_restrict): New function.
(check_function_arguments): Add FNDECL argument. Call
check_function_restrict if -Wrestrict.
* c-warn.c (warn_for_restrict): Remove ARGS argument, add ARGARRAY
and NARGS. Use auto_vec for ARG_POSITIONS, simplify.
* c-common.h (check_function_arguments): Add FNDECL argument.
(warn_for_restrict): Remove ARGS argument, add ARGARRAY and NARGS.
c/
* c-parser.c (c_parser_postfix_expression_after_primary): Don't
handle -Wrestrict here.
* c-typeck.c (build_function_call_vec): Adjust
check_function_arguments caller.
cp/
* call.c (build_over_call): Call check_function_arguments even for
-Wrestrict, adjust check_function_arguments caller.
* parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
here.
* typeck.c (cp_build_function_call_vec): Adjust
check_function_arguments caller.
testsuite/
* g++.dg/warn/Wrestrict-1.C: New test.
* g++.dg/warn/Wrestrict-2.C: New test.
From-SVN: r245719
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 22 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 3 |
3 files changed, 10 insertions, 23 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 70cfdc2..699def0 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2017-02-24 Jakub Jelinek <jakub@redhat.com> + + PR c++/79588 + * c-parser.c (c_parser_postfix_expression_after_primary): Don't + handle -Wrestrict here. + * c-typeck.c (build_function_call_vec): Adjust + check_function_arguments caller. + 2017-02-23 Richard Biener <rguenther@suse.de> PR c/79684 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 968c1dc..34585b9 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -8418,28 +8418,6 @@ c_parser_postfix_expression_after_primary (c_parser *parser, warn_for_memset (expr_loc, arg0, arg2, literal_zero_mask); } - if (TREE_CODE (expr.value) == FUNCTION_DECL && warn_restrict) - { - unsigned i; - tree arg; - FOR_EACH_VEC_SAFE_ELT (exprlist, i, arg) - TREE_VISITED (arg) = 0; - - unsigned param_pos = 0; - function_args_iterator iter; - tree t; - FOREACH_FUNCTION_ARGS (TREE_TYPE (expr.value), t, iter) - { - if (POINTER_TYPE_P (t) && TYPE_RESTRICT (t) - && !TYPE_READONLY (TREE_TYPE (t))) - warn_for_restrict (param_pos, exprlist); - param_pos++; - } - - FOR_EACH_VEC_SAFE_ELT (exprlist, i, arg) - TREE_VISITED (arg) = 0; - } - start = expr.get_start (); finish = parser->tokens_buf[0].get_finish (); expr.value diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 8c2c561..b4f61b0 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3110,7 +3110,8 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc, return error_mark_node; /* Check that the arguments to the function are valid. */ - bool warned_p = check_function_arguments (loc, fntype, nargs, argarray); + bool warned_p = check_function_arguments (loc, fundecl, fntype, + nargs, argarray); if (name != NULL_TREE && !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10)) |