From 1f3f0522df52dfe95de6c4d6b9b571ef1bf8b05c Mon Sep 17 00:00:00 2001 From: Ashton Meuser Date: Fri, 30 Jan 2026 21:04:41 -0800 Subject: [PATCH] Filter conflicting global constants See https://github.com/godotengine/godot/pull/115649 --- binding_generator.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index 4da069967..69ec3f373 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -2080,8 +2080,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("")