diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2006-12-16 16:48:01 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2006-12-16 16:48:01 +0000 |
commit | b3b433c507af133b95bfdbbd33338139e3d15345 (patch) | |
tree | d673fa90f961dc743634330e431fadf58ca98b8b /gcc/c-parser.c | |
parent | d6b418fa0b3d5dc88ffb3f1673f82e6dbf5da6d1 (diff) | |
download | gcc-b3b433c507af133b95bfdbbd33338139e3d15345.zip gcc-b3b433c507af133b95bfdbbd33338139e3d15345.tar.gz gcc-b3b433c507af133b95bfdbbd33338139e3d15345.tar.bz2 |
re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
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.
From-SVN: r119963
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 d53b155..b688b15 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); |