Fix parsing of binary floating point number
[tinycc.git] / conftest.c
1 #include <stdio.h>
2
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
13
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
22
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
33
34 #ifdef __GNU__
35 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
36 #else
37 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
38 #endif
39
40 #if defined(_WIN32)
41 int _CRT_glob = 0;
42 #endif
43
44 int main(int argc, char *argv[])
45 {
46 switch(argc == 2 ? argv[1][0] : 0) {
47 case 'b':
48 {
49 volatile unsigned foo = 0x01234567;
50 puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes");
51 break;
52 }
53 #ifdef __GNUC__
54 case 'm':
55 printf("%d\n", __GNUC_MINOR__);
56 break;
57 case 'v':
58 printf("%d\n", __GNUC__);
59 break;
60 #else
61 case 'm':
62 case 'v':
63 puts("0");
64 break;
65 #endif
66 case 't':
67 puts(TRIPLET);
68 break;
69 case -1:
70 /* to test -Wno-unused-result */
71 fread(NULL, 1, 1, NULL);
72 break;
73 }
74 return 0;
75 }