vixl: suppress clang-cl C++11-narrowing errors from MS enum semantics

Under the MSVC ABI, enums without a fixed underlying type keep int for
MSVC compatibility, so vixl's >=0x80000000 instruction-encoding
enumerators wrap negative and their use as case labels against the
unsigned Instr type is a narrowing error clang-cl enforces (two TUs:
cpu-features-auditor, disasm). MSVC itself compiles the identical
semantics silently -- upstream PCSX2 ships vixl on Windows arm64 MSVC
-- and the 32-bit patterns are unchanged, so downgrading the
diagnostic is behavior-correct. PUBLIC like the existing
deprecated-enum-enum-conversion suppression, since the same
enum-vs-Instr switches appear in TUs including vixl headers.
This commit is contained in:
Brian Degenhardt
2026-07-19 13:52:55 -07:00
parent 7d79b9d8f4
commit b1c4cf9358
+11
View File
@@ -68,6 +68,17 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(vixl PUBLIC -Wno-deprecated-enum-enum-conversion)
endif()
# Under the MSVC ABI (clang-cl), enums without a fixed underlying type keep
# `int` for MSVC compatibility, so vixl's >=0x80000000 instruction-encoding
# enumerators wrap negative; using them as case labels against the unsigned
# `Instr` type is then a C++11 narrowing error, which clang enforces but MSVC
# itself silently accepts. The 32-bit patterns are identical either way, so
# downgrading the diagnostic is behavior-correct. PUBLIC because the same
# enum-vs-Instr switches appear in TUs that include vixl headers.
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(vixl PUBLIC -Wno-c++11-narrowing)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message("Enabling vixl debug assertions")
target_compile_definitions(vixl PUBLIC VIXL_DEBUG)