[libcxx] r292566 - Merge r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 17:54:54 PST 2017


Author: ericwf
Date: Thu Jan 19 19:54:53 2017
New Revision: 292566

URL: http://llvm.org/viewvc/llvm-project?rev=292566&view=rev
Log:
Merge r292564 - Disable aligned new/delete on Apple platforms without posix_memalign

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.

Modified:
    libcxx/branches/release_40/include/__config
    libcxx/branches/release_40/include/new
    libcxx/branches/release_40/src/new.cpp

Modified: libcxx/branches/release_40/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__config?rev=292566&r1=292565&r2=292566&view=diff
==============================================================================
--- libcxx/branches/release_40/include/__config (original)
+++ libcxx/branches/release_40/include/__config Thu Jan 19 19:54:53 2017
@@ -835,6 +835,18 @@ template <unsigned> struct __static_asse
 #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

Modified: libcxx/branches/release_40/include/new
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/new?rev=292566&r1=292565&r2=292566&view=diff
==============================================================================
--- libcxx/branches/release_40/include/new (original)
+++ libcxx/branches/release_40/include/new Thu Jan 19 19:54:53 2017
@@ -101,8 +101,9 @@ void  operator delete[](void* ptr, void*
 # 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
 

Modified: libcxx/branches/release_40/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/src/new.cpp?rev=292566&r1=292565&r2=292566&view=diff
==============================================================================
--- libcxx/branches/release_40/src/new.cpp (original)
+++ libcxx/branches/release_40/src/new.cpp Thu Jan 19 19:54:53 2017
@@ -151,6 +151,8 @@ operator delete[] (void* ptr, size_t) _N
     ::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, st
     ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std




More information about the cfe-commits mailing list