diff --git a/libcxx/include/__config b/libcxx/include/__config index a9eca04959bf4..8c22323c2babe 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 15c6a280dc192..6fe1c56a5588e 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 */