2 # error "A C++ compiler has been selected for C." 8 #if defined(__CLASSIC_C__) 18 #if defined(__INTEL_COMPILER) || defined(__ICC) 19 # define COMPILER_ID "Intel" 20 # if defined(_MSC_VER) 21 # define SIMULATE_ID "MSVC" 24 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) 25 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) 26 # if defined(__INTEL_COMPILER_UPDATE) 27 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) 29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 31 # if defined(__INTEL_COMPILER_BUILD_DATE) 33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 35 # if defined(_MSC_VER) 37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 41 #elif defined(__PATHCC__) 42 # define COMPILER_ID "PathScale" 43 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) 44 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) 45 # if defined(__PATHCC_PATCHLEVEL__) 46 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) 49 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) 50 # define COMPILER_ID "Embarcadero" 51 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) 52 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) 53 # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) 55 #elif defined(__BORLANDC__) 56 # define COMPILER_ID "Borland" 58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 62 # define COMPILER_ID "Watcom" 64 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) 65 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 66 # if (__WATCOMC__ % 10) > 0 67 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 70 #elif defined(__WATCOMC__) 71 # define COMPILER_ID "OpenWatcom" 73 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) 74 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 75 # if (__WATCOMC__ % 10) > 0 76 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 79 #elif defined(__SUNPRO_C) 80 # define COMPILER_ID "SunPro" 81 # if __SUNPRO_C >= 0x5100 83 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) 84 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) 85 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 88 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) 89 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) 90 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 93 #elif defined(__HP_cc) 94 # define COMPILER_ID "HP" 96 # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) 97 # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) 98 # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) 100 #elif defined(__DECC) 101 # define COMPILER_ID "Compaq" 103 # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) 104 # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) 105 # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) 107 #elif defined(__IBMC__) && defined(__COMPILER_VER__) 108 # define COMPILER_ID "zOS" 110 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 111 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 112 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 114 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 115 # define COMPILER_ID "XL" 117 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 118 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 119 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 121 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 122 # define COMPILER_ID "VisualAge" 124 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 125 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 126 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 129 # define COMPILER_ID "PGI" 130 # define COMPILER_VERSION_MAJOR DEC(__PGIC__) 131 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) 132 # if defined(__PGIC_PATCHLEVEL__) 133 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) 136 #elif defined(_CRAYC) 137 # define COMPILER_ID "Cray" 138 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) 139 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) 141 #elif defined(__TI_COMPILER_VERSION__) 142 # define COMPILER_ID "TI" 144 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) 145 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) 146 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) 148 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) 149 # define COMPILER_ID "Fujitsu" 151 #elif defined(__TINYC__) 152 # define COMPILER_ID "TinyCC" 154 #elif defined(__BCC__) 155 # define COMPILER_ID "Bruce" 157 #elif defined(__SCO_VERSION__) 158 # define COMPILER_ID "SCO" 160 #elif defined(__clang__) && defined(__apple_build_version__) 161 # define COMPILER_ID "AppleClang" 162 # if defined(_MSC_VER) 163 # define SIMULATE_ID "MSVC" 165 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 166 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 167 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 168 # if defined(_MSC_VER) 170 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 171 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 173 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) 175 #elif defined(__clang__) 176 # define COMPILER_ID "Clang" 177 # if defined(_MSC_VER) 178 # define SIMULATE_ID "MSVC" 180 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 181 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 182 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 183 # if defined(_MSC_VER) 185 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 186 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 189 #elif defined(__GNUC__) 190 # define COMPILER_ID "GNU" 191 # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 192 # if defined(__GNUC_MINOR__) 193 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 195 # if defined(__GNUC_PATCHLEVEL__) 196 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 199 #elif defined(_MSC_VER) 200 # define COMPILER_ID "MSVC" 202 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) 203 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) 204 # if defined(_MSC_FULL_VER) 205 # if _MSC_VER >= 1400 207 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 210 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 213 # if defined(_MSC_BUILD) 214 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 217 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 218 # define COMPILER_ID "ADSP" 219 #if defined(__VISUALDSPVERSION__) 221 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) 222 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) 223 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) 226 #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) 227 # define COMPILER_ID "IAR" 229 #elif defined(__ARMCC_VERSION) 230 # define COMPILER_ID "ARMCC" 231 #if __ARMCC_VERSION >= 1000000 233 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) 234 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) 235 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) 238 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) 239 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) 240 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) 244 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) 245 # define COMPILER_ID "SDCC" 246 # if defined(__SDCC_VERSION_MAJOR) 247 # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) 248 # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) 249 # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) 252 # define COMPILER_VERSION_MAJOR DEC(SDCC/100) 253 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) 254 # define COMPILER_VERSION_PATCH DEC(SDCC % 10) 257 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 258 # define COMPILER_ID "MIPSpro" 259 # if defined(_SGI_COMPILER_VERSION) 261 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) 262 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) 263 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) 266 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) 267 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) 268 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) 276 # define COMPILER_ID "MIPSpro" 278 #elif defined(__hpux) || defined(__hpua) 279 # define COMPILER_ID "HP" 282 # define COMPILER_ID "" 291 char const* info_simulate =
"INFO" ":" "simulate[" SIMULATE_ID
"]";
295 char const* qnxnto =
"INFO" ":" "qnxnto[]";
298 #if defined(__CRAYXE) || defined(__CRAYXC) 299 char const *info_cray =
"INFO" ":" "compiler_wrapper[CrayPrgEnv]";
302 #define STRINGIFY_HELPER(X) #X 303 #define STRINGIFY(X) STRINGIFY_HELPER(X) 306 #if defined(__linux) || defined(__linux__) || defined(linux) 307 # define PLATFORM_ID "Linux" 309 #elif defined(__CYGWIN__) 310 # define PLATFORM_ID "Cygwin" 312 #elif defined(__MINGW32__) 313 # define PLATFORM_ID "MinGW" 315 #elif defined(__APPLE__) 316 # define PLATFORM_ID "Darwin" 318 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 319 # define PLATFORM_ID "Windows" 321 #elif defined(__FreeBSD__) || defined(__FreeBSD) 322 # define PLATFORM_ID "FreeBSD" 324 #elif defined(__NetBSD__) || defined(__NetBSD) 325 # define PLATFORM_ID "NetBSD" 327 #elif defined(__OpenBSD__) || defined(__OPENBSD) 328 # define PLATFORM_ID "OpenBSD" 330 #elif defined(__sun) || defined(sun) 331 # define PLATFORM_ID "SunOS" 333 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 334 # define PLATFORM_ID "AIX" 336 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI) 337 # define PLATFORM_ID "IRIX" 339 #elif defined(__hpux) || defined(__hpux__) 340 # define PLATFORM_ID "HP-UX" 342 #elif defined(__HAIKU__) 343 # define PLATFORM_ID "Haiku" 345 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 346 # define PLATFORM_ID "BeOS" 348 #elif defined(__QNX__) || defined(__QNXNTO__) 349 # define PLATFORM_ID "QNX" 351 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 352 # define PLATFORM_ID "Tru64" 354 #elif defined(__riscos) || defined(__riscos__) 355 # define PLATFORM_ID "RISCos" 357 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 358 # define PLATFORM_ID "SINIX" 360 #elif defined(__UNIX_SV__) 361 # define PLATFORM_ID "UNIX_SV" 363 #elif defined(__bsdos__) 364 # define PLATFORM_ID "BSDOS" 366 #elif defined(_MPRAS) || defined(MPRAS) 367 # define PLATFORM_ID "MP-RAS" 369 #elif defined(__osf) || defined(__osf__) 370 # define PLATFORM_ID "OSF1" 372 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 373 # define PLATFORM_ID "SCO_SV" 375 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 376 # define PLATFORM_ID "ULTRIX" 378 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 379 # define PLATFORM_ID "Xenix" 381 #elif defined(__WATCOMC__) 382 # if defined(__LINUX__) 383 # define PLATFORM_ID "Linux" 385 # elif defined(__DOS__) 386 # define PLATFORM_ID "DOS" 388 # elif defined(__OS2__) 389 # define PLATFORM_ID "OS2" 391 # elif defined(__WINDOWS__) 392 # define PLATFORM_ID "Windows3x" 408 #if defined(_WIN32) && defined(_MSC_VER) 409 # if defined(_M_IA64) 410 # define ARCHITECTURE_ID "IA64" 412 # elif defined(_M_X64) || defined(_M_AMD64) 413 # define ARCHITECTURE_ID "x64" 415 # elif defined(_M_IX86) 416 # define ARCHITECTURE_ID "X86" 418 # elif defined(_M_ARM) 420 # define ARCHITECTURE_ID "ARMV4I" 422 # define ARCHITECTURE_ID "ARMV5I" 424 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) 427 # elif defined(_M_MIPS) 428 # define ARCHITECTURE_ID "MIPS" 430 # elif defined(_M_SH) 431 # define ARCHITECTURE_ID "SHx" 434 # define ARCHITECTURE_ID "" 437 #elif defined(__WATCOMC__) 439 # define ARCHITECTURE_ID "I86" 441 # elif defined(_M_IX86) 442 # define ARCHITECTURE_ID "X86" 445 # define ARCHITECTURE_ID "" 449 # define ARCHITECTURE_ID 454 ('0' + (((n) / 10000000)%10)), \ 455 ('0' + (((n) / 1000000)%10)), \ 456 ('0' + (((n) / 100000)%10)), \ 457 ('0' + (((n) / 10000)%10)), \ 458 ('0' + (((n) / 1000)%10)), \ 459 ('0' + (((n) / 100)%10)), \ 460 ('0' + (((n) / 10)%10)), \ 465 ('0' + ((n)>>28 & 0xF)), \ 466 ('0' + ((n)>>24 & 0xF)), \ 467 ('0' + ((n)>>20 & 0xF)), \ 468 ('0' + ((n)>>16 & 0xF)), \ 469 ('0' + ((n)>>12 & 0xF)), \ 470 ('0' + ((n)>>8 & 0xF)), \ 471 ('0' + ((n)>>4 & 0xF)), \ 475 #ifdef COMPILER_VERSION_MAJOR 476 char const info_version[] = {
477 'I',
'N',
'F',
'O',
':',
478 'c',
'o',
'm',
'p',
'i',
'l',
'e',
'r',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
479 COMPILER_VERSION_MAJOR,
480 # ifdef COMPILER_VERSION_MINOR 481 '.', COMPILER_VERSION_MINOR,
482 # ifdef COMPILER_VERSION_PATCH 483 '.', COMPILER_VERSION_PATCH,
484 # ifdef COMPILER_VERSION_TWEAK 485 '.', COMPILER_VERSION_TWEAK,
493 #ifdef SIMULATE_VERSION_MAJOR 494 char const info_simulate_version[] = {
495 'I',
'N',
'F',
'O',
':',
496 's',
'i',
'm',
'u',
'l',
'a',
't',
'e',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
497 SIMULATE_VERSION_MAJOR,
498 # ifdef SIMULATE_VERSION_MINOR 499 '.', SIMULATE_VERSION_MINOR,
500 # ifdef SIMULATE_VERSION_PATCH 501 '.', SIMULATE_VERSION_PATCH,
502 # ifdef SIMULATE_VERSION_TWEAK 503 '.', SIMULATE_VERSION_TWEAK,
520 #if !defined(__STDC__) 521 # if defined(_MSC_VER) && !defined(__clang__) 522 # define C_DIALECT "90" 526 #elif __STDC_VERSION__ >= 201000L 527 # define C_DIALECT "11" 528 #elif __STDC_VERSION__ >= 199901L 529 # define C_DIALECT "99" 531 # define C_DIALECT "90" 534 "INFO" ":" "dialect_default[" C_DIALECT "]";
541 # if defined(__CLASSIC_C__) 542 int main(argc, argv)
int argc;
char *argv[];
544 int main(
int argc,
char* argv[])
551 #ifdef COMPILER_VERSION_MAJOR 552 require += info_version[argc];
555 require += info_simulate[argc];
557 #ifdef SIMULATE_VERSION_MAJOR 558 require += info_simulate_version[argc];
560 #if defined(__CRAYXE) || defined(__CRAYXC) 561 require += info_cray[argc];
char const * info_compiler
int main(int argc, char *argv[])
const char * info_language_dialect_default
char const * info_platform