summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/__config12
-rw-r--r--libcxx/include/new5
-rw-r--r--libcxx/src/new.cpp4
3 files changed, 19 insertions, 2 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index f214c7b87fd..63f477b92db 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -848,6 +848,18 @@ template <unsigned> struct __static_assert_check {};
#define _DECLARE_C99_LDBL_MATH 1
#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__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
diff --git a/libcxx/include/new b/libcxx/include/new
index 6589f16b7a1..6e43501d299 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -101,8 +101,9 @@ void operator delete[](void* ptr, void*) noexcept;
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
- (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+ (!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+ (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 391718fdad7..b1e8ee324d8 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _NOEXCEPT
::operator delete[](ptr);
}
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
_LIBCPP_WEAK
void *
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);
}
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
#endif // !__GLIBCXX__
namespace std
OpenPOWER on IntegriCloud