From e44f9a0e6272264fff0561eaf677bc8118c48865 Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Tue, 24 May 2016 12:16:53 -0400 Subject: [PATCH] feat(util/memory.cpp): use COMP_HAS_SIZED_DEALLOCATION macro To conditionally include sized deallocation definitions. Related issue #1044 --- src/util/memory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util/memory.cpp b/src/util/memory.cpp index 715df082c..981b82671 100644 --- a/src/util/memory.cpp +++ b/src/util/memory.cpp @@ -7,6 +7,7 @@ Author: Leonardo de Moura #include #include #include +#include "./compatibility.h" #include "util/exception.h" #include "util/memory.h" @@ -194,7 +195,11 @@ void operator delete[](void * ptr) throw() { return lean::free(ptr); } void* operator new(std::size_t sz, std::nothrow_t const &) noexcept { return lean::malloc(sz, false); } void* operator new[](std::size_t sz, std::nothrow_t const &) noexcept { return lean::malloc(sz, false); } +#ifdef COMP_HAS_SIZED_DEALLOCATION +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wc++14-compat" -void operator delete(void * ptr, size_t _size) throw() { return lean::free(ptr); } -void operator delete[](void * ptr, size_t _size) throw() { return lean::free(ptr); } +void operator delete(void * ptr, size_t) throw() { return lean::free(ptr); } +void operator delete[](void * ptr, size_t) throw() { return lean::free(ptr); } +#pragma GCC diagnostic pop +#endif #endif