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
4int __isOSVersionAtLeast(int Major, int Minor, int Subminor);
5
6int main() {
7 if (!__isOSVersionAtLeast(MAJOR, MINOR, SUBMINOR))
8 return 1;
9 if (__isOSVersionAtLeast(MAJOR, MINOR, SUBMINOR + 1))
10 return 1;
11 if (SUBMINOR && __isOSVersionAtLeast(MAJOR + 1, MINOR, SUBMINOR - 1))
12 return 1;
13 if (SUBMINOR && !__isOSVersionAtLeast(MAJOR, MINOR, SUBMINOR - 1))
14 return 1;
15 if (MAJOR && !__isOSVersionAtLeast(MAJOR - 1, MINOR + 1, SUBMINOR))
16 return 1;
17
18 return 0;
19}
20

source code of compiler-rt/test/builtins/TestCases/Darwin/os_version_check_test.c