This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
wrong macro expansion with new cpp
- To: gcc at gcc dot gnu dot org
- Subject: wrong macro expansion with new cpp
- From: "Bernardo Innocenti" <bernie at cosmos dot it>
- Date: 23 Jul 2000 17:58:34 +0000
- Organization: SystemShock
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