This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Empty loop elimination in 4.0 ?
- From: Michael Veksler <VEKSLER at il dot ibm dot com>
- To: Neil Booth <neil at daikokuya dot co dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 10 Jan 2005 18:00:29 +0200
- Subject: Re: Empty loop elimination in 4.0 ?
Neil Booth <neil@daikokuya.co.uk> wrote on 10/01/2005 16:59:56:
> Michael Veksler wrote:-
....
> > Another example, with C macros. I assume that with -DNDEBUG
> > assert(x) is empty:
> >
> > for (p: iterates over elements)
> > assert(p->value != NULL); /* Will warn with -DNDEBUG */
> >
> > /* Should I add "#ifndef NDEBUG" to protect the loop? */
>
> Any warning can be triggered by certain uses of macro expansions.
> That is not usually used as an argument to suppress them.
>
Your claim that "Any warning can be triggered by... macro..." should
not apply to a standard (as in ISO/ANSI) macro like assert. My example
is a reasonable use of assert. You don't want to uglify this code by an
"#ifndef NDEBUG" block, do you?
Also, most macros can be written in a way that does not produce
warnings. Not with this warning message.