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 #elif defined(__riscv) && defined(__LP64__)
17 # define TRIPLET_ARCH "riscv64"
19 # define TRIPLET_ARCH "unknown"
23 #if defined (__linux__)
24 # define TRIPLET_OS "linux"
25 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
26 # define TRIPLET_OS "kfreebsd"
28 # define TRIPLET_OS "win32"
29 #elif defined(__APPLE__)
30 # define TRIPLET_OS "darwin"
31 #elif !defined (__GNU__)
32 # define TRIPLET_OS "unknown"
35 /* Define calling convention and ABI */
36 #if defined (__ARM_EABI__)
37 # if defined (__ARM_PCS_VFP)
38 # define TRIPLET_ABI "gnueabihf"
40 # define TRIPLET_ABI "gnueabi"
43 # define TRIPLET_ABI "gnu"
47 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS
49 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
51 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
58 int main(int argc
, char *argv
[])
61 _setmode(_fileno(stdout
), _O_BINARY
); /* don't translate \n to \r\n */
63 switch(argc
== 2 ? argv
[1][0] : 0) {
66 volatile unsigned foo
= 0x01234567;
67 puts(*(unsigned char*)&foo
== 0x67 ? "no" : "yes");
70 #if defined(__clang__)
72 printf("%d\n", __clang_minor__
);
75 printf("%d\n", __clang_major__
);
77 #elif defined(__TINYC__)
82 printf("%d\n", __TINYC__
);
84 #elif defined(_MSC_VER)
89 printf("%d\n", _MSC_VER
);
91 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
92 /* GNU comes last as other compilers may add 'GNU' compatibility */
94 printf("%d\n", __GNUC_MINOR__
);
97 printf("%d\n", __GNUC__
);
109 #if defined(__clang__)
111 #elif defined(__TINYC__)
113 #elif defined(_MSC_VER)
115 #elif defined(__GNUC__)