diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -294,9 +294,6 @@ # define _LIBCPP_HAS_BITSCAN64 # endif # define _LIBCPP_HAS_OPEN_WITH_WCHAR -# if defined(_LIBCPP_MSVCRT) -# define _LIBCPP_HAS_QUICK_EXIT -# endif // Some CRT APIs are unavailable to store apps # if defined(WINAPI_FAMILY) @@ -392,72 +389,6 @@ # define _LIBCPP_NO_CFI #endif -// If the compiler supports using_if_exists, pretend we have those functions and they'll -// be picked up if the C library provides them. -// -// TODO: Once we drop support for Clang 12, we can assume the compiler supports using_if_exists -// for platforms that don't have a conforming C11 library, so we can drop this whole thing. -#if __has_attribute(using_if_exists) -# define _LIBCPP_HAS_TIMESPEC_GET -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_ALIGNED_ALLOC -#else -#if (defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 2011)) || __cplusplus >= 201103L -# if defined(__FreeBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# if __FreeBSD_version >= 1300064 || \ - (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000) -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(__BIONIC__) -# if __ANDROID_API__ >= 21 -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if __ANDROID_API__ >= 28 -# define _LIBCPP_HAS_ALIGNED_ALLOC -# endif -# if __ANDROID_API__ >= 29 -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(__Fuchsia__) || defined(__wasi__) || defined(__NetBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__OpenBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__linux__) -# if !defined(_LIBCPP_HAS_MUSL_LIBC) -# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if _LIBCPP_GLIBC_PREREQ(2, 17) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# else // defined(_LIBCPP_HAS_MUSL_LIBC) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(_LIBCPP_MSVCRT) - // Using Microsoft's C Runtime library, not MinGW -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__APPLE__) - // timespec_get and aligned_alloc were introduced in macOS 10.15 and - // aligned releases -# if ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# endif // __APPLE__ -#endif -#endif // __has_attribute(using_if_exists) - #ifndef _LIBCPP_CXX03_LANG # define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) #elif defined(_LIBCPP_COMPILER_CLANG_BASED) diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib --- a/libcxx/include/cstdlib +++ b/libcxx/include/cstdlib @@ -132,11 +132,11 @@ using ::wctomb _LIBCPP_USING_IF_EXISTS; using ::mbstowcs _LIBCPP_USING_IF_EXISTS; using ::wcstombs _LIBCPP_USING_IF_EXISTS; -#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT) +#if !defined(_LIBCPP_CXX03_LANG) using ::at_quick_exit _LIBCPP_USING_IF_EXISTS; using ::quick_exit _LIBCPP_USING_IF_EXISTS; #endif -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC) +#if _LIBCPP_STD_VER > 14 using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; #endif diff --git a/libcxx/include/ctime b/libcxx/include/ctime --- a/libcxx/include/ctime +++ b/libcxx/include/ctime @@ -52,27 +52,13 @@ # pragma GCC system_header #endif -// FIXME: -// Apple SDKs don't define ::timespec_get unconditionally in C++ mode. This -// should be fixed in future SDKs, but for the time being we need to avoid -// trying to use that declaration when the SDK doesn't provide it. Note that -// we're detecting this here instead of in <__config> because we can't include -// system headers from <__config>, since it leads to circular module dependencies. -// This is also meant to be a very temporary workaround until the SDKs are fixed. -#if defined(__APPLE__) && !__has_attribute(using_if_exists) -# include -# if defined(_LIBCPP_HAS_TIMESPEC_GET) && (__DARWIN_C_LEVEL < __DARWIN_C_FULL) -# define _LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED -# endif -#endif - _LIBCPP_BEGIN_NAMESPACE_STD using ::clock_t _LIBCPP_USING_IF_EXISTS; using ::size_t _LIBCPP_USING_IF_EXISTS; using ::time_t _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) +#if _LIBCPP_STD_VER > 14 using ::timespec _LIBCPP_USING_IF_EXISTS; #endif using ::clock _LIBCPP_USING_IF_EXISTS; @@ -84,7 +70,7 @@ using ::gmtime _LIBCPP_USING_IF_EXISTS; using ::localtime _LIBCPP_USING_IF_EXISTS; using ::strftime _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED) +#if _LIBCPP_STD_VER > 14 using ::timespec_get _LIBCPP_USING_IF_EXISTS; #endif