Fix synchronization between data and instr caches
[tinycc.git] / conftest.c
blob53c181c3e28d8b0e9a9bdc3bead25153fdc596f7
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 #else
11 # define TRIPLET_ARCH "unknown"
12 #endif
14 /* Define OS */
15 #if defined (__linux__)
16 # define TRIPLET_OS "linux"
17 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
18 # define TRIPLET_OS "kfreebsd"
19 #elif !defined (__GNU__)
20 # define TRIPLET_OS "unknown"
21 #endif
23 /* Define calling convention and ABI */
24 #if defined (__ARM_EABI__)
25 # if defined (__ARM_PCS_VFP)
26 # define TRIPLET_ABI "gnueabihf"
27 # else
28 # define TRIPLET_ABI "gnueabi"
29 # endif
30 #else
31 # define TRIPLET_ABI "gnu"
32 #endif
34 #ifdef __GNU__
35 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
36 #else
37 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
38 #endif
40 int main(int argc, char *argv[])
42 switch(argc == 2 ? argv[1][0] : 0) {
43 case 'b':
45 volatile unsigned foo = 0x01234567;
46 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
47 break;
49 #ifdef __GNUC__
50 case 'm':
51 printf("%d\n", __GNUC_MINOR__);
52 break;
53 case 'v':
54 printf("%d\n", __GNUC__);
55 break;
56 #else
57 case 'm':
58 case 'v':
59 puts("0");
60 break;
61 #endif
62 case 't':
63 puts(TRIPLET);
64 break;
65 case -1:
66 /* to test -Wno-unused-result */
67 fread(NULL, 1, 1, NULL);
68 break;
70 return 0;