2 # error "A C++ compiler has been selected for C." 13 #if defined(__INTEL_COMPILER) || defined(__ICC) 14 # define COMPILER_ID "Intel" 15 # if defined(_MSC_VER) 16 # define SIMULATE_ID "MSVC" 19 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) 20 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) 21 # if defined(__INTEL_COMPILER_UPDATE) 22 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) 24 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 26 # if defined(__INTEL_COMPILER_BUILD_DATE) 28 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 30 # if defined(_MSC_VER) 32 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 33 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 36 #elif defined(__PATHCC__) 37 # define COMPILER_ID "PathScale" 38 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) 39 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) 40 # if defined(__PATHCC_PATCHLEVEL__) 41 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) 44 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) 45 # define COMPILER_ID "Embarcadero" 46 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) 47 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) 48 # define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) 50 #elif defined(__BORLANDC__) 51 # define COMPILER_ID "Borland" 53 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 54 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 56 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 57 # define COMPILER_ID "Watcom" 59 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) 60 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 61 # if (__WATCOMC__ % 10) > 0 62 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 65 #elif defined(__WATCOMC__) 66 # define COMPILER_ID "OpenWatcom" 68 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) 69 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 70 # if (__WATCOMC__ % 10) > 0 71 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 74 #elif defined(__SUNPRO_C) 75 # define COMPILER_ID "SunPro" 76 # if __SUNPRO_C >= 0x5100 78 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) 79 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) 80 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 83 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) 84 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) 85 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 88 #elif defined(__HP_cc) 89 # define COMPILER_ID "HP" 91 # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) 92 # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) 93 # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) 96 # define COMPILER_ID "Compaq" 98 # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) 99 # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) 100 # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) 102 #elif defined(__IBMC__) && defined(__COMPILER_VER__) 103 # define COMPILER_ID "zOS" 105 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 106 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 107 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 109 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 110 # define COMPILER_ID "XL" 112 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 113 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 114 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 116 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 117 # define COMPILER_ID "VisualAge" 119 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 120 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 121 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 124 # define COMPILER_ID "PGI" 125 # define COMPILER_VERSION_MAJOR DEC(__PGIC__) 126 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) 127 # if defined(__PGIC_PATCHLEVEL__) 128 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) 131 #elif defined(_CRAYC) 132 # define COMPILER_ID "Cray" 133 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) 134 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) 136 #elif defined(__TI_COMPILER_VERSION__) 137 # define COMPILER_ID "TI" 139 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) 140 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) 141 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) 143 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) 144 # define COMPILER_ID "Fujitsu" 146 #elif defined(__TINYC__) 147 # define COMPILER_ID "TinyCC" 149 #elif defined(__SCO_VERSION__) 150 # define COMPILER_ID "SCO" 152 #elif defined(__clang__) && defined(__apple_build_version__) 153 # define COMPILER_ID "AppleClang" 154 # if defined(_MSC_VER) 155 # define SIMULATE_ID "MSVC" 157 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 158 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 159 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 160 # if defined(_MSC_VER) 162 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 163 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 165 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) 167 #elif defined(__clang__) 168 # define COMPILER_ID "Clang" 169 # if defined(_MSC_VER) 170 # define SIMULATE_ID "MSVC" 172 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 173 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 174 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 175 # if defined(_MSC_VER) 177 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 178 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 181 #elif defined(__GNUC__) 182 # define COMPILER_ID "GNU" 183 # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 184 # if defined(__GNUC_MINOR__) 185 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 187 # if defined(__GNUC_PATCHLEVEL__) 188 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 191 #elif defined(_MSC_VER) 192 # define COMPILER_ID "MSVC" 194 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) 195 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) 196 # if defined(_MSC_FULL_VER) 197 # if _MSC_VER >= 1400 199 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 202 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 205 # if defined(_MSC_BUILD) 206 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 209 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 210 # define COMPILER_ID "ADSP" 211 #if defined(__VISUALDSPVERSION__) 213 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) 214 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) 215 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) 218 #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) 219 # define COMPILER_ID "IAR" 222 # define COMPILER_ID "SDCC" 224 # define COMPILER_VERSION_MAJOR DEC(SDCC/100) 225 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) 226 # define COMPILER_VERSION_PATCH DEC(SDCC % 10) 228 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 229 # define COMPILER_ID "MIPSpro" 230 # if defined(_SGI_COMPILER_VERSION) 232 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) 233 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) 234 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) 237 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) 238 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) 239 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) 247 # define COMPILER_ID "MIPSpro" 249 #elif defined(__hpux) || defined(__hpua) 250 # define COMPILER_ID "HP" 253 # define COMPILER_ID "" 260 char const* info_compiler =
"INFO" ":" "compiler[" COMPILER_ID
"]";
262 char const* info_simulate =
"INFO" ":" "simulate[" SIMULATE_ID
"]";
266 char const* qnxnto =
"INFO" ":" "qnxnto[]";
269 #define STRINGIFY_HELPER(X) #X 270 #define STRINGIFY(X) STRINGIFY_HELPER(X) 273 #if defined(__linux) || defined(__linux__) || defined(linux) 274 # define PLATFORM_ID "Linux" 276 #elif defined(__CYGWIN__) 277 # define PLATFORM_ID "Cygwin" 279 #elif defined(__MINGW32__) 280 # define PLATFORM_ID "MinGW" 282 #elif defined(__APPLE__) 283 # define PLATFORM_ID "Darwin" 285 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 286 # define PLATFORM_ID "Windows" 288 #elif defined(__FreeBSD__) || defined(__FreeBSD) 289 # define PLATFORM_ID "FreeBSD" 291 #elif defined(__NetBSD__) || defined(__NetBSD) 292 # define PLATFORM_ID "NetBSD" 294 #elif defined(__OpenBSD__) || defined(__OPENBSD) 295 # define PLATFORM_ID "OpenBSD" 297 #elif defined(__sun) || defined(sun) 298 # define PLATFORM_ID "SunOS" 300 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 301 # define PLATFORM_ID "AIX" 303 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI) 304 # define PLATFORM_ID "IRIX" 306 #elif defined(__hpux) || defined(__hpux__) 307 # define PLATFORM_ID "HP-UX" 309 #elif defined(__HAIKU__) 310 # define PLATFORM_ID "Haiku" 312 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 313 # define PLATFORM_ID "BeOS" 315 #elif defined(__QNX__) || defined(__QNXNTO__) 316 # define PLATFORM_ID "QNX" 318 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 319 # define PLATFORM_ID "Tru64" 321 #elif defined(__riscos) || defined(__riscos__) 322 # define PLATFORM_ID "RISCos" 324 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 325 # define PLATFORM_ID "SINIX" 327 #elif defined(__UNIX_SV__) 328 # define PLATFORM_ID "UNIX_SV" 330 #elif defined(__bsdos__) 331 # define PLATFORM_ID "BSDOS" 333 #elif defined(_MPRAS) || defined(MPRAS) 334 # define PLATFORM_ID "MP-RAS" 336 #elif defined(__osf) || defined(__osf__) 337 # define PLATFORM_ID "OSF1" 339 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 340 # define PLATFORM_ID "SCO_SV" 342 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 343 # define PLATFORM_ID "ULTRIX" 345 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 346 # define PLATFORM_ID "Xenix" 348 #elif defined(__WATCOMC__) 349 # if defined(__LINUX__) 350 # define PLATFORM_ID "Linux" 352 # elif defined(__DOS__) 353 # define PLATFORM_ID "DOS" 355 # elif defined(__OS2__) 356 # define PLATFORM_ID "OS2" 358 # elif defined(__WINDOWS__) 359 # define PLATFORM_ID "Windows3x" 362 # define PLATFORM_ID "" 366 # define PLATFORM_ID "" 375 #if defined(_WIN32) && defined(_MSC_VER) 376 # if defined(_M_IA64) 377 # define ARCHITECTURE_ID "IA64" 379 # elif defined(_M_X64) || defined(_M_AMD64) 380 # define ARCHITECTURE_ID "x64" 382 # elif defined(_M_IX86) 383 # define ARCHITECTURE_ID "X86" 385 # elif defined(_M_ARM) 387 # define ARCHITECTURE_ID "ARMV4I" 389 # define ARCHITECTURE_ID "ARMV5I" 391 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) 394 # elif defined(_M_MIPS) 395 # define ARCHITECTURE_ID "MIPS" 397 # elif defined(_M_SH) 398 # define ARCHITECTURE_ID "SHx" 401 # define ARCHITECTURE_ID "" 404 #elif defined(__WATCOMC__) 406 # define ARCHITECTURE_ID "I86" 408 # elif defined(_M_IX86) 409 # define ARCHITECTURE_ID "X86" 412 # define ARCHITECTURE_ID "" 416 # define ARCHITECTURE_ID "" 421 ('0' + (((n) / 10000000)%10)), \ 422 ('0' + (((n) / 1000000)%10)), \ 423 ('0' + (((n) / 100000)%10)), \ 424 ('0' + (((n) / 10000)%10)), \ 425 ('0' + (((n) / 1000)%10)), \ 426 ('0' + (((n) / 100)%10)), \ 427 ('0' + (((n) / 10)%10)), \ 432 ('0' + ((n)>>28 & 0xF)), \ 433 ('0' + ((n)>>24 & 0xF)), \ 434 ('0' + ((n)>>20 & 0xF)), \ 435 ('0' + ((n)>>16 & 0xF)), \ 436 ('0' + ((n)>>12 & 0xF)), \ 437 ('0' + ((n)>>8 & 0xF)), \ 438 ('0' + ((n)>>4 & 0xF)), \ 442 #ifdef COMPILER_VERSION_MAJOR 443 char const info_version[] = {
444 'I',
'N',
'F',
'O',
':',
445 'c',
'o',
'm',
'p',
'i',
'l',
'e',
'r',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
446 COMPILER_VERSION_MAJOR,
447 # ifdef COMPILER_VERSION_MINOR 448 '.', COMPILER_VERSION_MINOR,
449 # ifdef COMPILER_VERSION_PATCH 450 '.', COMPILER_VERSION_PATCH,
451 # ifdef COMPILER_VERSION_TWEAK 452 '.', COMPILER_VERSION_TWEAK,
460 #ifdef SIMULATE_VERSION_MAJOR 461 char const info_simulate_version[] = {
462 'I',
'N',
'F',
'O',
':',
463 's',
'i',
'm',
'u',
'l',
'a',
't',
'e',
'_',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'[',
464 SIMULATE_VERSION_MAJOR,
465 # ifdef SIMULATE_VERSION_MINOR 466 '.', SIMULATE_VERSION_MINOR,
467 # ifdef SIMULATE_VERSION_PATCH 468 '.', SIMULATE_VERSION_PATCH,
469 # ifdef SIMULATE_VERSION_TWEAK 470 '.', SIMULATE_VERSION_TWEAK,
481 char const* info_platform =
"INFO" ":" "platform[" PLATFORM_ID
"]";
482 char const* info_arch =
"INFO" ":" "arch[" ARCHITECTURE_ID
"]";
487 const char* info_language_dialect_default =
"INFO" ":" "dialect_default[" 488 #if !defined(__STDC_VERSION__) 490 #elif __STDC_VERSION__ >= 201000L 492 #elif __STDC_VERSION__ >= 199901L 503 int main(
int argc,
char* argv[])
506 require += info_compiler[argc];
507 require += info_platform[argc];
508 require += info_arch[argc];
509 #ifdef COMPILER_VERSION_MAJOR 510 require += info_version[argc];
513 require += info_simulate[argc];
515 #ifdef SIMULATE_VERSION_MAJOR 516 require += info_simulate_version[argc];
518 require += info_language_dialect_default[argc];