diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-16 16:48:01 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-16 16:48:01 +0000 |
commit | b321a57a315097c60d058fb02bc13d847ecac880 (patch) | |
tree | d673fa90f961dc743634330e431fadf58ca98b8b /gcc/c-parser.c | |
parent | 3369eb761be13d67e0c1e331eb2e900de4efaf91 (diff) | |
download | gcc-b321a57a315097c60d058fb02bc13d847ecac880.tar.gz |
2006-12-16 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651
* c.opt (Wempty-body): New.
* doc/invoke.texi (Wempty-body): Document it.
(Wextra): Enabled by -Wextra.
* c-opts.c (c_common_post_options): Enabled by -Wextra.
* c-common.c (empty_body_warning): Replace Wextra with Wempty-body.
* c-parser.c (c_parser_c99_block_statement): Likewise.
testsuite/
* gcc.dg/20001116-1.c: Replace -Wextra with -Wempty-body.
* gcc.dg/if-empty-1.c: Likewise.
* gcc.dg/pr23165.c: Likewise.
* g++.dg/warn/empty-body.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119963 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index d53b15526c1..b688b15673f 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -3832,7 +3832,7 @@ c_parser_c99_block_statement (c_parser *parser) is just parsing a statement but (a) it is a block in C99, (b) we track whether the body is an if statement for the sake of -Wparentheses warnings, (c) we handle an empty body specially for - the sake of -Wextra warnings. */ + the sake of -Wempty-body warnings. */ static tree c_parser_if_body (c_parser *parser, bool *if_p) @@ -3844,7 +3844,7 @@ c_parser_if_body (c_parser *parser, bool *if_p) && c_parser_peek_2nd_token (parser)->type == CPP_COLON)) c_parser_label (parser); *if_p = c_parser_next_token_is_keyword (parser, RID_IF); - if (extra_warnings && c_parser_next_token_is (parser, CPP_SEMICOLON)) + if (warn_empty_body && c_parser_next_token_is (parser, CPP_SEMICOLON)) add_stmt (build_empty_stmt ()); c_parser_statement_after_labels (parser); return c_end_compound_stmt (block, flag_isoc99); |