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

about the naming of C/C++ macros #51435

Open
omar-polo opened this issue Aug 9, 2021 · 2 comments
Open

about the naming of C/C++ macros #51435

omar-polo opened this issue Aug 9, 2021 · 2 comments

Comments

@omar-polo
Copy link
Contributor

Godot version

4.0.dev

System information

OpenBSD-CURRENT

Issue description

I've hit the following warning

core/io/marshalls.cpp:55:9: warning: '_S' macro redefined [-Wmacro-redefined]
#define _S(a) ((int32_t)a)
        ^
/usr/include/ctype.h:48:9: note: previous definition is here
#define _S      0x08
        ^

this is because identifiers that starts with an underscore are reserved, and OpenBSD' ctype.h defines some _[A-Z] constants.

I was going to submit a pr to rename _S in marshalls.cpp, but then I grepped for #define _[A-Z] and found that there are a lot of macros named like that across the tree.

(This also affects stuff in thirdparty, like oidn)

What's the opinion on this? Should we rename the macros as needed or try a bulk-rename?

Steps to reproduce

just try to compile Godot on a system whose headers defines _[A-Z] constants.

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Aug 9, 2021

See also godotengine/godot-proposals#2093.

@omar-polo
Copy link
Contributor Author

I missed that, I've only searched in this repository, thanks for the link. However, I still think this is a slightly different issues than that proposal.

I was also confused by the matches in thirdparty, there are only 25 of such defines in all the *.cpp files in the tree, and most of them seems easily replaceable. I'll try to come up with an initial pr at least for most simple ones.

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

No branches or pull requests

2 participants