This is the mail archive of the gcc-bugs@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: Serious error-causing change in new CPP's -traditional behavior


On Sat, May 13, 2000 at 11:34:35AM +0900, Neil Booth wrote:
> Neil Booth wrote:-
> 
> > No, I don't think it is.  You're right that order of evaluation isn't
> > specified, but you can't just "lose" the # like you suggest:-
> > 
> > 6.10.3.2.1: Each # preprocessing token in the replacement list of a
> > function-like macro shall be followed by a parameter as the next
> > preprocessing token in the replacement list.
> 
> Sorry to reply to my own mail, but this events occur at different
> times anway.
> 
> The lack of an argument following the # should be caught when parsing
> the #define.  The ## pasting is not done until expansion time, right?

Oh! Yes.  You're right.  The token after # at macro definition time is
"##", so the constraint is violated.  The ## is still effective, so we
want to get #4 at expansion time, but we must give a diagnostic.

I didn't see this because both # and ## are removed from the token
list at definition time, and because of the 'hash_hash' example in the
standard (which is an object-like macro, hence irrelevant).

Fortunately this is a one-line fix.

zw


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