Disable aligned new/delete on Apple platforms without posix_memalign
Summary: This patch disables the aligned new/delet overloads on Apple platforms without `posix_memalign`. This fixes libc++.dylib build regressions on such platforms. This fixes http://llvm.org/PR31448. This patch should also be merged into the 4.0 release branch Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28931 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292564 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -848,6 +848,18 @@ template <unsigned> struct __static_assert_check {};
|
|||||||
#define _DECLARE_C99_LDBL_MATH 1
|
#define _DECLARE_C99_LDBL_MATH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
|
||||||
|
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
|
||||||
|
# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||||
|
# endif
|
||||||
|
# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
|
# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
|
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif // defined(__APPLE__)
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -101,8 +101,9 @@ void operator delete[](void* ptr, void*) noexcept;
|
|||||||
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
|
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
|
||||||
(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
|
(!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
|
||||||
|
(defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
|
||||||
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _NOEXCEPT
|
|||||||
::operator delete[](ptr);
|
::operator delete[](ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||||
|
|
||||||
_LIBCPP_WEAK
|
_LIBCPP_WEAK
|
||||||
void *
|
void *
|
||||||
operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
|
operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
|
||||||
@@ -275,6 +277,8 @@ operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
|
|||||||
::operator delete[](ptr, alignment);
|
::operator delete[](ptr, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||||
|
|
||||||
#endif // !__GLIBCXX__
|
#endif // !__GLIBCXX__
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
|||||||
Reference in New Issue
Block a user