summaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 4f810f93..9b528f54 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2015, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -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);
@@ -566,7 +574,7 @@ std::ostream * _log_stream = &std::cerr;
std::ostringstream _log_buffer;
#if TRACING_ON
-uint8_t _trace_level;
+uint16_t _trace_level;
#endif
static bool logger_has_run = false;