From 66dcb747e8ba1f0ed6e0d49ed3d842b3e091609d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 28 Feb 2019 08:17:49 +0100 Subject: re PR c/89525 (inform messages from -Wbuiltin-declaration-mismatch even with -w) PR c/89525 * c-typeck.c (convert_arguments): Call inform_declaration only if the previous warning_at call returned true. * gcc.dg/pr89525.c: New test. From-SVN: r269274 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-typeck.c | 18 ++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 6b26ca0..ec60ed3 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2019-02-28 Jakub Jelinek + + PR c/89525 + * c-typeck.c (convert_arguments): Call inform_declaration only if + the previous warning_at call returned true. + 2019-02-22 Thomas Schwinge * c-parser.c (c_parser_oacc_shape_clause): Add loc formal diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 4811200..2de4d0f 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3509,12 +3509,10 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, if (builtin_type == void_type_node) { - warning_at (loc, OPT_Wbuiltin_declaration_mismatch, - "too many arguments to built-in function %qE " - "expecting %d", - function, parmnum); - - inform_declaration (fundecl); + if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, + "too many arguments to built-in function %qE " + "expecting %d", function, parmnum)) + inform_declaration (fundecl); builtin_typetail = NULL_TREE; } @@ -3651,10 +3649,10 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, for (tree t = builtin_typetail; t; t = TREE_CHAIN (t)) ++nargs; - warning_at (loc, OPT_Wbuiltin_declaration_mismatch, - "too few arguments to built-in function %qE expecting %u", - function, nargs - 1); - inform_declaration (fundecl); + if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch, + "too few arguments to built-in function %qE " + "expecting %u", function, nargs - 1)) + inform_declaration (fundecl); } return error_args ? -1 : (int) parmnum; -- cgit v1.1