Skip to content

Commit

Permalink
MSVC: compile test suite with /W4
Browse files Browse the repository at this point in the history
  • Loading branch information
Morwenn committed Jan 27, 2024
1 parent 6b9ff4d commit 25443c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ macro(configure_tests target)
)

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

# Configure optimization options
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "GNU")
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
target_compile_options(${target} PRIVATE
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:Clang>>:-O0>
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:GNU>>:-Og>
Expand Down
2 changes: 1 addition & 1 deletion tests/cxx_17_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST_CASE( "generalized callables" ) {
CHECK(is_vec_sorted());
}

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

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

0 comments on commit 25443c7

Please sign in to comment.