Mads Marquart 846d6a4466 Add __isOSVersionAtLeast and __isPlatformVersionAtLeast symbols
Allows users to link to Objective-C code using `@available(...)`.
2025-09-05 16:18:49 +02:00

23 lines
584 B
C

int foo(void) {
// Act as if using some API that's a lot newer than the deployment target.
//
// This forces Clang to insert a call to __isPlatformVersionAtLeast,
// and linking will fail if that is not present.
if (__builtin_available(
macos 1000.0,
ios 1000.0,
tvos 1000.0,
watchos 1000.0,
// CI runs below Xcode 15, where `visionos` wasn't a valid key in
// `__builtin_available`.
#ifdef TARGET_OS_VISION
visionos 1000.0,
#endif
*
)) {
return 1;
} else {
return 0;
}
}