[PATCH] D28931: Disable aligned new/delete on Apple platforms without posix_memalign

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


EricWF updated this revision to Diff 85072.
EricWF added a comment.

- Remove NFC parts of this patch and commit them to master.


https://reviews.llvm.org/D28931

Files:
  include/__config
  include/new
  src/new.cpp


Index: src/new.cpp
===================================================================
--- src/new.cpp
+++ src/new.cpp
@@ -151,6 +151,8 @@
     ::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[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std
Index: include/new
===================================================================
--- include/new
+++ include/new
@@ -101,8 +101,9 @@
 # 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
 
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -126,6 +126,13 @@
 # define _LIBCPP_ABI_ITANIUM
 #endif
 
+#if defined(__APPLE__)
+# include <Availability.h>
+# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# endif
+#endif // defined(__APPLE__)
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include <features.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28931.85072.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170120/9d9543ff/attachment.bin>


More information about the cfe-commits mailing list