public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
@ 2005-07-25  8:41 Denis Zaitsev
  2005-07-25  8:51 ` Richard Guenther
  0 siblings, 1 reply; 12+ messages in thread
From: Denis Zaitsev @ 2005-07-25  8:41 UTC (permalink / raw)
  To: gcc, linux-gcc

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:41 [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument Denis Zaitsev
@ 2005-07-25  8:51 ` Richard Guenther
  2005-07-25  8:57   ` Paolo Carlini
  2005-07-25  9:05   ` Denis Zaitsev
  0 siblings, 2 replies; 12+ messages in thread
From: Richard Guenther @ 2005-07-25  8:51 UTC (permalink / raw)
  To: gcc, zzz

On 7/25/05, Denis Zaitsev <zzz@anda.ru> wrote:
> 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

__FUNCTION__ expands to a variable.  Use

 printf("%s\n", __FUNCTION__);

instead.  Btw, this list is for the development _of_ gcc, not with gcc.
Use gcc-help for that.

Richard.

> 
> 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.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:51 ` Richard Guenther
@ 2005-07-25  8:57   ` Paolo Carlini
  2005-07-25  9:23     ` Robert Dewar
                       ` (2 more replies)
  2005-07-25  9:05   ` Denis Zaitsev
  1 sibling, 3 replies; 12+ messages in thread
From: Paolo Carlini @ 2005-07-25  8:57 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc

Richard Guenther wrote:

>Btw, this list is for the development _of_ gcc, not with gcc.
>Use gcc-help for that.
>  
>
By the way, since we have to point out that *so often*, maybe there is
something wrong on our part: I wonder whether changing the names of
those lists would help!?!? I don't know: gcc-development, gcc-users, ...

Paolo.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:51 ` Richard Guenther
  2005-07-25  8:57   ` Paolo Carlini
@ 2005-07-25  9:05   ` Denis Zaitsev
  2005-07-25  9:36     ` Paolo Bonzini
  1 sibling, 1 reply; 12+ messages in thread
From: Denis Zaitsev @ 2005-07-25  9:05 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc

On Mon, Jul 25, 2005 at 10:51:23AM +0200, Richard Guenther wrote:
> On 7/25/05, Denis Zaitsev <zzz@anda.ru> wrote:
> > 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
> 
> __FUNCTION__ expands to a variable.  Use
> 
>  printf("%s\n", __FUNCTION__);
> 
> instead.  Btw, this list is for the development _of_ gcc, not with gcc.
> Use gcc-help for that.

Ok, but such a code used to be compiled succesively with gcc for
years.  Then, some change _in_ gcc has occured.  That is why I've
posted to here.

Really, I've met the problem, when I was compiling the X Window System
system.  The sources contain a lot of such an examples.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:57   ` Paolo Carlini
@ 2005-07-25  9:23     ` Robert Dewar
  2005-07-25 16:30     ` Mike Stump
  2005-07-25 17:15     ` Dale Johannesen
  2 siblings, 0 replies; 12+ messages in thread
From: Robert Dewar @ 2005-07-25  9:23 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: Richard Guenther, gcc

Paolo Carlini wrote:

> By the way, since we have to point out that *so often*, maybe there is
> something wrong on our part: I wonder whether changing the names of
> those lists would help!?!? I don't know: gcc-development, gcc-users, ...

one problem is that people often say something like:

> Btw, this list is for the development _of_ gcc, not with gcc.
>>Use gcc-help for that.

and then go on to answer any way, which somewhat undermines
the msg, and encourages similar questions.

i know that people are trying to be helpful, which
is understandable, but ...

also there is official gcc info suggesting asking this list
for general help if gcc-help does not answer.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  9:05   ` Denis Zaitsev
@ 2005-07-25  9:36     ` Paolo Bonzini
  2005-07-25 11:31       ` Denis Zaitsev
  0 siblings, 1 reply; 12+ messages in thread
From: Paolo Bonzini @ 2005-07-25  9:36 UTC (permalink / raw)
  To: gcc

> Ok, but such a code used to be compiled succesively with gcc for
> years.  Then, some change _in_ gcc has occured.  That is why I've
> posted to here.

Yes, it was deprecated in 3.1 (released three years ago) and removed in 
3.3 (released two years ago).

Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the  printf's format argument
  2005-07-25  9:36     ` Paolo Bonzini
@ 2005-07-25 11:31       ` Denis Zaitsev
  0 siblings, 0 replies; 12+ messages in thread
From: Denis Zaitsev @ 2005-07-25 11:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: gcc

On Mon, Jul 25, 2005 at 11:35:27AM +0200, Paolo Bonzini wrote:
> > Ok, but such a code used to be compiled succesively with gcc for
> > years.  Then, some change _in_ gcc has occured.  That is why I've
> > posted to here.
> 
> Yes, it was deprecated in 3.1 (released three years ago) and removed in 
> 3.3 (released two years ago).

Really, things are not _so_ dramatical...  This is a cite from
extend.tex:


* These identifiers are not preprocessor macros.  In GCC 3.3 and
* earlier, in C only, __FUNCTION__ and __PRETTY_FUNCTION__ were
* treated as string literals; they could be used to initialize char
* arrays, and they could be concatenated with other string literals.
* GCC 3.4 and later treat them as variables, like __func__.


