erik.pilkington added a comment.

I seem to remember that mapping from kernel versions to marketing versions was 
tossed around as a potential alternative to Gestalt. I think that the problem 
was Apple sometimes introduces (or reserves the right to introduce) new SDKs in 
a patch release (ie, Z in X.Y.Z), which wouldn't necessary imply a new kernel 
version, and would still need to be queried by @available. This makes it 
impossible to use kernel version in the general case (Or at least I think, it 
would be nice if someone internal to Apple could confirm this?). This rules out 
using `sysctl()` and the like.

AFAIK this just leaves `Gestalt()` and Objective-C's `NSProcessInfo`, the 
latter would mean pulling in the Objective-C runtime, which would be 
unfortunate for C users (using the `__builtin_available` spelling). I don't 
think `Gestalt()` is in any danger of actually being removed, so we might as 
well use it. The only alternative I know of to those would be manually parsing 
the `SystemVersion.plist` XML file, but I think that might cause problems with 
sandboxed processes (right?). Any thoughts here would be much appreciated, 
`Gestalt()` is by no means a perfect solution.

Compiler-rt does seem like a good place it put this, should I move the runtime 
code there instead?

Thanks for taking a look!
Erik


https://reviews.llvm.org/D27827



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to