This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/5520] Add a warning to detect empty body of if statements (like in the C frontend)
- From: "nathan at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Jan 2006 11:22:42 -0000
- Subject: [Bug c++/5520] Add a warning to detect empty body of if statements (like in the C frontend)
- References: <bug-5520-2906@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from nathan at codesourcery dot com 2006-01-05 11:22 -------
Subject: Re: Add a warning to detect empty body of if statements
(like in the C frontend)
mueller at kde dot org wrote:
> ------- Comment #5 from mueller at kde dot org 2006-01-05 10:19 -------
> http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01627.html
Could cp_parser_implicitly_scoped_statement be flattened to use
cp_lexer_next_token_is, rather than CLNTI_not? that'd read better. I'd
suggest
if(cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
.. handle {...}
else if (cp_lexer_next_token_is (parser->lexer (CPP_SEMICOLON))
.. handle empty
else
.. handle implicitly scoped stmt
The C++ changes will be ok with that change. Someone else will need to approve
the C change (but it looks ok to me)
nathan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5520