Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support gcc -fno-pretty-templates #258

Merged
merged 2 commits into from
May 13, 2023

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.
include/magic_enum.hpp Outdated Show resolved Hide resolved
@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