[BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument

Denis Zaitsev <[email protected]>
Newsgroups gmane.comp.gcc.devel,gmane.linux.gcc
Message-ID <[email protected]>
Such an example can't be compiled:


#include <stdio.h>

void x()
{
    printf(__FUNCTION__ "\n");
}


$ gcc printf.c -o fprintf
printf.c: In function `x':
printf.c:5: error: syntax error before string constant


Then, the problem is not printf-specific and is not depend of
<stdio.h>.  The next example gives the same error:


void y(const char *f, ...);
void z()
{
    y(__FUNCTION__ "\n");
}


If some args are present in the ellipsis section (i.e. y(__FUNCTION__
": %s\n", "xxx")), the problem doesn't vanish.  And, if __FILE__ is
used instead of __FUNCTION__, the problem is absent.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.