HomePhabricator

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

Authored by ldionne on Jul 27 2020, 11:25 AM.

Description

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

rdar://66113878

Details

Committed
ldionneJul 28 2020, 12:13 PM
Parents
rG1bd7c0223396: [libc++] Clean up tests for "optional" C11 features
Branches
Unknown
Tags
Unknown

Event Timeline

phosek added a subscriber: phosek.Aug 19 2020, 10:19 PM

@ldionne we've seen failures in various third party libraries like BoringSSL or ICU that were caused by this change. The problem is that timespec_get and aligned_alloc are only available if __DARWIN_C_LEVEL >= __DARWIN_C_FULL, but many existing libraries define _XOPEN_SOURCE in which case __DARWIN_C_LEVEL == _POSIX_C_SOURCE unless _DARWIN_C_SOURCE or _NONSTD_SOURCE are defined as well.

@ldionne we've seen failures in various third party libraries like BoringSSL or ICU that were caused by this change. The problem is that timespec_get and aligned_alloc are only available if __DARWIN_C_LEVEL >= __DARWIN_C_FULL, but many existing libraries define _XOPEN_SOURCE in which case __DARWIN_C_LEVEL == _POSIX_C_SOURCE unless _DARWIN_C_SOURCE or _NONSTD_SOURCE are defined as well.

Thanks for the heads up. I'll follow up in https://bugs.llvm.org/show_bug.cgi?id=47208.