explicitly export C++ allocator overrides

This doesn't make any difference for GCC, but these aren't replaced
outside of the library with Clang without explicitly exporting them.
This commit is contained in:
Daniel Micay 2018-10-05 02:22:17 -04:00
parent e6e9ac1fc9
commit 4716ff5b92

20
new.cc
View File

@ -41,42 +41,42 @@ static inline void *new_impl(size_t size, bool nothrow) {
return handle_out_of_memory(size, nothrow); return handle_out_of_memory(size, nothrow);
} }
void *operator new(size_t size) { EXPORT void *operator new(size_t size) {
return new_impl(size, false); return new_impl(size, false);
} }
void *operator new[](size_t size) { EXPORT void *operator new[](size_t size) {
return new_impl(size, false); return new_impl(size, false);
} }
void *operator new(size_t size, const std::nothrow_t &) noexcept { EXPORT void *operator new(size_t size, const std::nothrow_t &) noexcept {
return new_impl(size, true); return new_impl(size, true);
} }
void *operator new[](size_t size, const std::nothrow_t &) noexcept { EXPORT void *operator new[](size_t size, const std::nothrow_t &) noexcept {
return new_impl(size, true); return new_impl(size, true);
} }
void operator delete(void *ptr) noexcept { EXPORT void operator delete(void *ptr) noexcept {
h_free(ptr); h_free(ptr);
} }
void operator delete[](void *ptr) noexcept { EXPORT void operator delete[](void *ptr) noexcept {
h_free(ptr); h_free(ptr);
} }
void operator delete(void *ptr, const std::nothrow_t &) noexcept { EXPORT void operator delete(void *ptr, const std::nothrow_t &) noexcept {
h_free(ptr); h_free(ptr);
} }
void operator delete[](void *ptr, const std::nothrow_t &) noexcept { EXPORT void operator delete[](void *ptr, const std::nothrow_t &) noexcept {
h_free(ptr); h_free(ptr);
} }
void operator delete(void *ptr, size_t size) noexcept { EXPORT void operator delete(void *ptr, size_t size) noexcept {
h_free_sized(ptr, size); h_free_sized(ptr, size);
} }
void operator delete[](void *ptr, size_t size) noexcept { EXPORT void operator delete[](void *ptr, size_t size) noexcept {
h_free_sized(ptr, size); h_free_sized(ptr, size);
} }