wrong macro expansion with new cpp

Bernardo Innocenti bernie@cosmos.it
Sun Jul 23 09:01:00 GMT 2000


Hello,

the 2000-07-03 snapshot introduced some major changes
in the C preprocessor.

I've noticed that the new parser breaks some code that
relied on some weird macro expansion side effects.

This test code exploits the problem:

----------------------------------
 #define FOO(x) x
 #define BAR(x) x
 #define FOOBAR(x) FOO(BAR(x))

 #define c (a b)
 #define b c 

 FOO(b)
 FOOBAR(b)
---------------------------------

The output of gcc -E -V2.95.1 is:

   (a b)
   (a b)

While the latest snapshot outputs:

   (a b)
   (a (a b))


I'm not sure if it's a bug. I'm not even sure which one is
correct, but since this change broke some old code, I would
recommend the old behavior.

-- 
   _  Bernardo Innocenti <bernie@cosmos.it> or <bernie@worldlink.it>
_ //  Amiga & UNIX developer - Sysop of SystemShock BBS
\X/   WWW: http://hermes.cosmos.it/~bernie - IRC: Bernie



More information about the Gcc mailing list