summaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-07-30 23:24:15 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-07-30 23:24:15 -0500
commit8538878d8dc685b9dd6abae91312e52b9c35bfbd (patch)
treece2785eaba5423d90b540a85f142cf1f53c4cdd6 /src/utils.cc
parent14ab4f7775fe203e6e5cd2b9cb4d364c465c4e4e (diff)
downloadfork-ledger-8538878d8dc685b9dd6abae91312e52b9c35bfbd.tar.gz
fork-ledger-8538878d8dc685b9dd6abae91312e52b9c35bfbd.tar.bz2
fork-ledger-8538878d8dc685b9dd6abae91312e52b9c35bfbd.zip
Guard some function definitions for ASan
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 1a82787d..bdce009f 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -153,6 +153,8 @@ std::size_t current_memory_size()
return memory_size;
}
+#if !defined(__has_feature) || !__has_feature(address_sanitizer)
+
static void trace_new_func(void * ptr, const char * which, std::size_t size)
{
if (! live_memory || ! memory_tracing_active) return;
@@ -221,8 +223,12 @@ static void trace_delete_func(void * ptr, const char * which)
memory_tracing_active = true;
}
+#endif // !defined(__has_feature) || !__has_feature(address_sanitizer)
+
} // namespace ledger
+#if !defined(__has_feature) || !__has_feature(address_sanitizer)
+
void * operator new(std::size_t size) throw (std::bad_alloc) {
void * ptr = std::malloc(size);
if (DO_VERIFY() && ledger::memory_tracing_active)
@@ -268,6 +274,8 @@ void operator delete[](void * ptr, const std::nothrow_t&) throw() {
std::free(ptr);
}
+#endif // !defined(__has_feature) || !__has_feature(address_sanitizer)
+
namespace ledger {
namespace {