This is an archive of the discontinued LLVM Phabricator instance.

[config] Warn when POSIX_C_SOURCE breaks threading support on Darwin
AbandonedPublic

Authored by vsk on Oct 4 2017, 3:43 PM.

Details

Reviewers
dexonsmith
bruno
Summary

Prior to macOS 10.13 and iOS 11, defining POSIX_C_SOURCE before
including <thread> resulted in hard-to-understand errors. That
definition causes a bunch of important definitions from the system
headers to be skipped, so users see failures like "can't find
mach_port_t".

This patch adds a friendly warning message about the issue.

rdar://problem/31263056

Diff Detail

Event Timeline

vsk created this revision.Oct 4 2017, 3:43 PM
vsk added a comment.Oct 4 2017, 3:45 PM

I'm not sure how to test the warning against anything but the macOS SDK. When I tried, I hit a -Wincompatible-sysroot issue. I can leave those changes out of this patch if we want to be more conservative.

arphaman added inline comments.
include/__threading_support
26

Please add a brief comment that describes why the check and the warning are needed.

vsk abandoned this revision.Oct 10 2017, 10:38 AM

For those following along, Alex worked out that this doesn't affect apple-clang 802. We took a closer look and found that the build break just affects clang-900, and was introduced in this r290889. The fix (r293167) didn't make it into clang-900. Adding a warning here wouldn't be the right solution, since it would be better to just cherry pick r293167.