3535#include " CppUTest/TestHarness_c.h"
3636#include " CppUTest/SimpleMutex.h"
3737#include " DummyMemoryLeakDetector.h"
38+ #include " AllocationInCppFile.h"
3839
3940TEST_GROUP (MemoryLeakWarningLocalDetectorTest)
4041{
@@ -471,28 +472,17 @@ TEST(MemoryLeakWarningThreadSafe, turnOnThreadSafeNewDeleteOverloadsDebug)
471472 MemoryLeakWarningPlugin::turnOnDefaultNotThreadSafeNewDeleteOverloads ();
472473}
473474
474- #ifdef __clang__
475-
476- IGNORE_TEST (MemoryLeakWarningThreadSafe, turnOnThreadSafeNewDeleteOverloads)
477- {
478- /* Clang misbehaves with -O2 - it will not overload operator new or
479- * operator new[] no matter what. Therefore, this test is must be ignored.
480- */
481- }
482-
483- #else
484-
485475TEST (MemoryLeakWarningThreadSafe, turnOnThreadSafeNewDeleteOverloads)
486476{
487477#undef new
488478
489479 size_t storedAmountOfLeaks = MemoryLeakWarningPlugin::getGlobalDetector ()->totalMemoryLeaks (mem_leak_period_all);
490480 MemoryLeakWarningPlugin::turnOnThreadSafeNewDeleteOverloads ();
491481
492- int *n = new int ;
493- int *n_nothrow = new (std::nothrow) int ;
494- char *str = new char [ 20 ] ;
495- char *str_nothrow = new (std::nothrow) char [ 20 ] ;
482+ int *n = newIntAllocationWithoutMacro () ;
483+ int *n_nothrow = newIntNoThowAllocationWithoutMacro () ;
484+ char *str = newCharArrayAllocationWithoutMacro () ;
485+ char *str_nothrow = newCharArrayNoThrowAllocationWithoutMacro () ;
496486
497487 LONGS_EQUAL (storedAmountOfLeaks + 4 , MemoryLeakWarningPlugin::getGlobalDetector ()->totalMemoryLeaks (mem_leak_period_all));
498488 CHECK_EQUAL (4 , mutexLockCount);
@@ -516,5 +506,3 @@ TEST(MemoryLeakWarningThreadSafe, turnOnThreadSafeNewDeleteOverloads)
516506#endif
517507
518508#endif
519-
520- #endif
0 commit comments