struct-init: Support range inits for local vars
[tinycc.git] / conftest.c
blobfa07a1b544e989096872acb57f08b38689d217a8
1 #include <stdio.h>
3 /* Define architecture */
4 #if defined(__i386__)
5 # define TRIPLET_ARCH "i386"
6 #elif defined(__x86_64__)
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 (__GNU__)
22 # define TRIPLET_OS "unknown"
23 #endif
25 /* Define calling convention and ABI */
26 #if defined (__ARM_EABI__)
27 # if defined (__ARM_PCS_VFP)
28 # define TRIPLET_ABI "gnueabihf"
29 # else
30 # define TRIPLET_ABI "gnueabi"
31 # endif
32 #else
33 # define TRIPLET_ABI "gnu"
34 #endif
36 #ifdef __GNU__
37 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
38 #else
39 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
40 #endif
42 #if defined(_WIN32)
43 int _CRT_glob = 0;
44 #endif
46 int main(int argc, char *argv[])
48 switch(argc == 2 ? argv[1][0] : 0) {
49 case 'b':
51 volatile unsigned foo = 0x01234567;
52 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
53 break;
55 #ifdef __GNUC__
56 case 'm':
57 printf("%d\n", __GNUC_MINOR__);
58 break;
59 case 'v':
60 printf("%d\n", __GNUC__);
61 break;
62 #else
63 case 'm':
64 case 'v':
65 puts("0");
66 break;
67 #endif
68 case 't':
69 puts(TRIPLET);
70 break;
71 case -1:
72 /* to test -Wno-unused-result */
73 fread(NULL, 1, 1, NULL);
74 break;
76 return 0;