diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/utils.cc | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8b2af53..9752b052 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -167,6 +167,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(BUILD_LIBRARY) list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) endif() + list(APPEND _args "-std=c++11 ") list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_pch_filename}) @@ -222,6 +223,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) endif() list(APPEND _args ${GXX_WARNING_FLAGS}) + list(APPEND _args "-std=c++11 ") list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_gch_filename}) 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); |