linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Zaitsev <zzz@anda.ru>
To: gcc@gcc.gnu.org, linux-gcc@vger.kernel.org
Subject: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
Date: Mon, 25 Jul 2005 14:41:32 +0600	[thread overview]
Message-ID: <20050725144132.A18786@ward.six> (raw)

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.

                 reply	other threads:[~2005-07-25  8:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050725144132.A18786@ward.six \
    --to=zzz@anda.ru \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-gcc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).