summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2018-08-10 13:24:56 +0000
committerLouis Dionne <ldionne@apple.com>2018-08-10 13:24:56 +0000
commit53ac1776f3be82a97f94591cc08c1864f5e24f4b (patch)
tree29e3de6990c9cb5af6303fe2c3e6d4c6ddd96962 /libcxx/include
parenta94f3363ef6c8182b915699b68502cc14aac504b (diff)
downloadbcm5719-llvm-53ac1776f3be82a97f94591cc08c1864f5e24f4b.tar.gz
bcm5719-llvm-53ac1776f3be82a97f94591cc08c1864f5e24f4b.zip
[libc++] Enable aligned allocation based on feature test macro, irrespective of standard
Summary: The current code enables aligned allocation functions when compiling in C++17 and later. This is a problem because aligned allocation functions might not be supported on the target platform, which leads to an error at link time. Since r338934, Clang knows not to define __cpp_aligned_new when it's not available on the target platform -- this commit takes advantage of that to only use aligned allocation functions when they are available. Reviewers: vsapsai, EricWF Subscribers: christof, dexonsmith, cfe-commits, EricWF, mclow.lists Differential Revision: https://reviews.llvm.org/D50344 llvm-svn: 339431
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/__config5
-rw-r--r--libcxx/include/new7
2 files changed, 5 insertions, 7 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 0f8f5a82be3..4c3b25b222e 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -988,6 +988,11 @@ template <unsigned> struct __static_assert_check {};
# endif
#endif // defined(__APPLE__)
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+ !defined(_LIBCPP_BUILDING_LIBRARY) && \
+ (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
diff --git a/libcxx/include/new b/libcxx/include/new
index d33f6918806..d27ff298221 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -108,13 +108,6 @@ void operator delete[](void* ptr, void*) noexcept;
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
-#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
- (!(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER > 14 || \
- (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
-# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
-#endif
-
-
#if !__has_builtin(__builtin_operator_new) || \
__has_builtin(__builtin_operator_new) < 201802L || \
defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \
OpenPOWER on IntegriCloud