Mon, 18 Apr 2022 14:35:41 +0200
add [[maybe_unused]] attributed to params of mocked function
test/CMakeLists.txt | file | annotate | diff | comparison | revisions | |
test/test_allocator.cpp | file | annotate | diff | comparison | revisions |
--- a/test/CMakeLists.txt Sat Apr 16 22:12:47 2022 +0200 +++ b/test/CMakeLists.txt Mon Apr 18 14:35:41 2022 +0200 @@ -1,5 +1,5 @@ # Load Google Test Framework -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) include(FetchContent) FetchContent_Declare(
--- a/test/test_allocator.cpp Sat Apr 16 22:12:47 2022 +0200 +++ b/test/test_allocator.cpp Mon Apr 18 14:35:41 2022 +0200 @@ -76,7 +76,11 @@ TEST(Allocator, FailingReallocate) { // Mock an allocator that always returns nullptr on realloc cx_allocator_class mock_cl; - mock_cl.realloc = [](void* p, void* d, size_t n) -> void* { return nullptr; }; + mock_cl.realloc = []( + [[maybe_unused]]void *p, + [[maybe_unused]]void *d, + [[maybe_unused]]size_t n + ) -> void * { return nullptr; }; cx_allocator_s mock{&mock_cl, nullptr}; void *test = calloc(8, 1);