This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: macros with traditional cpp


On Sun, Sep 24, 2000 at 10:57:10PM +0200, Jamie Lokier wrote:
> Philip Blundell wrote:
> > The preprocessor used to accept code like this both with and without 
> > -traditional:
> > 
> > 	#define foo(x...) x
> > 	foo(one,two)
> > 
> > Now, -traditional causes an error like:
> > 
> > t.c:1: badly punctuated parameter list in #define
> > 
> > Is this intentional?

Yes.  The traditional preprocessor is intended to be a faithful
reimplementation of the original K+R C preprocessor, which did not
support varargs macros.  It would have *been* the original K+R C
preprocessor if I'd been able to get RMS and SCO to sign off on it.

Anyhow, code like the above simply can't be used with -traditional
anymore.  If you're using -traditional for assembly, try it without.
It'll probably work with only minor tweaks, like using C comments
instead of assembler comments.

> Ah yes, that is one form of a varargs bug I've been meaning to report.
> I've got macros which work fine with GCC 2.95, but don't work with _or_
> without -traditional now.  (Sorry, I'll try to provide an example
> tomorrow).

Please do provide an example.  I wouldn't be surprised to find genuine
bugs in the varargs macro code.

The new semantics are not that different; in most cases it will be possible
to convert macros.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]