Give clang one less thing to complain about
[tinycc.git] / conftest.c
blob2824cc89d7dff62d7e436088c4f91c73c0324981
1 #include <stdio.h>
3 /* Define architecture */
4 #if defined(__i386__) || defined _M_IX86
5 # define TRIPLET_ARCH "i386"
6 #elif defined(__x86_64__) || defined _M_AMD64
7 # define TRIPLET_ARCH "x86_64"
8 #elif defined(__arm__)
9 # define TRIPLET_ARCH "arm"
10 #elif defined(__aarch64__)
11 # define TRIPLET_ARCH "aarch64"
12 #else
13 # define TRIPLET_ARCH "unknown"
14 #endif
16 /* Define OS */
17 #if defined (__linux__)
18 # define TRIPLET_OS "linux"
19 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
20 # define TRIPLET_OS "kfreebsd"
21 #elif defined _WIN32
22 # define TRIPLET_OS "win32"
23 #elif !defined (__GNU__)
24 # define TRIPLET_OS "unknown"
25 #endif
27 /* Define calling convention and ABI */
28 #if defined (__ARM_EABI__)
29 # if defined (__ARM_PCS_VFP)
30 # define TRIPLET_ABI "gnueabihf"
31 # else
32 # define TRIPLET_ABI "gnueabi"
33 # endif
34 #else
35 # define TRIPLET_ABI "gnu"
36 #endif
38 #if defined _WIN32
39 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS
40 #elif defined __GNU__
41 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
42 #else
43 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
44 #endif
46 #if defined(_WIN32)
47 int _CRT_glob = 0;
48 #endif
50 int main(int argc, char *argv[])
52 switch(argc == 2 ? argv[1][0] : 0) {
53 case 'b':
55 volatile unsigned foo = 0x01234567;
56 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
57 break;
59 #ifdef __GNUC__
60 case 'm':
61 printf("%d\n", __GNUC_MINOR__);
62 break;
63 case 'v':
64 printf("%d\n", __GNUC__);
65 break;
66 #elif defined __TINYC__
67 case 'v':
68 puts("0");
69 break;
70 case 'm':
71 printf("%d\n", __TINYC__);
72 break;
73 #else
74 case 'm':
75 case 'v':
76 puts("0");
77 break;
78 #endif
79 case 't':
80 puts(TRIPLET);
81 break;
83 default:
84 break;
86 return 0;