about summary refs log tree commit diff
path: root/tests/run-make/apple-c-available-links/foo.c
blob: eff99a8b12a7ebf6d618b4e354e5cb1cddb04f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
    }
}