diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2003-09-06 13:34:00 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2003-09-06 13:34:00 +0000 |
commit | 03845b47e6a3519de3be01030abdaa20e3595983 (patch) | |
tree | 95933801fe9d7d8c2366530070824dbcb792e031 /gcc/c-decl.c | |
parent | b92bc2a028982a808589a187381095c158182446 (diff) | |
download | gcc-03845b47e6a3519de3be01030abdaa20e3595983.zip gcc-03845b47e6a3519de3be01030abdaa20e3595983.tar.gz gcc-03845b47e6a3519de3be01030abdaa20e3595983.tar.bz2 |
re PR c/9862 (spurious warnings with -W -finline-functions)
PR c/9862
* c-decl.c (c_expand_body_1): Move return warning from here...
(finish_function): ...to here.
* gcc.dg/20030906-1.c: New test.
* gcc.dg/20030906-2.c: Likewise.
From-SVN: r71134
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f16fe7c..f4896f3 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6129,6 +6129,13 @@ finish_function () && DECL_INLINE (fndecl)) warning ("no return statement in function returning non-void"); + /* With just -Wextra, complain only if function returns both with + and without a value. */ + if (extra_warnings + && current_function_returns_value + && current_function_returns_null) + warning ("this function may return with or without a value"); + /* We're leaving the context of this function, so zap cfun. It's still in DECL_SAVED_INSNS, and we'll restore it in tree_rest_of_compilation. */ cfun = NULL; @@ -6178,13 +6185,6 @@ c_expand_body_1 (tree fndecl, int nested_p) tree_rest_of_compilation (fndecl); - /* With just -Wextra, complain only if function returns both with - and without a value. */ - if (extra_warnings - && current_function_returns_value - && current_function_returns_null) - warning ("this function may return with or without a value"); - if (DECL_STATIC_CONSTRUCTOR (fndecl)) { if (targetm.have_ctors_dtors) |