So, the behaviour is changed for 3.4, and is not changed for 3.3.  And
it is STILL not changed - 3.3 is alive - isn't it?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:57   ` Paolo Carlini
  2005-07-25  9:23     ` Robert Dewar
@ 2005-07-25 16:30     ` Mike Stump
  2005-07-25 16:49       ` Gabriel Dos Reis
  2005-07-25 17:15     ` Dale Johannesen
  2 siblings, 1 reply; 12+ messages in thread
From: Mike Stump @ 2005-07-25 16:30 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc

On Monday, July 25, 2005, at 01:58 AM, Paolo Carlini wrote:
> By the way, since we have to point out that *so often*, maybe there is
> something wrong on our part: I wonder whether changing the names of
> those lists would help!?!? I don't know: gcc-development, gcc-users, 
> ...

No, randomly changing mainline list names will confuse the thousands of 
people that are not confused.  Better to ask them why they thought this 
list was a good idea, and then track down the root of the problem, and 
then fix that.  In the past when I did it, it could be traced to people 
telling them, or to the web site directly.

For example, we could completely remove all references to the gcc 
mailing list from the web site, and invite people after the post a 
single good patch to gcc-help.  :-)  Or, maybe just put it on a page 
called contributing work to gcc.  Most using gcc that just want help 
would not even go to such a page.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25 16:30     ` Mike Stump
@ 2005-07-25 16:49       ` Gabriel Dos Reis
  2005-07-25 16:52         ` Paolo Carlini
  0 siblings, 1 reply; 12+ messages in thread
From: Gabriel Dos Reis @ 2005-07-25 16:49 UTC (permalink / raw)
  To: Mike Stump; +Cc: Paolo Carlini, gcc

Mike Stump <mrs@apple.com> writes:

| On Monday, July 25, 2005, at 01:58 AM, Paolo Carlini wrote:
| > By the way, since we have to point out that *so often*, maybe there is
| > something wrong on our part: I wonder whether changing the names of
| > those lists would help!?!? I don't know: gcc-development, gcc-users,
| > ...
| 
| No, randomly changing mainline list names will confuse the thousands
| of people that are not confused.

I agree changing the list name isn't a proper long term, fix.  After
all, people doing development *with* GCC might also think tha
gcc-development is the proper place ot sned mails instad of gcc-help
:-)

-- Gaby

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25 16:49       ` Gabriel Dos Reis
@ 2005-07-25 16:52         ` Paolo Carlini
  2005-07-25 16:57           ` Robert Dewar
  0 siblings, 1 reply; 12+ messages in thread
From: Paolo Carlini @ 2005-07-25 16:52 UTC (permalink / raw)
  To: Gabriel Dos Reis; +Cc: Mike Stump, gcc

Gabriel Dos Reis wrote:

>                                                              After
>all, people doing development *with* GCC might also think tha
>gcc-development is the proper place ot sned mails instad of gcc-help
>:-)
>  
>
Yes ;-) On the other hand, some people may believe that gcc-help is the
right list to arrange donations and other activies helping the gcc project
:-)

Paolo.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25 16:52         ` Paolo Carlini
@ 2005-07-25 16:57           ` Robert Dewar
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Dewar @ 2005-07-25 16:57 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: Gabriel Dos Reis, Mike Stump, gcc

The first step is to have clear documentation.
I sent a message to someone who would posted a question and he replied
by pointing to a clear statement that said tried gcc-help first if you have questions
and if that doesn't work try gcc, and that's what he did!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument
  2005-07-25  8:57   ` Paolo Carlini
  2005-07-25  9:23     ` Robert Dewar
  2005-07-25 16:30     ` Mike Stump
@ 2005-07-25 17:15     ` Dale Johannesen
  2 siblings, 0 replies; 12+ messages in thread
From: Dale Johannesen @ 2005-07-25 17:15 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc, Dale Johannesen, Richard Guenther


On Jul 25, 2005, at 1:58 AM, Paolo Carlini wrote:

> Richard Guenther wrote:
>
>> Btw, this list is for the development _of_ gcc, not with gcc.
>> Use gcc-help for that.
>>
>>
> By the way, since we have to point out that *so often*, maybe there is
> something wrong on our part: I wonder whether changing the names of
> those lists would help!?!? I don't know: gcc-development, gcc-users, 
> ...

Perhaps adding something similar to the above to the description
of the gcc list on the web page would help.  What's there seems clear
enough to me, but perhaps a bigger hammer would help other people.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-07-25 17:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25  8:41 [BUG] gcc-3.4.5-20050531 (i386): __FUNCTION__ as a part of the printf's format argument Denis Zaitsev
2005-07-25  8:51 ` Richard Guenther
2005-07-25  8:57   ` Paolo Carlini
2005-07-25  9:23     ` Robert Dewar
2005-07-25 16:30     ` Mike Stump
2005-07-25 16:49       ` Gabriel Dos Reis
2005-07-25 16:52         ` Paolo Carlini
2005-07-25 16:57           ` Robert Dewar
2005-07-25 17:15     ` Dale Johannesen
2005-07-25  9:05   ` Denis Zaitsev
2005-07-25  9:36     ` Paolo Bonzini
2005-07-25 11:31       ` Denis Zaitsev

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 read-only IMAP folder(s) and NNTP newsgroup(s).