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

Dmitri Gribenko gribozavr at gmail.com
Tue Jan 3 13:04:05 PST 2012


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>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: null-stmt-body-checker-v2.patch
Type: text/x-diff
Size: 10970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120103/48628d70/attachment.patch>


More information about the cfe-commits mailing list