add [[maybe_unused]] attributed to params of mocked function

Mon, 18 Apr 2022 14:35:41 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 18 Apr 2022 14:35:41 +0200
changeset 522
b91c50d023f4
parent 521
e5dc54131d55
child 523
6a981ec4d58b

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);

mercurial