From d105ec319a87152effe79a857fb11a99643ed59e Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Tue, 11 Apr 2017 11:54:32 +1000 Subject: [PATCH] test: Suppress cppcheck error Signed-off-by: Brad Hubbard --- src/test/librados/io.cc | 46 ++++++++++++++++++++--------------------- src/test/on_exit.cc | 1 + 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/test/librados/io.cc b/src/test/librados/io.cc index f1a53642fa9..e3f83a63845 100644 --- a/src/test/librados/io.cc +++ b/src/test/librados/io.cc @@ -827,12 +827,12 @@ TEST_F(LibRadosIoEC, OverlappingWriteRoundTrip) { char *buf = (char *)new char[dbsize]; char *buf2 = (char *)new char[bsize]; char *buf3 = (char *)new char[dbsize]; - auto lam = [&] { - delete[] buf; - delete[] buf2; - delete[] buf3; - }; - scope_guard sg(std::forward(lam)); + auto cleanup = [&] { + delete[] buf; + delete[] buf2; + delete[] buf3; + }; + scope_guard sg(std::move(cleanup)); memset(buf, 0xcc, dbsize); ASSERT_EQ(0, rados_write(ioctx, "foo", buf, dbsize, 0)); memset(buf2, 0xdd, bsize); @@ -848,11 +848,11 @@ TEST_F(LibRadosIoECPP, OverlappingWriteRoundTripPP) { int dbsize = bsize * 2; char *buf = (char *)new char[dbsize]; char *buf2 = (char *)new char[bsize]; - auto lam = [&] { - delete[] buf; - delete[] buf2; - }; - scope_guard sg(std::forward(lam)); + auto cleanup = [&] { + delete[] buf; + delete[] buf2; + }; + scope_guard sg(std::move(cleanup)); memset(buf, 0xcc, dbsize); bufferlist bl1; bl1.append(buf, dbsize); @@ -918,13 +918,13 @@ TEST_F(LibRadosIoEC, AppendRoundTrip) { char *buf3 = (char *)new char[alignment *2]; int uasize = alignment/2; char *unalignedbuf = (char *)new char[uasize]; - auto lam = [&] { - delete[] buf; - delete[] buf2; - delete[] buf3; - delete[] unalignedbuf; - }; - scope_guard sg(std::forward(lam)); + auto cleanup = [&] { + delete[] buf; + delete[] buf2; + delete[] buf3; + delete[] unalignedbuf; + }; + scope_guard sg(std::move(cleanup)); memset(buf, 0xde, alignment); ASSERT_EQ(0, rados_append(ioctx, "foo", buf, alignment)); memset(buf2, 0xad, alignment); @@ -941,11 +941,11 @@ TEST_F(LibRadosIoEC, AppendRoundTrip) { TEST_F(LibRadosIoECPP, AppendRoundTripPP) { char *buf = (char *)new char[alignment]; char *buf2 = (char *)new char[alignment]; - auto lam = [&] { - delete[] buf; - delete[] buf2; - }; - scope_guard sg(std::forward(lam)); + auto cleanup = [&] { + delete[] buf; + delete[] buf2; + }; + scope_guard sg(std::move(cleanup)); memset(buf, 0xde, alignment); bufferlist bl1; bl1.append(buf, alignment); diff --git a/src/test/on_exit.cc b/src/test/on_exit.cc index b28d7e29f9d..50721ac0da7 100644 --- a/src/test/on_exit.cc +++ b/src/test/on_exit.cc @@ -10,6 +10,7 @@ # ifdef MAP_ANON # define MAP_ANONYMOUS MAP_ANON # else +// cppcheck-suppress preprocessorErrorDirective # error "Don't know how to create anonymous mmap" # endif #endif -- 2.39.5