[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
From: |
Neil Booth |
Subject: |
Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b |
Date: |
Wed, 2 May 2001 21:06:03 +0100 |
User-agent: |
Mutt/1.3.17i |
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.
- FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Jim Meyering, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Ben Collins, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b,
Neil Booth <=
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Zack Weinberg, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Alexandre Oliva, 2001/05/02