Skip to content

Commit b058594

Browse files
authored
Merge pull request godotengine#1916 from ashtonmeuser/type-limits
Filter conflicting global constants
2 parents 965d0e9 + 67a0b19 commit b058594

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

binding_generator.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,24 @@ 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 = {
2264+
"UINT8_MAX",
2265+
"UINT16_MAX",
2266+
"UINT32_MAX",
2267+
"INT8_MIN",
2268+
"INT8_MAX",
2269+
"INT16_MIN",
2270+
"INT16_MAX",
2271+
"INT32_MIN",
2272+
"INT32_MAX",
2273+
"INT64_MIN",
2274+
"INT64_MAX",
2275+
}
2276+
global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants]
2277+
2278+
if len(global_constants) > 0:
2279+
for constant in global_constants:
22642280
header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};")
22652281

22662282
header.append("")

0 commit comments

Comments
 (0)