[libcxx-commits] [libcxx] 67dfba9 - [libc++] Provide std::aligned_alloc and std::timespec_get on Apple platforms

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 28 12:13:14 PDT 2020


Author: Louis Dionne
Date: 2020-07-28T15:13:05-04:00
New Revision: 67dfba96296b37f7bac9b4a68572288bc44b63b2

URL: https://github.com/llvm/llvm-project/commit/67dfba96296b37f7bac9b4a68572288bc44b63b2
DIFF: https://github.com/llvm/llvm-project/commit/67dfba96296b37f7bac9b4a68572288bc44b63b2.diff

LOG: [libc++] Provide std::aligned_alloc and std::timespec_get on Apple platforms

rdar://66113878

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/test/support/test_macros.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index a9eca04959bf..8c22323c2bab 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -380,7 +380,17 @@
 #      define _LIBCPP_HAS_QUICK_EXIT
 #      define _LIBCPP_HAS_TIMESPEC_GET
 #    endif
-#  endif // __linux__
+#  elif defined(__APPLE__)
+     // timespec_get and aligned_alloc were introduced in macOS 10.15 and
+     // aligned releases
+#    if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \
+         __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
+         __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
+         __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)
+#      define _LIBCPP_HAS_ALIGNED_ALLOC
+#      define _LIBCPP_HAS_TIMESPEC_GET
+#    endif
+#  endif // __APPLE__
 #endif
 
 #ifndef _LIBCPP_CXX03_LANG

diff  --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 15c6a280dc19..6fe1c56a5588 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -208,7 +208,17 @@
 #      define TEST_HAS_ALIGNED_ALLOC
 #      define TEST_HAS_TIMESPEC_GET
 #    endif
-#  endif
+#  elif defined(__APPLE__)
+     // timespec_get and aligned_alloc were introduced in macOS 10.15 and
+     // aligned releases
+#    if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \
+         __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
+         __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
+         __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)
+#      define TEST_HAS_ALIGNED_ALLOC
+#      define TEST_HAS_TIMESPEC_GET
+#    endif
+#  endif // __APPLE__
 #endif
 
 /* Features that were introduced in C++14 */


        


More information about the libcxx-commits mailing list