This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b


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  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]