github.com/pidato/unsafe@v0.1.4/memory/rpmalloc/src/build/CMakeFiles/3.22.3/CompilerIdC/CMakeCCompilerId.c (about) 1 #ifdef __cplusplus 2 # error "A C++ compiler has been selected for C." 3 #endif 4 5 #if defined(__18CXX) 6 # define ID_VOID_MAIN 7 #endif 8 #if defined(__CLASSIC_C__) 9 /* cv-qualifiers did not exist in K&R C */ 10 # define const 11 # define volatile 12 #endif 13 14 #if !defined(__has_include) 15 /* If the compiler does not have __has_include, pretend the answer is 16 always no. */ 17 # define __has_include(x) 0 18 #endif 19 20 21 /* Version number components: V=Version, R=Revision, P=Patch 22 Version date components: YYYY=Year, MM=Month, DD=Day */ 23 24 #if defined(__INTEL_COMPILER) || defined(__ICC) 25 # define COMPILER_ID "Intel" 26 # if defined(_MSC_VER) 27 # define SIMULATE_ID "MSVC" 28 # endif 29 # if defined(__GNUC__) 30 # define SIMULATE_ID "GNU" 31 # endif 32 /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, 33 except that a few beta releases use the old format with V=2021. */ 34 # if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 35 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) 36 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) 37 # if defined(__INTEL_COMPILER_UPDATE) 38 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) 39 # else 40 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 41 # endif 42 # else 43 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) 44 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) 45 /* The third version component from --version is an update index, 46 but no macro is provided for it. */ 47 # define COMPILER_VERSION_PATCH DEC(0) 48 # endif 49 # if defined(__INTEL_COMPILER_BUILD_DATE) 50 /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ 51 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 52 # endif 53 # if defined(_MSC_VER) 54 /* _MSC_VER = VVRR */ 55 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 56 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 57 # endif 58 # if defined(__GNUC__) 59 # define SIMULATE_VERSION_MAJOR DEC(__GNUC__) 60 # elif defined(__GNUG__) 61 # define SIMULATE_VERSION_MAJOR DEC(__GNUG__) 62 # endif 63 # if defined(__GNUC_MINOR__) 64 # define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) 65 # endif 66 # if defined(__GNUC_PATCHLEVEL__) 67 # define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 68 # endif 69 70 #elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) 71 # define COMPILER_ID "IntelLLVM" 72 #if defined(_MSC_VER) 73 # define SIMULATE_ID "MSVC" 74 #endif 75 #if defined(__GNUC__) 76 # define SIMULATE_ID "GNU" 77 #endif 78 /* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and 79 * later. Look for 6 digit vs. 8 digit version number to decide encoding. 80 * VVVV is no smaller than the current year when a version is released. 81 */ 82 #if __INTEL_LLVM_COMPILER < 1000000L 83 # define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) 84 # define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) 85 # define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) 86 #else 87 # define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) 88 # define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) 89 # define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) 90 #endif 91 #if defined(_MSC_VER) 92 /* _MSC_VER = VVRR */ 93 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 94 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 95 #endif 96 #if defined(__GNUC__) 97 # define SIMULATE_VERSION_MAJOR DEC(__GNUC__) 98 #elif defined(__GNUG__) 99 # define SIMULATE_VERSION_MAJOR DEC(__GNUG__) 100 #endif 101 #if defined(__GNUC_MINOR__) 102 # define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) 103 #endif 104 #if defined(__GNUC_PATCHLEVEL__) 105 # define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 106 #endif 107 108 #elif defined(__PATHCC__) 109 # define COMPILER_ID "PathScale" 110 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) 111 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) 112 # if defined(__PATHCC_PATCHLEVEL__) 113 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) 114 # endif 115 116 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) 117 # define COMPILER_ID "Embarcadero" 118 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) 119 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) 120 # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) 121 122 #elif defined(__BORLANDC__) 123 # define COMPILER_ID "Borland" 124 /* __BORLANDC__ = 0xVRR */ 125 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 126 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 127 128 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 129 # define COMPILER_ID "Watcom" 130 /* __WATCOMC__ = VVRR */ 131 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) 132 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 133 # if (__WATCOMC__ % 10) > 0 134 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 135 # endif 136 137 #elif defined(__WATCOMC__) 138 # define COMPILER_ID "OpenWatcom" 139 /* __WATCOMC__ = VVRP + 1100 */ 140 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) 141 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) 142 # if (__WATCOMC__ % 10) > 0 143 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) 144 # endif 145 146 #elif defined(__SUNPRO_C) 147 # define COMPILER_ID "SunPro" 148 # if __SUNPRO_C >= 0x5100 149 /* __SUNPRO_C = 0xVRRP */ 150 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) 151 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) 152 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 153 # else 154 /* __SUNPRO_CC = 0xVRP */ 155 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) 156 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) 157 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) 158 # endif 159 160 #elif defined(__HP_cc) 161 # define COMPILER_ID "HP" 162 /* __HP_cc = VVRRPP */ 163 # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) 164 # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) 165 # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) 166 167 #elif defined(__DECC) 168 # define COMPILER_ID "Compaq" 169 /* __DECC_VER = VVRRTPPPP */ 170 # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) 171 # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) 172 # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) 173 174 #elif defined(__IBMC__) && defined(__COMPILER_VER__) 175 # define COMPILER_ID "zOS" 176 /* __IBMC__ = VRP */ 177 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 178 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 179 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 180 181 #elif defined(__ibmxl__) && defined(__clang__) 182 # define COMPILER_ID "XLClang" 183 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) 184 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) 185 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) 186 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) 187 188 189 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 190 # define COMPILER_ID "XL" 191 /* __IBMC__ = VRP */ 192 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 193 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 194 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 195 196 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 197 # define COMPILER_ID "VisualAge" 198 /* __IBMC__ = VRP */ 199 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) 200 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) 201 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) 202 203 #elif defined(__NVCOMPILER) 204 # define COMPILER_ID "NVHPC" 205 # define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) 206 # define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) 207 # if defined(__NVCOMPILER_PATCHLEVEL__) 208 # define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) 209 # endif 210 211 #elif defined(__PGI) 212 # define COMPILER_ID "PGI" 213 # define COMPILER_VERSION_MAJOR DEC(__PGIC__) 214 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) 215 # if defined(__PGIC_PATCHLEVEL__) 216 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) 217 # endif 218 219 #elif defined(_CRAYC) 220 # define COMPILER_ID "Cray" 221 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) 222 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) 223 224 #elif defined(__TI_COMPILER_VERSION__) 225 # define COMPILER_ID "TI" 226 /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ 227 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) 228 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) 229 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) 230 231 #elif defined(__CLANG_FUJITSU) 232 # define COMPILER_ID "FujitsuClang" 233 # define COMPILER_VERSION_MAJOR DEC(__FCC_major__) 234 # define COMPILER_VERSION_MINOR DEC(__FCC_minor__) 235 # define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) 236 # define COMPILER_VERSION_INTERNAL_STR __clang_version__ 237 238 239 #elif defined(__FUJITSU) 240 # define COMPILER_ID "Fujitsu" 241 # if defined(__FCC_version__) 242 # define COMPILER_VERSION __FCC_version__ 243 # elif defined(__FCC_major__) 244 # define COMPILER_VERSION_MAJOR DEC(__FCC_major__) 245 # define COMPILER_VERSION_MINOR DEC(__FCC_minor__) 246 # define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) 247 # endif 248 # if defined(__fcc_version) 249 # define COMPILER_VERSION_INTERNAL DEC(__fcc_version) 250 # elif defined(__FCC_VERSION) 251 # define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) 252 # endif 253 254 255 #elif defined(__ghs__) 256 # define COMPILER_ID "GHS" 257 /* __GHS_VERSION_NUMBER = VVVVRP */ 258 # ifdef __GHS_VERSION_NUMBER 259 # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) 260 # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) 261 # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) 262 # endif 263 264 #elif defined(__TINYC__) 265 # define COMPILER_ID "TinyCC" 266 267 #elif defined(__BCC__) 268 # define COMPILER_ID "Bruce" 269 270 #elif defined(__SCO_VERSION__) 271 # define COMPILER_ID "SCO" 272 273 #elif defined(__ARMCC_VERSION) && !defined(__clang__) 274 # define COMPILER_ID "ARMCC" 275 #if __ARMCC_VERSION >= 1000000 276 /* __ARMCC_VERSION = VRRPPPP */ 277 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) 278 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) 279 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) 280 #else 281 /* __ARMCC_VERSION = VRPPPP */ 282 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) 283 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) 284 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) 285 #endif 286 287 288 #elif defined(__clang__) && defined(__apple_build_version__) 289 # define COMPILER_ID "AppleClang" 290 # if defined(_MSC_VER) 291 # define SIMULATE_ID "MSVC" 292 # endif 293 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 294 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 295 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 296 # if defined(_MSC_VER) 297 /* _MSC_VER = VVRR */ 298 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 299 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 300 # endif 301 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) 302 303 #elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) 304 # define COMPILER_ID "ARMClang" 305 # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) 306 # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) 307 # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) 308 # define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) 309 310 #elif defined(__clang__) 311 # define COMPILER_ID "Clang" 312 # if defined(_MSC_VER) 313 # define SIMULATE_ID "MSVC" 314 # endif 315 # define COMPILER_VERSION_MAJOR DEC(__clang_major__) 316 # define COMPILER_VERSION_MINOR DEC(__clang_minor__) 317 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) 318 # if defined(_MSC_VER) 319 /* _MSC_VER = VVRR */ 320 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 321 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 322 # endif 323 324 #elif defined(__GNUC__) 325 # define COMPILER_ID "GNU" 326 # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 327 # if defined(__GNUC_MINOR__) 328 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 329 # endif 330 # if defined(__GNUC_PATCHLEVEL__) 331 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 332 # endif 333 334 #elif defined(_MSC_VER) 335 # define COMPILER_ID "MSVC" 336 /* _MSC_VER = VVRR */ 337 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) 338 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) 339 # if defined(_MSC_FULL_VER) 340 # if _MSC_VER >= 1400 341 /* _MSC_FULL_VER = VVRRPPPPP */ 342 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 343 # else 344 /* _MSC_FULL_VER = VVRRPPPP */ 345 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 346 # endif 347 # endif 348 # if defined(_MSC_BUILD) 349 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 350 # endif 351 352 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 353 # define COMPILER_ID "ADSP" 354 #if defined(__VISUALDSPVERSION__) 355 /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ 356 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) 357 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) 358 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) 359 #endif 360 361 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) 362 # define COMPILER_ID "IAR" 363 # if defined(__VER__) && defined(__ICCARM__) 364 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) 365 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) 366 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) 367 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) 368 # elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) 369 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) 370 # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) 371 # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) 372 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) 373 # endif 374 375 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) 376 # define COMPILER_ID "SDCC" 377 # if defined(__SDCC_VERSION_MAJOR) 378 # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) 379 # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) 380 # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) 381 # else 382 /* SDCC = VRP */ 383 # define COMPILER_VERSION_MAJOR DEC(SDCC/100) 384 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) 385 # define COMPILER_VERSION_PATCH DEC(SDCC % 10) 386 # endif 387 388 389 /* These compilers are either not known or too old to define an 390 identification macro. Try to identify the platform and guess that 391 it is the native compiler. */ 392 #elif defined(__hpux) || defined(__hpua) 393 # define COMPILER_ID "HP" 394 395 #else /* unknown compiler */ 396 # define COMPILER_ID "" 397 #endif 398 399 /* Construct the string literal in pieces to prevent the source from 400 getting matched. Store it in a pointer rather than an array 401 because some compilers will just produce instructions to fill the 402 array rather than assigning a pointer to a static array. */ 403 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; 404 #ifdef SIMULATE_ID 405 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; 406 #endif 407 408 #ifdef __QNXNTO__ 409 char const* qnxnto = "INFO" ":" "qnxnto[]"; 410 #endif 411 412 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET) 413 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; 414 #endif 415 416 #define STRINGIFY_HELPER(X) #X 417 #define STRINGIFY(X) STRINGIFY_HELPER(X) 418 419 /* Identify known platforms by name. */ 420 #if defined(__linux) || defined(__linux__) || defined(linux) 421 # define PLATFORM_ID "Linux" 422 423 #elif defined(__MSYS__) 424 # define PLATFORM_ID "MSYS" 425 426 #elif defined(__CYGWIN__) 427 # define PLATFORM_ID "Cygwin" 428 429 #elif defined(__MINGW32__) 430 # define PLATFORM_ID "MinGW" 431 432 #elif defined(__APPLE__) 433 # define PLATFORM_ID "Darwin" 434 435 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 436 # define PLATFORM_ID "Windows" 437 438 #elif defined(__FreeBSD__) || defined(__FreeBSD) 439 # define PLATFORM_ID "FreeBSD" 440 441 #elif defined(__NetBSD__) || defined(__NetBSD) 442 # define PLATFORM_ID "NetBSD" 443 444 #elif defined(__OpenBSD__) || defined(__OPENBSD) 445 # define PLATFORM_ID "OpenBSD" 446 447 #elif defined(__sun) || defined(sun) 448 # define PLATFORM_ID "SunOS" 449 450 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 451 # define PLATFORM_ID "AIX" 452 453 #elif defined(__hpux) || defined(__hpux__) 454 # define PLATFORM_ID "HP-UX" 455 456 #elif defined(__HAIKU__) 457 # define PLATFORM_ID "Haiku" 458 459 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 460 # define PLATFORM_ID "BeOS" 461 462 #elif defined(__QNX__) || defined(__QNXNTO__) 463 # define PLATFORM_ID "QNX" 464 465 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 466 # define PLATFORM_ID "Tru64" 467 468 #elif defined(__riscos) || defined(__riscos__) 469 # define PLATFORM_ID "RISCos" 470 471 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 472 # define PLATFORM_ID "SINIX" 473 474 #elif defined(__UNIX_SV__) 475 # define PLATFORM_ID "UNIX_SV" 476 477 #elif defined(__bsdos__) 478 # define PLATFORM_ID "BSDOS" 479 480 #elif defined(_MPRAS) || defined(MPRAS) 481 # define PLATFORM_ID "MP-RAS" 482 483 #elif defined(__osf) || defined(__osf__) 484 # define PLATFORM_ID "OSF1" 485 486 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 487 # define PLATFORM_ID "SCO_SV" 488 489 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 490 # define PLATFORM_ID "ULTRIX" 491 492 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 493 # define PLATFORM_ID "Xenix" 494 495 #elif defined(__WATCOMC__) 496 # if defined(__LINUX__) 497 # define PLATFORM_ID "Linux" 498 499 # elif defined(__DOS__) 500 # define PLATFORM_ID "DOS" 501 502 # elif defined(__OS2__) 503 # define PLATFORM_ID "OS2" 504 505 # elif defined(__WINDOWS__) 506 # define PLATFORM_ID "Windows3x" 507 508 # elif defined(__VXWORKS__) 509 # define PLATFORM_ID "VxWorks" 510 511 # else /* unknown platform */ 512 # define PLATFORM_ID 513 # endif 514 515 #elif defined(__INTEGRITY) 516 # if defined(INT_178B) 517 # define PLATFORM_ID "Integrity178" 518 519 # else /* regular Integrity */ 520 # define PLATFORM_ID "Integrity" 521 # endif 522 523 #else /* unknown platform */ 524 # define PLATFORM_ID 525 526 #endif 527 528 /* For windows compilers MSVC and Intel we can determine 529 the architecture of the compiler being used. This is because 530 the compilers do not have flags that can change the architecture, 531 but rather depend on which compiler is being used 532 */ 533 #if defined(_WIN32) && defined(_MSC_VER) 534 # if defined(_M_IA64) 535 # define ARCHITECTURE_ID "IA64" 536 537 # elif defined(_M_ARM64EC) 538 # define ARCHITECTURE_ID "ARM64EC" 539 540 # elif defined(_M_X64) || defined(_M_AMD64) 541 # define ARCHITECTURE_ID "x64" 542 543 # elif defined(_M_IX86) 544 # define ARCHITECTURE_ID "X86" 545 546 # elif defined(_M_ARM64) 547 # define ARCHITECTURE_ID "ARM64" 548 549 # elif defined(_M_ARM) 550 # if _M_ARM == 4 551 # define ARCHITECTURE_ID "ARMV4I" 552 # elif _M_ARM == 5 553 # define ARCHITECTURE_ID "ARMV5I" 554 # else 555 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) 556 # endif 557 558 # elif defined(_M_MIPS) 559 # define ARCHITECTURE_ID "MIPS" 560 561 # elif defined(_M_SH) 562 # define ARCHITECTURE_ID "SHx" 563 564 # else /* unknown architecture */ 565 # define ARCHITECTURE_ID "" 566 # endif 567 568 #elif defined(__WATCOMC__) 569 # if defined(_M_I86) 570 # define ARCHITECTURE_ID "I86" 571 572 # elif defined(_M_IX86) 573 # define ARCHITECTURE_ID "X86" 574 575 # else /* unknown architecture */ 576 # define ARCHITECTURE_ID "" 577 # endif 578 579 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) 580 # if defined(__ICCARM__) 581 # define ARCHITECTURE_ID "ARM" 582 583 # elif defined(__ICCRX__) 584 # define ARCHITECTURE_ID "RX" 585 586 # elif defined(__ICCRH850__) 587 # define ARCHITECTURE_ID "RH850" 588 589 # elif defined(__ICCRL78__) 590 # define ARCHITECTURE_ID "RL78" 591 592 # elif defined(__ICCRISCV__) 593 # define ARCHITECTURE_ID "RISCV" 594 595 # elif defined(__ICCAVR__) 596 # define ARCHITECTURE_ID "AVR" 597 598 # elif defined(__ICC430__) 599 # define ARCHITECTURE_ID "MSP430" 600 601 # elif defined(__ICCV850__) 602 # define ARCHITECTURE_ID "V850" 603 604 # elif defined(__ICC8051__) 605 # define ARCHITECTURE_ID "8051" 606 607 # elif defined(__ICCSTM8__) 608 # define ARCHITECTURE_ID "STM8" 609 610 # else /* unknown architecture */ 611 # define ARCHITECTURE_ID "" 612 # endif 613 614 #elif defined(__ghs__) 615 # if defined(__PPC64__) 616 # define ARCHITECTURE_ID "PPC64" 617 618 # elif defined(__ppc__) 619 # define ARCHITECTURE_ID "PPC" 620 621 # elif defined(__ARM__) 622 # define ARCHITECTURE_ID "ARM" 623 624 # elif defined(__x86_64__) 625 # define ARCHITECTURE_ID "x64" 626 627 # elif defined(__i386__) 628 # define ARCHITECTURE_ID "X86" 629 630 # else /* unknown architecture */ 631 # define ARCHITECTURE_ID "" 632 # endif 633 634 #elif defined(__TI_COMPILER_VERSION__) 635 # if defined(__TI_ARM__) 636 # define ARCHITECTURE_ID "ARM" 637 638 # elif defined(__MSP430__) 639 # define ARCHITECTURE_ID "MSP430" 640 641 # elif defined(__TMS320C28XX__) 642 # define ARCHITECTURE_ID "TMS320C28x" 643 644 # elif defined(__TMS320C6X__) || defined(_TMS320C6X) 645 # define ARCHITECTURE_ID "TMS320C6x" 646 647 # else /* unknown architecture */ 648 # define ARCHITECTURE_ID "" 649 # endif 650 651 #else 652 # define ARCHITECTURE_ID 653 #endif 654 655 /* Convert integer to decimal digit literals. */ 656 #define DEC(n) \ 657 ('0' + (((n) / 10000000)%10)), \ 658 ('0' + (((n) / 1000000)%10)), \ 659 ('0' + (((n) / 100000)%10)), \ 660 ('0' + (((n) / 10000)%10)), \ 661 ('0' + (((n) / 1000)%10)), \ 662 ('0' + (((n) / 100)%10)), \ 663 ('0' + (((n) / 10)%10)), \ 664 ('0' + ((n) % 10)) 665 666 /* Convert integer to hex digit literals. */ 667 #define HEX(n) \ 668 ('0' + ((n)>>28 & 0xF)), \ 669 ('0' + ((n)>>24 & 0xF)), \ 670 ('0' + ((n)>>20 & 0xF)), \ 671 ('0' + ((n)>>16 & 0xF)), \ 672 ('0' + ((n)>>12 & 0xF)), \ 673 ('0' + ((n)>>8 & 0xF)), \ 674 ('0' + ((n)>>4 & 0xF)), \ 675 ('0' + ((n) & 0xF)) 676 677 /* Construct a string literal encoding the version number. */ 678 #ifdef COMPILER_VERSION 679 char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; 680 681 /* Construct a string literal encoding the version number components. */ 682 #elif defined(COMPILER_VERSION_MAJOR) 683 char const info_version[] = { 684 'I', 'N', 'F', 'O', ':', 685 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', 686 COMPILER_VERSION_MAJOR, 687 # ifdef COMPILER_VERSION_MINOR 688 '.', COMPILER_VERSION_MINOR, 689 # ifdef COMPILER_VERSION_PATCH 690 '.', COMPILER_VERSION_PATCH, 691 # ifdef COMPILER_VERSION_TWEAK 692 '.', COMPILER_VERSION_TWEAK, 693 # endif 694 # endif 695 # endif 696 ']','\0'}; 697 #endif 698 699 /* Construct a string literal encoding the internal version number. */ 700 #ifdef COMPILER_VERSION_INTERNAL 701 char const info_version_internal[] = { 702 'I', 'N', 'F', 'O', ':', 703 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', 704 'i','n','t','e','r','n','a','l','[', 705 COMPILER_VERSION_INTERNAL,']','\0'}; 706 #elif defined(COMPILER_VERSION_INTERNAL_STR) 707 char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; 708 #endif 709 710 /* Construct a string literal encoding the version number components. */ 711 #ifdef SIMULATE_VERSION_MAJOR 712 char const info_simulate_version[] = { 713 'I', 'N', 'F', 'O', ':', 714 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', 715 SIMULATE_VERSION_MAJOR, 716 # ifdef SIMULATE_VERSION_MINOR 717 '.', SIMULATE_VERSION_MINOR, 718 # ifdef SIMULATE_VERSION_PATCH 719 '.', SIMULATE_VERSION_PATCH, 720 # ifdef SIMULATE_VERSION_TWEAK 721 '.', SIMULATE_VERSION_TWEAK, 722 # endif 723 # endif 724 # endif 725 ']','\0'}; 726 #endif 727 728 /* Construct the string literal in pieces to prevent the source from 729 getting matched. Store it in a pointer rather than an array 730 because some compilers will just produce instructions to fill the 731 array rather than assigning a pointer to a static array. */ 732 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; 733 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; 734 735 736 737 #if !defined(__STDC__) && !defined(__clang__) 738 # if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) 739 # define C_VERSION "90" 740 # else 741 # define C_VERSION 742 # endif 743 #elif __STDC_VERSION__ > 201710L 744 # define C_VERSION "23" 745 #elif __STDC_VERSION__ >= 201710L 746 # define C_VERSION "17" 747 #elif __STDC_VERSION__ >= 201000L 748 # define C_VERSION "11" 749 #elif __STDC_VERSION__ >= 199901L 750 # define C_VERSION "99" 751 #else 752 # define C_VERSION "90" 753 #endif 754 const char* info_language_standard_default = 755 "INFO" ":" "standard_default[" C_VERSION "]"; 756 757 const char* info_language_extensions_default = "INFO" ":" "extensions_default[" 758 #if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ 759 defined(__TI_COMPILER_VERSION__)) && \ 760 !defined(__STRICT_ANSI__) 761 "ON" 762 #else 763 "OFF" 764 #endif 765 "]"; 766 767 /*--------------------------------------------------------------------------*/ 768 769 #ifdef ID_VOID_MAIN 770 void main() {} 771 #else 772 # if defined(__CLASSIC_C__) 773 int main(argc, argv) int argc; char *argv[]; 774 # else 775 int main(int argc, char* argv[]) 776 # endif 777 { 778 int require = 0; 779 require += info_compiler[argc]; 780 require += info_platform[argc]; 781 require += info_arch[argc]; 782 #ifdef COMPILER_VERSION_MAJOR 783 require += info_version[argc]; 784 #endif 785 #ifdef COMPILER_VERSION_INTERNAL 786 require += info_version_internal[argc]; 787 #endif 788 #ifdef SIMULATE_ID 789 require += info_simulate[argc]; 790 #endif 791 #ifdef SIMULATE_VERSION_MAJOR 792 require += info_simulate_version[argc]; 793 #endif 794 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET) 795 require += info_cray[argc]; 796 #endif 797 require += info_language_standard_default[argc]; 798 require += info_language_extensions_default[argc]; 799 (void)argv; 800 return require; 801 } 802 #endif