This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/5520] Add a warning to detect empty body of if statements (like in the C frontend)



------- 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]