[PATCH] D27827: [ObjC] CodeGen support for @available on macOS

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 15:13:51 PST 2016

thakis added a comment.

Huh, I'm surprised this has a runtime component, I missed that. I thought this would be a statically-checked thing. But having this does seem useful :-)

I'm also surprised that this compiles down to Gestalt – Gestalt is deprecated in newer SDKs, and in Chromium we invested some time to move off of it when recently bumping our min SDK target. So it seems strange the compiler would add a dependency to it. (We've also observed that Gestalt is pretty heavy-weight at least in macOS 10.6 in that it can spawn threads).

Things we've done instead, in various contexts:

- `uname()` (https://cs.chromium.org/chromium/src/base/mac/mac_util.mm?q=MacOSXMinorVersion&sq=package:chromium&dr=C&l=365)
- -[NSProcessInfo operatingSystemVersion] if it's available (it's documented available in 10.10+, but actually exists from 10.9.2+) (rhs on https://codereview.chromium.org/1842213002/diff/40001/base/sys_info_mac.mm)
- `sysctl()` https://github.com/google/google-toolbox-for-mac/blob/master/Foundation/GTMServiceManagement.c#L63 That's what's recommended but might need 10.8


More information about the cfe-commits mailing list