Skip to content

Commit 4862384

Browse files
authored
Merge pull request #1930 from ashtonmeuser/type-limits-backport
Filter conflicting global constants
2 parents f00f83d + 1f3f052 commit 4862384

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
@@ -2080,8 +2080,24 @@ def generate_global_constants(api, output_dir):
20802080
header.append("namespace godot {")
20812081
header.append("")
20822082

2083-
if len(api["global_constants"]) > 0:
2084-
for constant in api["global_constants"]:
2083+
# Remove integer limit global constants that overlap with those defined in cstdint
2084+
limit_constants = {
2085+
"UINT8_MAX",
2086+
"UINT16_MAX",
2087+
"UINT32_MAX",
2088+
"INT8_MIN",
2089+
"INT8_MAX",
2090+
"INT16_MIN",
2091+
"INT16_MAX",
2092+
"INT32_MIN",
2093+
"INT32_MAX",
2094+
"INT64_MIN",
2095+
"INT64_MAX",
2096+
}
2097+
global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants]
2098+
2099+
if len(global_constants) > 0:
2100+
for constant in global_constants:
20852101
header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};")
20862102

20872103
header.append("")

0 commit comments

Comments
 (0)