Fix invalid size with GNU designated initializers
[tinycc.git] / conftest.c
blobc7bc78310e7aacbfb1615a31ab1e7e61a1bf9bab
1 #include <stdio.h>
3 #if defined(_WIN32)
4 #include <fcntl.h>
5 #endif
7 /* Define architecture */
8 #if defined(__i386__) || defined _M_IX86
9 # define TRIPLET_ARCH "i386"
10 #elif defined(__x86_64__) || defined _M_AMD64
11 # define TRIPLET_ARCH "x86_64"
12 #elif defined(__arm__)
13 # define TRIPLET_ARCH "arm"
14 #elif defined(__aarch64__)
15 # define TRIPLET_ARCH "aarch64"
16 #else
17 # define TRIPLET_ARCH "unknown"
18 #endif
20 /* Define OS */
21 #if defined (__linux__)
22 # define TRIPLET_OS "linux"
23 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
24 # define TRIPLET_OS "kfreebsd"
25 #elif defined _WIN32
26 # define TRIPLET_OS "win32"
27 #elif !defined (__GNU__)
28 # define TRIPLET_OS "unknown"
29 #endif
31 /* Define calling convention and ABI */
32 #if defined (__ARM_EABI__)
33 # if defined (__ARM_PCS_VFP)
34 # define TRIPLET_ABI "gnueabihf"
35 # else
36 # define TRIPLET_ABI "gnueabi"
37 # endif
38 #else
39 # define TRIPLET_ABI "gnu"
40 #endif
42 #if defined _WIN32
43 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS
44 #elif defined __GNU__
45 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
46 #else
47 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
48 #endif
50 #if defined(_WIN32)
51 int _CRT_glob = 0;
52 #endif
54 int main(int argc, char *argv[])
56 #if defined(_WIN32)
57 _setmode(_fileno(stdout), _O_BINARY); /* don't translate \n to \r\n */
58 #endif
59 switch(argc == 2 ? argv[1][0] : 0) {
60 case 'b':
62 volatile unsigned foo = 0x01234567;
63 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
64 break;
66 #ifdef __GNUC__
67 case 'm':
68 printf("%d\n", __GNUC_MINOR__);
69 break;
70 case 'v':
71 printf("%d\n", __GNUC__);
72 break;
73 #elif defined __TINYC__
74 case 'v':
75 puts("0");
76 break;
77 case 'm':
78 printf("%d\n", __TINYC__);
79 break;
80 #else
81 case 'm':
82 case 'v':
83 puts("0");
84 break;
85 #endif
86 case 't':
87 puts(TRIPLET);
88 break;
90 default:
91 break;
93 return 0;