godot-cpp
godot-cpp copied to clipboard
Fix header generation for global constants
When writing https://github.com/godotengine/godot/pull/68999, I realized something in the generated global_constants.hpp will fail CI.
-
The generated constants are
int, but should beint64_tinstead. -
Using
INT64_MIN(-9223372036854775808) as a constant value produces warnings like:integer constant is so large that it is unsigned.
This is because the negative sign is not part of the integer literal, and the largest signed integer type is
long long, which can't hold9223372036854775808.So for
INT64_MIN, I break the literal into-9223372036854775807 - 1. -
Global constant names like
UINT64_MAXwill produce errors because these names are macros in C++. I think escaping them by prepending an underscore is okay since these constants all have their C++ counterpart, and won't be used often.
Waiting for.