From e3ae931fdf0cea69a0c93e17f12d68352b332ed8 Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Thu, 25 Jun 2026 15:39:00 +0300 Subject: [PATCH] mrbind: pass -Wno-enum-constexpr-conversion only to old Clang (18, 19) This flag is only needed by the older Clang versions we use as parsers, so move it out of the always-on common_compiler_parser_flags.txt and add it conditionally in generate.mk, only when CXX_FOR_BINDINGS is Clang 18 or 19. This mirrors how -frelaxed-template-template-args is already gated nearby. --- scripts/mrbind/common_compiler_parser_flags.txt | 1 - scripts/mrbind/generate.mk | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/mrbind/common_compiler_parser_flags.txt b/scripts/mrbind/common_compiler_parser_flags.txt index 4d7d5c2817c9..583dc093b97b 100644 --- a/scripts/mrbind/common_compiler_parser_flags.txt +++ b/scripts/mrbind/common_compiler_parser_flags.txt @@ -1,5 +1,4 @@ -std=c++23 -Wno-nonportable-include-path --Wno-enum-constexpr-conversion -Wno-deprecated-enum-enum-conversion -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH diff --git a/scripts/mrbind/generate.mk b/scripts/mrbind/generate.mk index 269953b038d4..8ac3ee4ed76e 100644 --- a/scripts/mrbind/generate.mk +++ b/scripts/mrbind/generate.mk @@ -579,6 +579,10 @@ COMPILER_FLAGS := $(ABI_COMPAT_FLAG) $(EXTRA_CFLAGS) $(call load_file,$(makefile # Add `-frelaxed-template-template-args` if Clang is old enough to support it. Newer versions have this behavior by default. # Clang 18 and older need this flag. Clang 19 and 20 do the right thing by default, but still allow the flag with a deprecation warning. Clang 21 and newer consider this an unknown flag and error. COMPILER_FLAGS += $(shell $(CXX_FOR_BINDINGS) --help | grep -o -- -frelaxed-template-template-args) +# `-Wno-enum-constexpr-conversion` is only needed by the older Clang versions (18, 19); pass it only there. +ifneq ($(filter 18 19,$(call safe_shell,$(CXX_FOR_BINDINGS) -dumpversion | cut -d. -f1)),) +COMPILER_FLAGS += -Wno-enum-constexpr-conversion +endif ifneq ($(DEPS_INCLUDE_DIR),) # Required for vcpkg environments COMPILER_FLAGS += -I$(DEPS_INCLUDE_DIR)/eigen3