Skip to content

Commit 439d89d

Browse files
committed
Filter conflicting global constants
See godotengine/godot#115649
1 parent 863d732 commit 439d89d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

binding_generator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,12 @@ def generate_global_constants(api, output_dir):
22592259
header.append("namespace godot {")
22602260
header.append("")
22612261

2262-
if len(api["global_constants"]) > 0:
2263-
for constant in api["global_constants"]:
2262+
# Remove integer limit global constants that overlap with those defined in cstdint
2263+
limit_constants = {"UINT8_MAX", "UINT16_MAX", "UINT32_MAX", "INT8_MIN", "INT8_MAX", "INT16_MIN", "INT16_MAX", "INT32_MIN", "INT32_MAX", "INT64_MIN", "INT64_MAX"}
2264+
global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants]
2265+
2266+
if len(global_constants) > 0:
2267+
for constant in global_constants:
22642268
header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};")
22652269

22662270
header.append("")

0 commit comments

Comments
 (0)