Fix compilation with -fno-exceptions
Change-Id: I3dbe8be62d2fe94ed6f97fb565a9e417544c58f9 Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
This commit is contained in:
parent
dfa24768a3
commit
c7865e0fc6
@ -252,8 +252,10 @@ struct AllocFailer
|
|||||||
static void *new_helper(std::size_t size)
|
static void *new_helper(std::size_t size)
|
||||||
{
|
{
|
||||||
void *ptr = malloc(size);
|
void *ptr = malloc(size);
|
||||||
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,8 +265,10 @@ static void *new_helper(std::size_t size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// overload operator new
|
// 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); }
|
||||||
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(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); }
|
void* operator new[](std::size_t size, const std::nothrow_t&) throw() { return malloc(size); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user