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]

wrong macro expansion with new cpp


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


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