feat(util/memory.cpp): use COMP_HAS_SIZED_DEALLOCATION macro

To conditionally include sized deallocation definitions.

Related issue #1044
This commit is contained in:
Soonho Kong 2016-05-24 12:16:53 -04:00 committed by Leonardo de Moura
parent 5cda399125
commit e44f9a0e62

View file

@ -7,6 +7,7 @@ Author: Leonardo de Moura
#include <new>
#include <cstdlib>
#include <iostream>
#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