[cfe-commits] [PATCH][PR11329] StaticAnalyzer: Warn when statement body is a semicolon -- an unintended null statement

Ted Kremenek kremenek at apple.com
Tue Jan 3 13:16:01 PST 2012


Thanks Dmitri.  I agree with Anna that this should be a compiler warning.  My hunch is that 99% of the time it will flag real issues.  We already have -Wparentheses, which is a style warning, and the great thing about warnings is that they can be opted out.  I think this warning will have significantly larger impact as a compiler warning than a static analyzer check.

On Jan 3, 2012, at 1:04 PM, Dmitri Gribenko wrote:

> On Tue, Jan 3, 2012 at 10:56 PM, Anna Zaks <ganna at apple.com> wrote:
>> Though since this is a syntactic check, maybe it could be a compiler warning.
> 
> I can reimplement it as a warning if it would be accepted.  But since
> it imposes some coding style rules on the programmer, I thought that
> someone might not like it.
> 
>> Minor syntax issue (occurs twice):
>> +  if(QuietIfBodyOnSeparateLine)
>>  ->
>> +  if (QuietIfBodyOnSeparateLine)
> 
> Fixed (see attachment).
> 
> 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 <gribozavr at gmail.com>*/
> <null-stmt-body-checker-v2.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list