From 1aa0e03a9e7f9f1a51395a60fc1336bea3ca2aa9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 7 May 2014 20:49:45 +0000 Subject: Fix build for building with g++ 4.8 --- src/utils.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils.cc') diff --git a/src/utils.cc b/src/utils.cc index 2256d22a..741ce79d 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -229,7 +229,11 @@ static void trace_delete_func(void * ptr, const char * which) //#if !defined(__has_feature) || !__has_feature(address_sanitizer) +#ifdef _GLIBCXX_THROW +void * operator new(std::size_t size) _GLIBCXX_THROW(std::bad_alloc) { +#else void * operator new(std::size_t size) throw (std::bad_alloc) { +#endif void * ptr = std::malloc(size); if (DO_VERIFY() && ledger::memory_tracing_active) ledger::trace_new_func(ptr, "new", size); @@ -241,7 +245,11 @@ void * operator new(std::size_t size, const std::nothrow_t&) throw() { ledger::trace_new_func(ptr, "new", size); return ptr; } +#ifdef _GLIBCXX_THROW +void * operator new[](std::size_t size) _GLIBCXX_THROW(std::bad_alloc) { +#else void * operator new[](std::size_t size) throw (std::bad_alloc) { +#endif void * ptr = std::malloc(size); if (DO_VERIFY() && ledger::memory_tracing_active) ledger::trace_new_func(ptr, "new[]", size); -- cgit v1.2.3