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

Anna Zaks ganna at apple.com
Tue Jan 3 12:56:50 PST 2012


This patch looks good to me.

Though since this is a syntactic check, maybe it could be a compiler warning.

Cheers,
Anna.

Minor syntax issue (occurs twice):
+  if(QuietIfBodyOnSeparateLine)
 ->
+  if (QuietIfBodyOnSeparateLine)

On Jan 3, 2012, at 6:46 AM, Dmitri Gribenko wrote:

> Hello,
> 
> Attached is a patch for clang StaticAnalyzer that implements
> enhancement proposed in PR11329.
> 
> Commit message:
> Add a null statement checker that warns about (possibly) unintended
> null statement
> (semicolon) as body in for, range-based for, while and switch statements.
> 
> Best regards,
> Dmitri Gribenko
> 
> -- 
> 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.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