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: Ben Collins <bcollins at debian dot org>
- Date: Wed, 2 May 2001 15:47:43 -0400
- 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>
On Wed, May 02, 2001 at 07:02:08PM +0200, Jim Meyering wrote:
>
> ---------------------------------
> #define printf(fmt, args...) fprintf (stdout, fmt, ## args)
>
> static void
> info_short_help ()
> {
> printf ("%s",
> #ifdef __MSDOS__
> "a"
> #else
> "b"
> #endif
> );
> }
> ---------------------------------
>
This is a bug in the code. All functions in glibc can also be macros.
You are messing around with what might be a macro. You'll need to fix
your code to look something like this:
#ifdef __MSDOS__
printf("%s", a);
#else
printf("%s", b);
#endif
Or "#undef printf" previous to the broken usage of it, so that you get
the function instead of the macro. The example I gave is more readable,
so I suggest it.
Ben
--
-----------=======-=-======-=========-----------=====------------=-=------
/ Ben Collins -- ...on that fantastic voyage... -- Debian GNU/Linux \
` bcollins@debian.org -- bcollins@openldap.org -- bcollins@linux.com '
`---=========------=======-------------=-=-----=-===-======-------=--=---'