Skip to content

Commit 25443c7

Browse files
committed
MSVC: compile test suite with /W4
1 parent 6b9ff4d commit 25443c7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ macro(configure_tests target)
4242
)
4343

4444
# Add warnings
45-
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU")
45+
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
4646
target_compile_options(${target} PRIVATE
4747
-Wall -Wextra -Wcast-align -Wmissing-declarations -Wmissing-include-dirs
4848
-Wnon-virtual-dtor -Wodr -Wpedantic -Wredundant-decls -Wundef -Wunreachable-code
4949
$<$<CXX_COMPILER_ID:GNU>:-Wlogical-op -Wuseless-cast>
5050
)
51+
elseif (MSVC)
52+
target_compile_options(${target} PRIVATE /W4)
5153
endif()
5254

5355
# Configure optimization options
54-
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU")
56+
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
5557
target_compile_options(${target} PRIVATE
5658
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:Clang>>:-O0>
5759
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:GNU>>:-Og>

tests/cxx_17_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ TEST_CASE( "generalized callables" ) {
6060
CHECK(is_vec_sorted());
6161
}
6262

63-
std::uniform_int_distribution<int> random_middle(0, vec.size());
63+
std::uniform_int_distribution<int> random_middle(0, static_cast<int>(vec.size()));
6464

6565
SECTION( "timmerge for comparisons" ) {
6666
const auto middle = vec.begin() + random_middle(gen);

0 commit comments

Comments
 (0)