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
     1.1 --- a/test/CMakeLists.txt	Sat Apr 16 22:12:47 2022 +0200
     1.2 +++ b/test/CMakeLists.txt	Mon Apr 18 14:35:41 2022 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  # Load Google Test Framework
     1.5 -set(CMAKE_CXX_STANDARD 11)
     1.6 +set(CMAKE_CXX_STANDARD 17)
     1.7  
     1.8  include(FetchContent)
     1.9  FetchContent_Declare(
     2.1 --- a/test/test_allocator.cpp	Sat Apr 16 22:12:47 2022 +0200
     2.2 +++ b/test/test_allocator.cpp	Mon Apr 18 14:35:41 2022 +0200
     2.3 @@ -76,7 +76,11 @@
     2.4  TEST(Allocator, FailingReallocate) {
     2.5      // Mock an allocator that always returns nullptr on realloc
     2.6      cx_allocator_class mock_cl;
     2.7 -    mock_cl.realloc = [](void* p, void* d, size_t n) -> void* { return nullptr; };
     2.8 +    mock_cl.realloc = [](
     2.9 +            [[maybe_unused]]void *p,
    2.10 +            [[maybe_unused]]void *d,
    2.11 +            [[maybe_unused]]size_t n
    2.12 +    ) -> void * { return nullptr; };
    2.13      cx_allocator_s mock{&mock_cl, nullptr};
    2.14  
    2.15      void *test = calloc(8, 1);

mercurial