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]
Other format: [Raw text]

Re: current GCC broken in handling __FUNCTION__: t.c:8: parse error before string constant


Andreas Jaeger wrote:-

> I get on this simple function now:
> int
> main (void)
> {
>   printf ("fatal error in " __FUNCTION__);
>   
>   return 0;
> }

Hmm.  I wasn't aware that they underwent concatenation.  It's a shame
they do, because it means we have to leave the string concatenation in
the parser, where I don't think it belongs.  Clearly avoiding this is
the reason that the C99 __func__ was defined the way it was.
__FUNCTION__ and __PRETTY_FUNCTION__ violate the phases of translation
of the ISO standards: they expect to be able to do phase 6
concatentation in the middle of phase 7 compilation.

Odd that there was no test case for this.  I did a grep of the testsuite,
and saw plenty of tests with __FUNCTION__, so I assumed that since they
all passed it must be OK.

Unless someone can thing of an alternative, I'll revert it soon and
add a test case.  I wonder if it is worth deprecating their
involvement in concatenation?

Neil.


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