This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: __FUNCTION__ and __PRETTY_FUNCTION__
Neil Booth <neil@daikokuya.demon.co.uk> writes:
> Joseph S. Myers wrote:-
>
>> I think we should make them follow the C99 definition of __func__.
>
> OK, I'm all for that. I've had one other vote in favour of consistency
> with g++.
If we do that - like your patches on gcc-patches do - we break
compatibilty with existing code without a really good reason.
__FUNCTION__ is a well documented extension and you break it, forcing
users to change their code.
It might have been a better design decision to implement __FUNCTION__
like __func__ but the designers of __FUNCTION__ did it as documented -
and this simplifies application code, glibc e.g. does:
extern void __libc_fatal (__const char *__message)
# define LOG(c) if (__td_debug) __libc_write (2, c "\n", strlen (c "\n"))
...
__libc_fatal ("illegal status in " __FUNCTION__);
LOG (__FUNCTION__);
Both usages do break and there're others that might do.
I'd prefer to deprecate (iff this is really the meaning of the
majority) this in GCC 3.1 and change it for GCC 3.2.
If I'm overruled and everybody likes this change, then please send a
patch that (I hope this is usual practice, if not, I'd propose it):
- prominently says that this was changed, e.g. in a NEWS section
- mentions in the description of __FUNCTION__ this change. People
converting from older GCCs should see that something has changed!
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj