On 02/12/20 15:18 -0500, Jason Merrill wrote:
On 12/2/20 7:30 AM, Jakub Jelinek wrote:
Hi!
On Tue, Dec 01, 2020 at 01:03:52PM +0000, Jonathan Wakely via Gcc-patches wrote:
I mentioned in PR 80780 that a __builtin__PRETTY_FUNCTION would have
been nice, because __FUNCTION__ isn't very useful for C++, because of
overloading and namespace/class scopes. There are an unlimited number
of functions that have __FUNCTION__ == "s", e.g. "ns::s(int)" and
"ns::s()" and "another_scope::s::s<T...>(T...)" etc.
Since __builtin_source_location() can do whatever it wants (without
needing to add __builtin__PRETTY_FUNCTION) it might be nice to use the
__PRETTY_FUNCTION__ string. JeanHeyd's tests would still need changes,
because the name would be "s::s(void*)" not "s::s" but that still
seems better for users.
When I've added template tests for the previous patch, I have noticed that
the current __builtin_source_location behavior is not really __FUNCTION__,
just close, because e.g. in function template __FUNCTION__ is still
"bar" but __builtin_source_location gave "bar<0>".
Anyway, this patch implements above request to follow __PRETTY_FUNCTION__
(on top of the earlier posted patch).
Tested on x86_64-linux, ok for trunk if it passes full bootstrap/regtest on
x86_64-linux?
OK on Friday unless Jonathan objects.
I'll try to test it tomorrow, but I'm definitely in favour of the
change to PRETTY_FUNCTION.