Guard C++ aligned APIs

This commit is contained in:
Yinan Zhang 2019-11-25 15:27:52 -08:00 committed by Qi Wang
parent 6945371778
commit 5c47a30227

View File

@ -97,6 +97,7 @@ newImpl(std::size_t size) noexcept(IsNoExcept) {
return handleOOM(size, IsNoExcept); return handleOOM(size, IsNoExcept);
} }
#if __cpp_aligned_new >= 201606
template <bool IsNoExcept> template <bool IsNoExcept>
JEMALLOC_ALWAYS_INLINE JEMALLOC_ALWAYS_INLINE
void * void *
@ -108,6 +109,7 @@ alignedNewImpl(std::size_t size, std::align_val_t alignment) noexcept(IsNoExcept
return handleOOM(size, IsNoExcept); return handleOOM(size, IsNoExcept);
} }
#endif // __cpp_aligned_new
JEMALLOC_ALWAYS_INLINE JEMALLOC_ALWAYS_INLINE
void void
@ -118,6 +120,7 @@ sizedDeleteImpl(void* ptr, std::size_t size) noexcept {
je_sdallocx_noflags(ptr, size); je_sdallocx_noflags(ptr, size);
} }
#if __cpp_aligned_new >= 201606
JEMALLOC_ALWAYS_INLINE JEMALLOC_ALWAYS_INLINE
void void
alignedSizedDeleteImpl(void* ptr, std::size_t size, std::align_val_t alignment) noexcept { alignedSizedDeleteImpl(void* ptr, std::size_t size, std::align_val_t alignment) noexcept {
@ -129,6 +132,7 @@ alignedSizedDeleteImpl(void* ptr, std::size_t size, std::align_val_t alignment)
} }
je_sdallocx(ptr, size, MALLOCX_ALIGN(alignment)); je_sdallocx(ptr, size, MALLOCX_ALIGN(alignment));
} }
#endif // __cpp_aligned_new
void * void *
operator new(std::size_t size) { operator new(std::size_t size) {