summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2011-10-23 14:25:28 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-23 15:29:35 +0200
commitc7865e0fc6a83d8989d8ae4457f96a7f045d41d8 (patch)
tree0ef836e97751de65f69b5dcf47361ce347bfd581 /tests/auto
parentdfa24768a3243eda68d91f573050bf23f96da2dd (diff)
Fix compilation with -fno-exceptions
Change-Id: I3dbe8be62d2fe94ed6f97fb565a9e417544c58f9 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/integrationtests/exceptionsafety_objects/oomsimulator.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/integrationtests/exceptionsafety_objects/oomsimulator.h b/tests/auto/integrationtests/exceptionsafety_objects/oomsimulator.h
index ed4bb53922..f2db6949cc 100644
--- a/tests/auto/integrationtests/exceptionsafety_objects/oomsimulator.h
+++ b/tests/auto/integrationtests/exceptionsafety_objects/oomsimulator.h
@@ -252,8 +252,10 @@ struct AllocFailer
static void *new_helper(std::size_t size)
{
void *ptr = malloc(size);
+#ifndef QT_NO_EXCEPTIONS
if (!ptr)
throw std::bad_alloc();
+#endif
return ptr;
}
@@ -263,8 +265,10 @@ static void *new_helper(std::size_t size)
#endif
// overload operator new
+#ifndef QT_NO_EXCEPTIONS
void* operator new(size_t size) throw (std::bad_alloc) { return new_helper(size); }
void* operator new[](size_t size) throw (std::bad_alloc) { return new_helper(size); }
+#endif
void* operator new(size_t size, const std::nothrow_t&) throw() { return malloc(size); }
void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc(size); }