summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alkondratenko@gmail.com>2021-02-21 12:40:45 -0800
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2021-02-21 12:41:36 -0800
commit35301e2e59b30b7379981e60f3046124a2dfd68e (patch)
tree4177b64595103f14c3f380e237e23b030d018411
parentfa412adfe38ffd3f545a0e10139bd20b38b688e9 (diff)
downloadgperftools-35301e2e59b30b7379981e60f3046124a2dfd68e.tar.gz
add missing noopt wrappings around more operator new calls
This fixes tests passing on clang which otherwise eliminates those new/delete calls so checking for hooks being called failed.
-rw-r--r--src/tests/tcmalloc_unittest.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tests/tcmalloc_unittest.cc b/src/tests/tcmalloc_unittest.cc
index d4d031f..af47a4c 100644
--- a/src/tests/tcmalloc_unittest.cc
+++ b/src/tests/tcmalloc_unittest.cc
@@ -1408,14 +1408,14 @@ static int RunAllTests(int argc, char** argv) {
delete[] poveraligned;
VerifyDeleteHookWasCalled();
- poveraligned = new(std::nothrow) overaligned_type;
+ poveraligned = noopt(new(std::nothrow) overaligned_type);
CHECK(poveraligned != NULL);
CHECK((((size_t)poveraligned) % OVERALIGNMENT) == 0u);
VerifyNewHookWasCalled();
delete poveraligned;
VerifyDeleteHookWasCalled();
- poveraligned = new(std::nothrow) overaligned_type[10];
+ poveraligned = noopt(new(std::nothrow) overaligned_type[10]);
CHECK(poveraligned != NULL);
CHECK((((size_t)poveraligned) % OVERALIGNMENT) == 0u);
VerifyNewHookWasCalled();
@@ -1423,14 +1423,14 @@ static int RunAllTests(int argc, char** argv) {
VerifyDeleteHookWasCalled();
// Another way of calling operator new
- p2 = static_cast<char*>(::operator new(100, std::align_val_t(OVERALIGNMENT)));
+ p2 = noopt(static_cast<char*>(::operator new(100, std::align_val_t(OVERALIGNMENT))));
CHECK(p2 != NULL);
CHECK((((size_t)p2) % OVERALIGNMENT) == 0u);
VerifyNewHookWasCalled();
::operator delete(p2, std::align_val_t(OVERALIGNMENT));
VerifyDeleteHookWasCalled();
- p2 = static_cast<char*>(::operator new(100, std::align_val_t(OVERALIGNMENT), std::nothrow));
+ p2 = noopt(static_cast<char*>(::operator new(100, std::align_val_t(OVERALIGNMENT), std::nothrow)));
CHECK(p2 != NULL);
CHECK((((size_t)p2) % OVERALIGNMENT) == 0u);
VerifyNewHookWasCalled();