1 | // RUN: %clang %s -o %t -mmacosx-version-min=10.7 -framework CoreFoundation -DMAJOR=%macos_version_major -DMINOR=%macos_version_minor -DSUBMINOR=%macos_version_subminor |
2 | // RUN: %run %t |
3 | |
4 | typedef int int32_t; |
5 | typedef unsigned int uint32_t; |
6 | |
7 | int32_t __isPlatformVersionAtLeast(uint32_t Platform, uint32_t Major, |
8 | uint32_t Minor, uint32_t Subminor); |
9 | |
10 | #define PLATFORM_MACOS 1 |
11 | |
12 | int32_t check(uint32_t Major, uint32_t Minor, uint32_t Subminor) { |
13 | int32_t Result = |
14 | __isPlatformVersionAtLeast(PLATFORM_MACOS, Major, Minor, Subminor); |
15 | return Result; |
16 | } |
17 | |
18 | int main() { |
19 | if (!check(MAJOR, MINOR, SUBMINOR)) |
20 | return 1; |
21 | if (check(MAJOR, MINOR, SUBMINOR + 1)) |
22 | return 1; |
23 | if (SUBMINOR && check(MAJOR + 1, MINOR, SUBMINOR - 1)) |
24 | return 1; |
25 | if (SUBMINOR && !check(MAJOR, MINOR, SUBMINOR - 1)) |
26 | return 1; |
27 | if (MAJOR && !check(MAJOR - 1, MINOR + 1, SUBMINOR)) |
28 | return 1; |
29 | |
30 | return 0; |
31 | } |
32 | |