This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: builtin_constant_p
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: builtin_constant_p
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Thu, 25 Jun 1998 11:54:06 -0700
- cc: law at cygnus dot com, egcs-patches at cygnus dot com
I consider __builtin_constant_p to be a function in the same vein
as sizeof.
Apparently this is because you have been using it in macros, without trying
to write the macros in a way that was safe against multiple evaluation of
the arguments. This won't be a problem if you start using inline functions
instead, because the argument will only be evaluated once.
In any case, it sounds reasonable to treat __builtin_constant_p like
sizeof, however, if we do this, then it must be very clearly documented.
Otherwise, there is no way for the average user to know whether it evaluates
for side-effects of not (heck, I didn't even know that was deliberate).
At the minimum, there should be a comment in the code saying that side-effects
are being deliberately ignored. I see that builtin_classify_type is doing
the same thing. I think that should be commented too. I think the rest of
the builtin functions should be performing side-effects.
Jim