diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2008-09-30 09:52:41 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2008-09-30 09:52:41 +0000 |
commit | 626c34b5c945cc9c577bd0509d297b81df083d3f (patch) | |
tree | 550e5d90532796178dbba4eb2e6ff1c54828d12c /gcc/c-common.c | |
parent | b5d60b839fd858c794384f4e6bf18005211e7add (diff) | |
download | gcc-626c34b5c945cc9c577bd0509d297b81df083d3f.zip gcc-626c34b5c945cc9c577bd0509d297b81df083d3f.tar.gz gcc-626c34b5c945cc9c577bd0509d297b81df083d3f.tar.bz2 |
c-common.c (empty_if_body_warning): Remove.
2008-09-30 Paolo Bonzini <bonzini@gnu.org>
* c-common.c (empty_if_body_warning): Remove.
* c-common.h (empty_if_body_warning): Remove.
* c-parser.c (c_parser_if_body, c_parser_else_body): Implement
here the -Wempty-body warning for `if' and `else' statements.
* c-typeck.c (c_finish_if_stmt): Do not call empty_body_warning.
cp:
2008-09-30 Paolo Bonzini <bonzini@gnu.org>
* parser.c (cp_parser_selection_statement): Implement here the
-Wempty-body warning for `if' and `else' statements.
* semantics.c (finish_if_stmt): Do not call empty_body_warning.
testsuite:
2008-09-30 Paolo Bonzini <bonzini@gnu.org>
* g++.dg/warn/if-empty-1.C: Copy from gcc.dg/if-empty-1.c.
From-SVN: r140780
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 5d69211..7665b62 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1291,31 +1291,6 @@ strict_aliasing_warning (tree otype, tree type, tree expr) return false; } -/* Print a warning about if (); or if () .. else; constructs - via the special empty statement node that we create. INNER_THEN - and INNER_ELSE are the statement lists of the if and the else - block. */ - -void -empty_if_body_warning (tree inner_then, tree inner_else) -{ - if (TREE_CODE (inner_then) == STATEMENT_LIST - && STATEMENT_LIST_TAIL (inner_then)) - inner_then = STATEMENT_LIST_TAIL (inner_then)->stmt; - - if (inner_else && TREE_CODE (inner_else) == STATEMENT_LIST - && STATEMENT_LIST_TAIL (inner_else)) - inner_else = STATEMENT_LIST_TAIL (inner_else)->stmt; - - if (IS_EMPTY_STMT (inner_then) && !inner_else) - warning (OPT_Wempty_body, "%Hsuggest braces around empty body " - "in an %<if%> statement", EXPR_LOCUS (inner_then)); - - else if (inner_else && IS_EMPTY_STMT (inner_else)) - warning (OPT_Wempty_body, "%Hsuggest braces around empty body " - "in an %<else%> statement", EXPR_LOCUS (inner_else)); -} - /* Warn for unlikely, improbable, or stupid DECL declarations of `main'. */ |