[cfe-commits] [PATCH][PR11329] Generalize -Wempty-body: warn when statement body is a empty

Dmitri Gribenko gribozavr at gmail.com
Wed Jan 4 12:28:17 PST 2012


On Wed, Jan 4, 2012 at 10:22 PM, Matthieu Monrocq
<matthieu.monrocq at gmail.com> wrote:
> Le 4 janvier 2012 20:44, Dmitri Gribenko <gribozavr at gmail.com> a écrit :
> What if the original code looked like:
>
> for (int j : arr)
> {
>   assert(j >= 0 && j < 1024 && "Too big value!");
> }

This should preprocess to something like for(int j : arr) { ((void)0);
} so it is not an issue.  Nevertheless it should IMHO trigger an
"unused variable" warning (but it doesn't...)

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>*/




More information about the cfe-commits mailing list