current GCC broken in handling __FUNCTION__: t.c:8: parse error before string constant
Neil Booth
neil@daikokuya.demon.co.uk
Sun Dec 9 09:12:00 GMT 2001
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.
More information about the Gcc-bugs
mailing list