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

Jim Meyering jim@meyering.net
Wed May 2 10:03:00 GMT 2001


Using the very latest gcc, as checked out a couple of hours ago,
and Debian unstable's libc-2.2.2, I tried to build texinfo-4.0b
( ftp://texinfo.org/texinfo/pretests/texinfo-4.0b.tar.gz )
but was surprised to get this failure:

  info.c:8:1: directives may not be used inside a macro argument
  info.c:8:1: unterminated argument list invoking macro "printf"

Of course, the original line numbers were different.

Using /usr/bin/gcc:
  Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
  gcc version 2.95.4 20010319 (Debian prerelease)
it compiled just fine.

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.



More information about the Gcc-bugs mailing list