syscall() has been deprecated and is not available on macOS 10.12.
jdoerfert yln AndreyChurbanov
- Group Reviewers
- rG09af378f49dc: [OpenMP] Fix build on macOS sdk 10.12 and newer
I am not an expert on MacOS, but this #if looks wrong. Because on earlier systems macro __MAC_10_12 is not defined, thus making the comparison to always be TRUE, and the code on #else is then a dead code.
Probably the comparison with the value of the macro (like 101200) could work instead.
For the sanitizers we are going the route of requiring a SDK that isn't super old. Asking people/CI builders to upgrade to SDK 10.12 for building seems reasonable at this point (https://reviews.llvm.org/D74501).
Of course this doesn't solve the underlying issue of running on old systems (governed by the deployment target), but at least you can take advantage of the availability annotations in the SDK to do a proper runtime check.
In this particular case pthread_mach_thread_np seems to be a good general replacement (header says it's available since 10.4). I recommend just using it unconditionally.