macro __VAR_ARGS_ bug??

Zack Weinberg zack@codesourcery.com
Mon Aug 5 13:18:00 GMT 2002


On Mon, Aug 05, 2002 at 08:43:37PM +0100, Neil Booth wrote:
> Neil Booth wrote:-
> 
> > You're right - pasting with a placemarker is valid (even if the other
> > token is a comma) and gives the other token.  There is only one
> > correct answer, and it is what Zack originally documented.  I'll post
> > a fix soon; it should appear in 3.2.1 (not in 3.2).
> 
> Bah, humbug.  We've had at least one bug report in the past about this
> case, using production code, that expects the comma to be swallowed.
> 
> See gcc.dg/cpp/macro8.c and vararg2.c.  These both fail if I change
> the code to have the correct semantics.

In macro8.c I assume you are referring to

#define TEST_WORSE(args...) (5, ## args)

 ... TEST_WORSE() ...

This is the classic ambiguity between 'no arguments' and 'one
argument, consisting of zero tokens'.  I do not know what part of the
mess that is vararg2.c is breaking; is it the same case?  If so, we
could just define this case to be 'no arguments' and be C99 compliant
for the less ambiguous situation where the ellipsis isn't the only
argument.

If it's worse than that, can you show me the vararg2.c case that breaks?

zw



More information about the Gcc-bugs mailing list