]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
massif regtest: keep churning with overloaded-new test
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 4 Nov 2023 15:35:05 +0000 (16:35 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 4 Nov 2023 15:35:05 +0000 (16:35 +0100)
Solaris 11.3 doesn't have aligned_alloc so remove it.

In any case I think it's better to use dummy allocators since
that means there is no risk of accidentally falling through
to malloc/free.

massif/tests/overloaded-new.cpp

index c531ca8830c60fac3b13a819ddfc817993c5a221..5ad92894e9d66ced732c2461d22e135892f42ff3 100644 (file)
@@ -16,62 +16,62 @@ typedef struct {
 
 __attribute__((noinline)) void* operator new (std::size_t n)
 {
-    return malloc(n);
+    return (void*)12345;
 }
 
 __attribute__((noinline)) void* operator new (std::size_t n, std::nothrow_t const &)
 {
-    return malloc(n);
+    return (void*)23456;
 }
 
 __attribute__((noinline)) void* operator new[] (std::size_t n)
 {
-    return malloc(n);
+    return (void*)34567;
 }
 
 __attribute__((noinline)) void* operator new[] (std::size_t n, std::nothrow_t const &)
 {
-    return malloc(n);
+    return (void*)45678;
 }
 
 __attribute__((noinline)) void* operator new (std::size_t size, std::align_val_t al)
 {
-    return aligned_alloc(static_cast<std::size_t>(al), size);
+    return (void*)56789;
 }
 
 __attribute__((noinline)) void* operator new[] (std::size_t size, std::align_val_t al)
 {
-    return aligned_alloc(static_cast<std::size_t>(al), size);
+    return (void*)67890;
 }
 
 __attribute__((noinline)) void* operator new(std::size_t size, std::align_val_t al, const std::nothrow_t&) noexcept
 {
-    return aligned_alloc(static_cast<std::size_t>(al), size);
+    return (void*)78901;
 }
 
 __attribute__((noinline)) void* operator new[](std::size_t size, std::align_val_t al, const std::nothrow_t&) noexcept
 {
-    return aligned_alloc(static_cast<std::size_t>(al), size);
+    return (void*)89012;
 }
 
 __attribute__((noinline)) void operator delete (void* p)
 {
-    free(p);
+
 }
 
 __attribute__((noinline)) void operator delete[] (void* p)
 {
-    free(p);
+
 }
 
 __attribute__((noinline))  void operator delete (void* ptr, std::align_val_t al ) noexcept
 {
-    free(ptr);
+
 }
 
 __attribute__((noinline))  void operator delete[] (void* ptr, std::align_val_t al ) noexcept
 {
-    free(ptr);
+
 }
 
 int main(void)