diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-07-18 08:22:50 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-07-18 08:22:50 +0000 |
commit | d119bf79862015d4ba3c7f8774835c216c9a26ed (patch) | |
tree | db4fe14a0e4fcf55af28f562d8bf0dc1ed398f2e /gcc/c/c-decl.c | |
parent | d1f2e4c1027b826cf3ba353e86c37589f63f8efe (diff) | |
download | gcc-d119bf79862015d4ba3c7f8774835c216c9a26ed.zip gcc-d119bf79862015d4ba3c7f8774835c216c9a26ed.tar.gz gcc-d119bf79862015d4ba3c7f8774835c216c9a26ed.tar.bz2 |
Fix -Wreturn-type for static naked functions in C
This patch extends the fix for PR53633 to include static functions,
which were giving a bogus -Wreturn-type warning for C but not for C++.
2019-07-18 Richard Sandiford <richard.sandiford@arm.com>
gcc/c/
PR c/53633
* c-decl.c (finish_function): Check targetm.warn_func_return
before issuing a -Wreturn-type warning.
gcc/testsuite/
* c-c++-common/pr53633-2.c: New test.
From-SVN: r273568
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d75648a..0d107ad 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -9687,6 +9687,7 @@ finish_function (void) /* Normally, with -Wreturn-type, flow will complain, but we might optimize out static functions. */ && !TREE_PUBLIC (fndecl) + && targetm.warn_func_return (fndecl) && warning (OPT_Wreturn_type, "no return statement in function returning non-void")) TREE_NO_WARNING (fndecl) = 1; |