This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: current GCC broken in handling __FUNCTION__: t.c:8: parse error before string constant
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 9 Dec 2001 16:37:47 +0000
- Subject: Re: current GCC broken in handling __FUNCTION__: t.c:8: parse error before string constant
- References: <u88zcce669.fsf@gromit.moeb>
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.