va_dcl

Zack Weinberg zack@rabi.columbia.edu
Sun Nov 8 16:55:00 GMT 1998


On Sun, 8 Nov 1998 15:21:48 -0500, "Jack Howarth" wrote:
>   Does anyone know why programs like xbl and xfig are now having problems
>compiling under egcs_1_1_branch (and perhaps egcs 1.1). The construction
>
>va_dcl
>{
>}
>
>is considered to be a syntax error now. 

Um.  Clarification.  The above *should* get a syntax error.  This
shouldn't: 

#include <varargs.h>

int
foo()
va_dcl
{
}

but it does, with egcs-1.1.1pre (not sure about 1.1) on I think all
platforms.  If I change foo() to foo(va_alist) it's happy.

A lot of old code uses the above construct; it should be accepted,
perhaps as a special case.

(va_dcl expands to "int __something; ..." and va_alist expands to
"__something".  I guess the empty parameter list used to be acceptable
to the parser, but now isn't.)

>Also egcs seems to want
>the va_start call to have two instead of one parameters passed to it.

That means you included stdarg.h instead of varargs.h

>Has the va_dcl construction been retired? If so how does one recode something
>like that?     

It is an obsolete construct which we keep only for compatibility.  The
C standard specifies a cleaner interface which is available via
<stdarg.h>.

zw



More information about the Gcc-bugs mailing list