diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-06 20:07:13 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-06 20:07:13 +0000 |
commit | 81a3c55b173b6ff739a91b79708bf0d4585fd8db (patch) | |
tree | 26cc76717919b282649ef97b4afa9424d824fe86 /gcc/tree-cfg.c | |
parent | 6bc321812286a167f574776b501e7f3efffa5851 (diff) | |
download | gcc-81a3c55b173b6ff739a91b79708bf0d4585fd8db.tar.gz |
PR c/23075
* c-typeck.c (c_finish_return): Set TREE_NO_WARNING on RETURN_EXPR
if "return with no value, in function returning non-void" warning
has been issued.
* tree-cfg.c (execute_warn_function_return): Don't look at
RETURN_EXPRs with TREE_NO_WARNING set.
* typeck.c (check_return_expr): Add no_warning argument. Set
*no_warning to true if "return-statement with no value, in function
returning" warning has been issued.
* cp-tree.h (check_return_expr): Adjust prototype.
* semantics.c (finish_return_stmt): Set TREE_NO_WARNING if
check_return_expr set *no_warning to true.
* gcc.dg/pr23075.c: New test.
* g++.dg/warn/pr23075.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103967 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index df97058afe2..37115562974 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5125,7 +5125,8 @@ execute_warn_function_return (void) { tree last = last_stmt (e->src); if (TREE_CODE (last) == RETURN_EXPR - && TREE_OPERAND (last, 0) == NULL) + && TREE_OPERAND (last, 0) == NULL + && !TREE_NO_WARNING (last)) { #ifdef USE_MAPPED_LOCATION location = EXPR_LOCATION (last); |