diff --git a/binding_generator.py b/binding_generator.py index 1ac1deb40..7f15e15b5 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -2259,8 +2259,24 @@ def generate_global_constants(api, output_dir): header.append("namespace godot {") header.append("") - if len(api["global_constants"]) > 0: - for constant in api["global_constants"]: + # Remove integer limit global constants that overlap with those defined in cstdint + limit_constants = { + "UINT8_MAX", + "UINT16_MAX", + "UINT32_MAX", + "INT8_MIN", + "INT8_MAX", + "INT16_MIN", + "INT16_MAX", + "INT32_MIN", + "INT32_MAX", + "INT64_MIN", + "INT64_MAX", + } + global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants] + + if len(global_constants) > 0: + for constant in global_constants: header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};") header.append("")