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

AY_OBFUSCATE(__func__) #47

Open
NavKai opened this issue Sep 5, 2024 · 1 comment
Open

AY_OBFUSCATE(__func__) #47

NavKai opened this issue Sep 5, 2024 · 1 comment

Comments

@NavKai
Copy link

NavKai commented Sep 5, 2024

hello.when i use marco__func__ with AY_OBFUSCATE(),the complier throw this error:

error: template argument 1 is invalid
206 |         []() -> ay::obfuscated_data<sizeof(data)/sizeof(data[0]), key>& { \
    |                                                                      ^
note: in expansion of macro ‘AY_OBFUSCATE_KEY’
199 | #define AY_OBFUSCATE(data) AY_OBFUSCATE_KEY(data,AY_OBFUSCATE_DEFAULT_KEY)
    |                            ^~~~~~~~~~~~~~~~
note: in expansion of macro ‘AY_OBFUSCATE’
28   |     const char* functionName = AY_OBFUSCATE(__func__)  
     |                                ^~~~~~~~~~~~

how can i use __func__ with AY_OBFUSCATE? thanks :)

@MarioLiebisch
Copy link

I don't think this is an issue you can work around in an efficient way.

In contrast to macros like __DATE__, __TIME__, or __LINE__, __func__ is actually an implicitly created constant not known to the preprocessor. This would have worked with __FUNCTION__ in old versions of GCC (I think), but since by now that macro also just points at __func__, I don't think there's any simple way around this other than inserting function names by hand (or doing some macro magic).

And even if you could work around this, you'd probably be lost due to AY_OBFUSCATE() inserting a lambda, which inside would feature a different value for __func__.

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

No branches or pull requests

2 participants