Skip to content

Commit 337fdb6

Browse files
authored
build: raise warning level to 2 for MSVC + WX (KhronosGroup#6290)
SPIRV-Tools consumers like DXC build with MSVC using /W2. Adding this flag here to the CI can catch those warnings earlier. Also adding /WX to fail on warnings so those become visible on the CI. This PR also disables the warning [4251](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4251?view=msvc-170) which warns about `std::unique_ptr` being in a class marked as dllexport.
1 parent 90156db commit 337fdb6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ if(${COMPILER_IS_LIKE_GNU})
112112
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror)
113113
endif()
114114
elseif(MSVC)
115-
set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 /wd4819)
115+
set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 /wd4819 /wd4251 /W2 /WX)
116116

117117
if(${SPIRV_WERROR})
118118
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX)

test/opt/fold_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ ::testing::Values(
14441444
"%2 = OpSNegate %v2uint %v2uint_0x3f800000_0xbf800000\n" +
14451445
"OpReturn\n" +
14461446
"OpFunctionEnd",
1447-
2, {static_cast<uint32_t>(-0x3f800000), static_cast<uint32_t>(-0xbf800000)}),
1447+
2, {static_cast<uint32_t>(-0x3f800000), static_cast<uint32_t>(-0xbf800000ll)}),
14481448
// Test case 6: fold vector components of uint (including integer overflow)
14491449
InstructionFoldingCase<std::vector<uint32_t>>(
14501450
Header() + "%main = OpFunction %void None %void_func\n" +

0 commit comments

Comments
 (0)