Skip to content

Conversation

ecatmur
Copy link
Contributor

@ecatmur ecatmur commented Apr 29, 2023

The gcc option -fno-pretty-templates changes the __PRETTY_FUNCTION__ from e.g. "auto n() [with E = E]" to "auto n<E>()" (a bit more like MSVC). Demo: https://godbolt.org/z/dj86T77b9

Construct a string_view from __PRETTY_FUNCTION__ , and inspect the last character to determine how much to truncate before passing to pretty_name.

https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fno-pretty-templates

The gcc option -fno-pretty-templates changes the __PRETTY_FUNCTION__ from e.g.
"auto n() [with E = E]" to "auto n<E>()" (more like MSVC).

Pass the entire __PRETTY_FUNCTION__ / __FUNCSIG__ to pretty_name(), and truncate it there, checking the last character if necessary to determine the format used.
@Neargye Neargye merged commit 5367f51 into Neargye:master May 13, 2023
@Neargye
Copy link
Owner

Neargye commented May 13, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants