This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Strange behaviour gcc 3.0
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: Strange behaviour gcc 3.0
- From: Igmar Palsenberg <i dot palsenberg at jdimedia dot nl>
- Date: Wed, 1 Aug 2001 14:48:05 +0200 (CEST)
- cc: <gcc-bugs at gcc dot gnu dot org>, <gcc at gcc dot gnu dot org>
On 1 Aug 2001, Alexandre Oliva wrote:
> On Aug 1, 2001, Igmar Palsenberg <i.palsenberg@jdimedia.nl> wrote:
>
> > printf("bogus"
> > #ifdef TEST
> > "testing"
> > #endif
> > );
>
> > [root@wrkst SPECS]# gcc -O2 -o x x.c
> > x.c:7:1: directives may not be used inside a macro argument
> > x.c:7:1: unterminated argument list invoking macro "printf"
> > x.c: In function `main':
> > x.c:10: parse error before ')' token
>
> > Code didn't change. This really strikes me.. Anyone can comment on this ??
>
> printf is a macro (don't ask me why; it's a glibc implementation
> detail that is authorized by the C Standard), and there can't be
> preprocessor directives inside a macro argument list.
It's indeed in bits/stdio.h.
Is there a define available to see if I'm using gcc 3.0 ?? Older versions
have no problem with above code, and the #ifdef in printf() is massively
used in the programs I'm recompiling.
I can override the optimize to use -O0, but that might give other
problems..
For now, I'll hack glibc.
Regards,
Igmar
--
Igmar Palsenberg
JDI Media Solutions
Boulevard Heuvelink 102
6828 KT Arnhem
The Netherlands
mailto: i.palsenberg@jdimedia.nl
PGP/GPG key : http://www.jdimedia.nl/formulier/pgp/igmar