Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / builtins / TestCases / Darwin / platform_version_check_test.c
blobda0e366430a73c8f4f149408b8e09ead31bfc055
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
4 typedef int int32_t;
5 typedef unsigned int uint32_t;
7 int32_t __isPlatformVersionAtLeast(uint32_t Platform, uint32_t Major,
8 uint32_t Minor, uint32_t Subminor);
10 #define PLATFORM_MACOS 1
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;
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;
30 return 0;