diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 22 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ec60ed3..b59be5e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2019-03-08 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/89550 + * c-decl.c (finish_function): Only set TREE_NO_WARNING if warning_at + returned true. + (c_write_global_declarations_1): Only set TREE_NO_WARNING if pedwarn + or warning returned true. + 2019-02-28 Jakub Jelinek <jakub@redhat.com> PR c/89525 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 69c04d5..32ec183 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -9664,12 +9664,10 @@ finish_function (void) && !C_FUNCTION_IMPLICIT_INT (fndecl) /* Normally, with -Wreturn-type, flow will complain, but we might optimize out static functions. */ - && !TREE_PUBLIC (fndecl)) - { - warning (OPT_Wreturn_type, - "no return statement in function returning non-void"); - TREE_NO_WARNING (fndecl) = 1; - } + && !TREE_PUBLIC (fndecl) + && warning (OPT_Wreturn_type, + "no return statement in function returning non-void")) + TREE_NO_WARNING (fndecl) = 1; /* Complain about parameters that are only set, but never otherwise used. */ if (warn_unused_but_set_parameter) @@ -11486,17 +11484,19 @@ c_write_global_declarations_1 (tree globals) { if (C_DECL_USED (decl)) { - pedwarn (input_location, 0, "%q+F used but never defined", decl); - TREE_NO_WARNING (decl) = 1; + if (pedwarn (input_location, 0, "%q+F used but never defined", + decl)) + TREE_NO_WARNING (decl) = 1; } /* For -Wunused-function warn about unused static prototypes. */ else if (warn_unused_function && ! DECL_ARTIFICIAL (decl) && ! TREE_NO_WARNING (decl)) { - warning (OPT_Wunused_function, - "%q+F declared %<static%> but never defined", decl); - TREE_NO_WARNING (decl) = 1; + if (warning (OPT_Wunused_function, + "%q+F declared %<static%> but never defined", + decl)) + TREE_NO_WARNING (decl) = 1; } } |