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

Preprocessor conflict with tokens _B, _X, _S in AntTweakBar #138

Open
DWesl opened this issue Jun 7, 2024 · 0 comments
Open

Preprocessor conflict with tokens _B, _X, _S in AntTweakBar #138

DWesl opened this issue Jun 7, 2024 · 0 comments

Comments

@DWesl
Copy link

DWesl commented Jun 7, 2024

https://gcc.gnu.org/onlinedocs/cpp/System-specific-Predefined-Macros.html
https://en.cppreference.com/w/c/language/identifier#Reserved_identifiers
Tokens beginning with an underscore and a capital letter are reserved for the system/compiler.
AntTweakBar uses seven identifiers that are just the underscore and capital letter, at least three of which conflicted with preprocessor definitions.

I ran

sed -E -e 's/\b_B\b/_Blue/g' -e 's/\b_R\b/_Red/g' -e 's/\b_G\b/_Green/g' -e 's/\b_A\b/_Alpha/g' \
    -e 's/\b_S\b/_MixingFractionOfSecond/g' -e 's/\b_X\b/_ValueX/g' -e 's/\b_Y\b/_ValueY/g' \
    -i external/AntTweakBar-1.16/src/*.{h,cpp}

to make the names less likely to collide, otherwise I got a series of errors to the effect of "expected identifier before numeric literal" (and "identifier not declared in current scope" because it stopped parsing declarations when it ran into the previous error). The \b on either side is to prevent the script from changing OpenGL function names.

@DWesl DWesl changed the title Preprocessor conflict with tokens _B, _X Preprocessor conflict with tokens _B, _X, _S in AntTweakBar Jun 7, 2024
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

1 participant