macro __VAR_ARGS_ bug??

Neil Booth neil@daikokuya.co.uk
Mon Aug 5 13:24:00 GMT 2002


Zack Weinberg wrote:-

> In macro8.c I assume you are referring to
> 
> #define TEST_WORSE(args...) (5, ## args)
> 
>  ... TEST_WORSE() ...

Yup.  The section expands to

int main ()
{


  if ((5,) != 5)
    abort ();

  if (add (2, (5)) != 7)
    abort ();
  return 0;
}
 
> 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?

The vararg2 failure is simplified in vararg1.c, which also fails.  At
least, it looks like the varag1.c failure is duplicated in vararg2.c.

count() expands to 1, rather than 0.  It's basically testing just this
example.

Neil.



More information about the Gcc-bugs mailing list