From: Brad Hubbard Date: Tue, 11 Apr 2017 01:54:32 +0000 (+1000) Subject: test: Suppress cppcheck error X-Git-Tag: v12.0.2~99^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d105ec319a87152effe79a857fb11a99643ed59e;p=ceph.git test: Suppress cppcheck error Signed-off-by: Brad Hubbard --- diff --git a/src/test/librados/io.cc b/src/test/librados/io.cc index f1a53642fa99..e3f83a63845e 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 b28d7e29f9d0..50721ac0da70 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