This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
- To: Jim Meyering <jim at meyering dot net>
- Subject: Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Wed, 2 May 2001 21:06:03 +0100
- Cc: Karl Berry <karl at freefriends dot org>, bug-gcc at gnu dot org, bug-glibc at gnu dot org
- References: <urypudrk7lb.fsf@ixi.eng.ascend.com>
Jim Meyering wrote:-
> Here's the pared-down info.c:
>
> ---------------------------------
> #define printf(fmt, args...) fprintf (stdout, fmt, ## args)
>
> static void
> info_short_help ()
> {
> printf ("%s",
> #ifdef __MSDOS__
> "a"
> #else
> "b"
> #endif
> );
> }
> ---------------------------------
>
> Compiling the above with /usr/bin/gcc succeeded.
>
> If the definition of printf above (extracted from glibc's stdio.h)
> is valid, then I suppose this is a problem with gcc.
No, it is caused by a (silly) glibc macro. Basically, glibc defines
printf as a macro, which it is theoretically entitled to do, and that
causes your code to barf since you have conditionals within the macro.
You need to put the printfs inside the conditionals.
Neil.