Pelles C forum

Pelles C => Bug reports => Topic started by: paulpp on September 11, 2012, 05:24:28 PM

Title: v7.00 __VA_ARGS__ handling
Post by: paulpp on September 11, 2012, 05:24:28 PM
Test source:

Code: [Select]
#define va_head(h, ...) h
#define va_tail(h, ...) __VA_ARGS__
int main(int argc, char *argv[])
{
int a,b,c;
va_head(a,b,c);
va_tail(a,b,c);
va_head(a);
va_tail(a);
    return 0;
}

Otput from Pelles C (option -E):

Quote
int main(int argc, char *argv[])
{
   int a,b,c;
   a;
   b,c;
   va_head(a);
   va_tail(a);
    return 0;
}

Output from MSVC and GCC:

Quote
int main(int argc, char *argv[])
{
        int a,b,c;
        a;
        b,c;
        a;
        ;
    return 0;
}
Title: Re: v7.00 __VA_ARGS__ handling
Post by: Pelle on September 22, 2012, 04:07:00 PM
__VA_ARGS__ and ... was introduced in C99, and you must provide at least one argument for the "..." case (it can't be empty). I see no bug here.

( MSVC is C89/C90, so it's totally irreleveant. My copy of GCC produces two warnings for your code, and POCC 7.0 produces two errors. )