This is the mail archive of the gcc-patches@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]

Re: [PING C++] Move empty-if warning to the front-end


Mark Mitchell wrote:
> Paolo Bonzini wrote:
>> This patch from stage1:
>>
>> http://permalink.gmane.org/gmane.comp.gcc.patches/170041
>>
>> needs C++ maintainer approval.  It allows to avoid a hack in the removal
>> of CONVERT_EXPR, by avoiding that NOP_EXPR<void>(0) and
>> CONVERT_EXPR<void>(0) have different meaning.
> 
> This is conceptually OK.  But, I would like to understand why you've
> duplicate the code for both the if and else clauses, and also why that
> code isn't exactly the same, other than the literal word "if" and "else".

Because the testcase says

  if (x)
    ; /* By design we don't warn in this case.  */
  else
    (void)0;

  if (x)
    (void)0;
  else
    ; /* { dg-warning "suggest braces around empty body in an" } */

and this causes all the differences you spotted.

Thanks for the review!

Paolo


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