[libcxx] r339661 - Merging r339431:

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 02:13:39 PDT 2018


Author: hans
Date: Tue Aug 14 02:13:39 2018
New Revision: 339661

URL: http://llvm.org/viewvc/llvm-project?rev=339661&view=rev
Log:
Merging r339431:
------------------------------------------------------------------------
r339431 | ldionne | 2018-08-10 15:24:56 +0200 (Fri, 10 Aug 2018) | 16 lines

[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
------------------------------------------------------------------------

Added:
    libcxx/branches/release_70/test/libcxx/memory/aligned_allocation_macro.pass.cpp
      - copied unchanged from r339431, libcxx/trunk/test/libcxx/memory/aligned_allocation_macro.pass.cpp
Modified:
    libcxx/branches/release_70/   (props changed)
    libcxx/branches/release_70/include/__config
    libcxx/branches/release_70/include/new

Propchange: libcxx/branches/release_70/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 14 02:13:39 2018
@@ -1 +1,2 @@
 /libcxx/branches/apple:136569-137939
+/libcxx/trunk:339431

Modified: libcxx/branches/release_70/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/include/__config?rev=339661&r1=339660&r2=339661&view=diff
==============================================================================
--- libcxx/branches/release_70/include/__config (original)
+++ libcxx/branches/release_70/include/__config Tue Aug 14 02:13:39 2018
@@ -991,6 +991,11 @@ template <unsigned> struct __static_asse
 #  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

Modified: libcxx/branches/release_70/include/new
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_70/include/new?rev=339661&r1=339660&r2=339661&view=diff
==============================================================================
--- libcxx/branches/release_70/include/new (original)
+++ libcxx/branches/release_70/include/new Tue Aug 14 02:13:39 2018
@@ -108,13 +108,6 @@ void  operator delete[](void* ptr, void*
 # 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) || \




More information about the cfe-commits mailing list