diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4d241764f..3ee32e795 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -148,12 +148,10 @@ foreach(file ${files}) $<$>:-Wno-deprecated;-Wno-float-equal> $<$:-Wno-deprecated-declarations> ) - # Force to compile with highest warning level and treat warnings as errors - if(MSVC) - target_compile_options(${testcase} PRIVATE /W4 /WX) - else() - target_compile_options(${testcase} PRIVATE -Wall -Wextra -pedantic -Werror) - endif() + target_compile_options(${testcase} PRIVATE + $<$:/W4;/WX>> + $<$>:-Wall;-Wextra;-pedantic;-Werror>> + ) target_include_directories(${testcase} PRIVATE thirdparty/doctest thirdparty/fifo_map diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index cf7496785..7a7586231 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -98,6 +98,8 @@ struct my_allocator : std::allocator { if (next_deallocate_fails) { + (void)p; // Ignored unused + (void)n; // ignored unused next_deallocate_fails = false; throw std::bad_alloc(); }