Hi Dmitri,

On Feb 11, 2012, at 7:32 AM, Dmitri Gribenko wrote:

> Hello Chandler,
> 
> I have to agree with you.  If this warning is starting to interfere
> with someone's style preference, then, although it might be useful, it
> can't be on-by-default.
> 
> I've removed special handling of range-based for.  So, now we have the
> following behavior:
> 
> * if, switch, range-based for: warn if semicolon is on the same line.
> * for, while: warn if semicolon is on the same line and either next
> statement is compound statement or next statement has more
> indentation.

Chandler and Richard raised concerns about not being consistent with how the 
warning treats the semicolon.
I can imagine that the same way one would comment out inside a compound body, 
e.g.:

if (...) { /*my_silly_code();*/ }

one could also comment out like this:

if (...) ; // my_silly_code();


Do you have cases (from e.g. llvm/clang or chromium, etc.) where the warning 
found an actual bug in a place where there was a semicolon in the same line but 
next statement was not compound statement and it didn't have more indentation ?

-Argyrios

> 
> Replacing the semicolon with {} or moving the semicolon to the next
> line will always silence the warning.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
> <generalize-warn-empty-body-v16.patch>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to