config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

CMakeCCompilerId.c (27496B)


      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(__open_xl__) && defined(__clang__)
    182 # define COMPILER_ID "IBMClang"
    183 # define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
    184 # define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
    185 # define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
    186 # define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
    187 
    188 
    189 #elif defined(__ibmxl__) && defined(__clang__)
    190 # define COMPILER_ID "XLClang"
    191 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
    192 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
    193 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
    194 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
    195 
    196 
    197 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
    198 # define COMPILER_ID "XL"
    199   /* __IBMC__ = VRP */
    200 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
    201 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
    202 # define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
    203 
    204 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
    205 # define COMPILER_ID "VisualAge"
    206   /* __IBMC__ = VRP */
    207 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
    208 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
    209 # define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
    210 
    211 #elif defined(__NVCOMPILER)
    212 # define COMPILER_ID "NVHPC"
    213 # define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
    214 # define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
    215 # if defined(__NVCOMPILER_PATCHLEVEL__)
    216 #  define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
    217 # endif
    218 
    219 #elif defined(__PGI)
    220 # define COMPILER_ID "PGI"
    221 # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
    222 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
    223 # if defined(__PGIC_PATCHLEVEL__)
    224 #  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
    225 # endif
    226 
    227 #elif defined(__clang__) && defined(__cray__)
    228 # define COMPILER_ID "CrayClang"
    229 # define COMPILER_VERSION_MAJOR DEC(__cray_major__)
    230 # define COMPILER_VERSION_MINOR DEC(__cray_minor__)
    231 # define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__)
    232 # define COMPILER_VERSION_INTERNAL_STR __clang_version__
    233 
    234 
    235 #elif defined(_CRAYC)
    236 # define COMPILER_ID "Cray"
    237 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
    238 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
    239 
    240 #elif defined(__TI_COMPILER_VERSION__)
    241 # define COMPILER_ID "TI"
    242   /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
    243 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
    244 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
    245 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)
    246 
    247 #elif defined(__CLANG_FUJITSU)
    248 # define COMPILER_ID "FujitsuClang"
    249 # define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
    250 # define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
    251 # define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
    252 # define COMPILER_VERSION_INTERNAL_STR __clang_version__
    253 
    254 
    255 #elif defined(__FUJITSU)
    256 # define COMPILER_ID "Fujitsu"
    257 # if defined(__FCC_version__)
    258 #   define COMPILER_VERSION __FCC_version__
    259 # elif defined(__FCC_major__)
    260 #   define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
    261 #   define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
    262 #   define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
    263 # endif
    264 # if defined(__fcc_version)
    265 #   define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
    266 # elif defined(__FCC_VERSION)
    267 #   define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
    268 # endif
    269 
    270 
    271 #elif defined(__ghs__)
    272 # define COMPILER_ID "GHS"
    273 /* __GHS_VERSION_NUMBER = VVVVRP */
    274 # ifdef __GHS_VERSION_NUMBER
    275 # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
    276 # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
    277 # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER      % 10)
    278 # endif
    279 
    280 #elif defined(__TASKING__)
    281 # define COMPILER_ID "Tasking"
    282   # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
    283   # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
    284 # define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
    285 
    286 #elif defined(__ORANGEC__)
    287 # define COMPILER_ID "OrangeC"
    288 # define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__)
    289 # define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__)
    290 # define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__)
    291 
    292 #elif defined(__TINYC__)
    293 # define COMPILER_ID "TinyCC"
    294 
    295 #elif defined(__BCC__)
    296 # define COMPILER_ID "Bruce"
    297 
    298 #elif defined(__SCO_VERSION__)
    299 # define COMPILER_ID "SCO"
    300 
    301 #elif defined(__ARMCC_VERSION) && !defined(__clang__)
    302 # define COMPILER_ID "ARMCC"
    303 #if __ARMCC_VERSION >= 1000000
    304   /* __ARMCC_VERSION = VRRPPPP */
    305   # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
    306   # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
    307   # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION     % 10000)
    308 #else
    309   /* __ARMCC_VERSION = VRPPPP */
    310   # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
    311   # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
    312   # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION    % 10000)
    313 #endif
    314 
    315 
    316 #elif defined(__clang__) && defined(__apple_build_version__)
    317 # define COMPILER_ID "AppleClang"
    318 # if defined(_MSC_VER)
    319 #  define SIMULATE_ID "MSVC"
    320 # endif
    321 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
    322 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
    323 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
    324 # if defined(_MSC_VER)
    325    /* _MSC_VER = VVRR */
    326 #  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
    327 #  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
    328 # endif
    329 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
    330 
    331 #elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
    332 # define COMPILER_ID "ARMClang"
    333   # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
    334   # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
    335   # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100   % 100)
    336 # define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
    337 
    338 #elif defined(__clang__) && defined(__ti__)
    339 # define COMPILER_ID "TIClang"
    340   # define COMPILER_VERSION_MAJOR DEC(__ti_major__)
    341   # define COMPILER_VERSION_MINOR DEC(__ti_minor__)
    342   # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__)
    343 # define COMPILER_VERSION_INTERNAL DEC(__ti_version__)
    344 
    345 #elif defined(__clang__)
    346 # define COMPILER_ID "Clang"
    347 # if defined(_MSC_VER)
    348 #  define SIMULATE_ID "MSVC"
    349 # endif
    350 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
    351 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
    352 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
    353 # if defined(_MSC_VER)
    354    /* _MSC_VER = VVRR */
    355 #  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
    356 #  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
    357 # endif
    358 
    359 #elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
    360 # define COMPILER_ID "LCC"
    361 # define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
    362 # define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
    363 # if defined(__LCC_MINOR__)
    364 #  define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
    365 # endif
    366 # if defined(__GNUC__) && defined(__GNUC_MINOR__)
    367 #  define SIMULATE_ID "GNU"
    368 #  define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
    369 #  define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
    370 #  if defined(__GNUC_PATCHLEVEL__)
    371 #   define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
    372 #  endif
    373 # endif
    374 
    375 #elif defined(__GNUC__)
    376 # define COMPILER_ID "GNU"
    377 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
    378 # if defined(__GNUC_MINOR__)
    379 #  define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
    380 # endif
    381 # if defined(__GNUC_PATCHLEVEL__)
    382 #  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
    383 # endif
    384 
    385 #elif defined(_MSC_VER)
    386 # define COMPILER_ID "MSVC"
    387   /* _MSC_VER = VVRR */
    388 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
    389 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
    390 # if defined(_MSC_FULL_VER)
    391 #  if _MSC_VER >= 1400
    392     /* _MSC_FULL_VER = VVRRPPPPP */
    393 #   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
    394 #  else
    395     /* _MSC_FULL_VER = VVRRPPPP */
    396 #   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
    397 #  endif
    398 # endif
    399 # if defined(_MSC_BUILD)
    400 #  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
    401 # endif
    402 
    403 #elif defined(_ADI_COMPILER)
    404 # define COMPILER_ID "ADSP"
    405 #if defined(__VERSIONNUM__)
    406   /* __VERSIONNUM__ = 0xVVRRPPTT */
    407 #  define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
    408 #  define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
    409 #  define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
    410 #  define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
    411 #endif
    412 
    413 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
    414 # define COMPILER_ID "IAR"
    415 # if defined(__VER__) && defined(__ICCARM__)
    416 #  define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
    417 #  define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
    418 #  define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
    419 #  define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
    420 # elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
    421 #  define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
    422 #  define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
    423 #  define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
    424 #  define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
    425 # endif
    426 
    427 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
    428 # define COMPILER_ID "SDCC"
    429 # if defined(__SDCC_VERSION_MAJOR)
    430 #  define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
    431 #  define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
    432 #  define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
    433 # else
    434   /* SDCC = VRP */
    435 #  define COMPILER_VERSION_MAJOR DEC(SDCC/100)
    436 #  define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
    437 #  define COMPILER_VERSION_PATCH DEC(SDCC    % 10)
    438 # endif
    439 
    440 
    441 /* These compilers are either not known or too old to define an
    442   identification macro.  Try to identify the platform and guess that
    443   it is the native compiler.  */
    444 #elif defined(__hpux) || defined(__hpua)
    445 # define COMPILER_ID "HP"
    446 
    447 #else /* unknown compiler */
    448 # define COMPILER_ID ""
    449 #endif
    450 
    451 /* Construct the string literal in pieces to prevent the source from
    452    getting matched.  Store it in a pointer rather than an array
    453    because some compilers will just produce instructions to fill the
    454    array rather than assigning a pointer to a static array.  */
    455 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
    456 #ifdef SIMULATE_ID
    457 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
    458 #endif
    459 
    460 #ifdef __QNXNTO__
    461 char const* qnxnto = "INFO" ":" "qnxnto[]";
    462 #endif
    463 
    464 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
    465 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
    466 #endif
    467 
    468 #define STRINGIFY_HELPER(X) #X
    469 #define STRINGIFY(X) STRINGIFY_HELPER(X)
    470 
    471 /* Identify known platforms by name.  */
    472 #if defined(__linux) || defined(__linux__) || defined(linux)
    473 # define PLATFORM_ID "Linux"
    474 
    475 #elif defined(__MSYS__)
    476 # define PLATFORM_ID "MSYS"
    477 
    478 #elif defined(__CYGWIN__)
    479 # define PLATFORM_ID "Cygwin"
    480 
    481 #elif defined(__MINGW32__)
    482 # define PLATFORM_ID "MinGW"
    483 
    484 #elif defined(__APPLE__)
    485 # define PLATFORM_ID "Darwin"
    486 
    487 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
    488 # define PLATFORM_ID "Windows"
    489 
    490 #elif defined(__FreeBSD__) || defined(__FreeBSD)
    491 # define PLATFORM_ID "FreeBSD"
    492 
    493 #elif defined(__NetBSD__) || defined(__NetBSD)
    494 # define PLATFORM_ID "NetBSD"
    495 
    496 #elif defined(__OpenBSD__) || defined(__OPENBSD)
    497 # define PLATFORM_ID "OpenBSD"
    498 
    499 #elif defined(__sun) || defined(sun)
    500 # define PLATFORM_ID "SunOS"
    501 
    502 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
    503 # define PLATFORM_ID "AIX"
    504 
    505 #elif defined(__hpux) || defined(__hpux__)
    506 # define PLATFORM_ID "HP-UX"
    507 
    508 #elif defined(__HAIKU__)
    509 # define PLATFORM_ID "Haiku"
    510 
    511 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
    512 # define PLATFORM_ID "BeOS"
    513 
    514 #elif defined(__QNX__) || defined(__QNXNTO__)
    515 # define PLATFORM_ID "QNX"
    516 
    517 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
    518 # define PLATFORM_ID "Tru64"
    519 
    520 #elif defined(__riscos) || defined(__riscos__)
    521 # define PLATFORM_ID "RISCos"
    522 
    523 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
    524 # define PLATFORM_ID "SINIX"
    525 
    526 #elif defined(__UNIX_SV__)
    527 # define PLATFORM_ID "UNIX_SV"
    528 
    529 #elif defined(__bsdos__)
    530 # define PLATFORM_ID "BSDOS"
    531 
    532 #elif defined(_MPRAS) || defined(MPRAS)
    533 # define PLATFORM_ID "MP-RAS"
    534 
    535 #elif defined(__osf) || defined(__osf__)
    536 # define PLATFORM_ID "OSF1"
    537 
    538 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
    539 # define PLATFORM_ID "SCO_SV"
    540 
    541 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
    542 # define PLATFORM_ID "ULTRIX"
    543 
    544 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
    545 # define PLATFORM_ID "Xenix"
    546 
    547 #elif defined(__WATCOMC__)
    548 # if defined(__LINUX__)
    549 #  define PLATFORM_ID "Linux"
    550 
    551 # elif defined(__DOS__)
    552 #  define PLATFORM_ID "DOS"
    553 
    554 # elif defined(__OS2__)
    555 #  define PLATFORM_ID "OS2"
    556 
    557 # elif defined(__WINDOWS__)
    558 #  define PLATFORM_ID "Windows3x"
    559 
    560 # elif defined(__VXWORKS__)
    561 #  define PLATFORM_ID "VxWorks"
    562 
    563 # else /* unknown platform */
    564 #  define PLATFORM_ID
    565 # endif
    566 
    567 #elif defined(__INTEGRITY)
    568 # if defined(INT_178B)
    569 #  define PLATFORM_ID "Integrity178"
    570 
    571 # else /* regular Integrity */
    572 #  define PLATFORM_ID "Integrity"
    573 # endif
    574 
    575 # elif defined(_ADI_COMPILER)
    576 #  define PLATFORM_ID "ADSP"
    577 
    578 #else /* unknown platform */
    579 # define PLATFORM_ID
    580 
    581 #endif
    582 
    583 /* For windows compilers MSVC and Intel we can determine
    584    the architecture of the compiler being used.  This is because
    585    the compilers do not have flags that can change the architecture,
    586    but rather depend on which compiler is being used
    587 */
    588 #if defined(_WIN32) && defined(_MSC_VER)
    589 # if defined(_M_IA64)
    590 #  define ARCHITECTURE_ID "IA64"
    591 
    592 # elif defined(_M_ARM64EC)
    593 #  define ARCHITECTURE_ID "ARM64EC"
    594 
    595 # elif defined(_M_X64) || defined(_M_AMD64)
    596 #  define ARCHITECTURE_ID "x64"
    597 
    598 # elif defined(_M_IX86)
    599 #  define ARCHITECTURE_ID "X86"
    600 
    601 # elif defined(_M_ARM64)
    602 #  define ARCHITECTURE_ID "ARM64"
    603 
    604 # elif defined(_M_ARM)
    605 #  if _M_ARM == 4
    606 #   define ARCHITECTURE_ID "ARMV4I"
    607 #  elif _M_ARM == 5
    608 #   define ARCHITECTURE_ID "ARMV5I"
    609 #  else
    610 #   define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
    611 #  endif
    612 
    613 # elif defined(_M_MIPS)
    614 #  define ARCHITECTURE_ID "MIPS"
    615 
    616 # elif defined(_M_SH)
    617 #  define ARCHITECTURE_ID "SHx"
    618 
    619 # else /* unknown architecture */
    620 #  define ARCHITECTURE_ID ""
    621 # endif
    622 
    623 #elif defined(__WATCOMC__)
    624 # if defined(_M_I86)
    625 #  define ARCHITECTURE_ID "I86"
    626 
    627 # elif defined(_M_IX86)
    628 #  define ARCHITECTURE_ID "X86"
    629 
    630 # else /* unknown architecture */
    631 #  define ARCHITECTURE_ID ""
    632 # endif
    633 
    634 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
    635 # if defined(__ICCARM__)
    636 #  define ARCHITECTURE_ID "ARM"
    637 
    638 # elif defined(__ICCRX__)
    639 #  define ARCHITECTURE_ID "RX"
    640 
    641 # elif defined(__ICCRH850__)
    642 #  define ARCHITECTURE_ID "RH850"
    643 
    644 # elif defined(__ICCRL78__)
    645 #  define ARCHITECTURE_ID "RL78"
    646 
    647 # elif defined(__ICCRISCV__)
    648 #  define ARCHITECTURE_ID "RISCV"
    649 
    650 # elif defined(__ICCAVR__)
    651 #  define ARCHITECTURE_ID "AVR"
    652 
    653 # elif defined(__ICC430__)
    654 #  define ARCHITECTURE_ID "MSP430"
    655 
    656 # elif defined(__ICCV850__)
    657 #  define ARCHITECTURE_ID "V850"
    658 
    659 # elif defined(__ICC8051__)
    660 #  define ARCHITECTURE_ID "8051"
    661 
    662 # elif defined(__ICCSTM8__)
    663 #  define ARCHITECTURE_ID "STM8"
    664 
    665 # else /* unknown architecture */
    666 #  define ARCHITECTURE_ID ""
    667 # endif
    668 
    669 #elif defined(__ghs__)
    670 # if defined(__PPC64__)
    671 #  define ARCHITECTURE_ID "PPC64"
    672 
    673 # elif defined(__ppc__)
    674 #  define ARCHITECTURE_ID "PPC"
    675 
    676 # elif defined(__ARM__)
    677 #  define ARCHITECTURE_ID "ARM"
    678 
    679 # elif defined(__x86_64__)
    680 #  define ARCHITECTURE_ID "x64"
    681 
    682 # elif defined(__i386__)
    683 #  define ARCHITECTURE_ID "X86"
    684 
    685 # else /* unknown architecture */
    686 #  define ARCHITECTURE_ID ""
    687 # endif
    688 
    689 #elif defined(__clang__) && defined(__ti__)
    690 # if defined(__ARM_ARCH)
    691 #  define ARCHITECTURE_ID "Arm"
    692 
    693 # else /* unknown architecture */
    694 #  define ARCHITECTURE_ID ""
    695 # endif
    696 
    697 #elif defined(__TI_COMPILER_VERSION__)
    698 # if defined(__TI_ARM__)
    699 #  define ARCHITECTURE_ID "ARM"
    700 
    701 # elif defined(__MSP430__)
    702 #  define ARCHITECTURE_ID "MSP430"
    703 
    704 # elif defined(__TMS320C28XX__)
    705 #  define ARCHITECTURE_ID "TMS320C28x"
    706 
    707 # elif defined(__TMS320C6X__) || defined(_TMS320C6X)
    708 #  define ARCHITECTURE_ID "TMS320C6x"
    709 
    710 # else /* unknown architecture */
    711 #  define ARCHITECTURE_ID ""
    712 # endif
    713 
    714 # elif defined(__ADSPSHARC__)
    715 #  define ARCHITECTURE_ID "SHARC"
    716 
    717 # elif defined(__ADSPBLACKFIN__)
    718 #  define ARCHITECTURE_ID "Blackfin"
    719 
    720 #elif defined(__TASKING__)
    721 
    722 # if defined(__CTC__) || defined(__CPTC__)
    723 #  define ARCHITECTURE_ID "TriCore"
    724 
    725 # elif defined(__CMCS__)
    726 #  define ARCHITECTURE_ID "MCS"
    727 
    728 # elif defined(__CARM__)
    729 #  define ARCHITECTURE_ID "ARM"
    730 
    731 # elif defined(__CARC__)
    732 #  define ARCHITECTURE_ID "ARC"
    733 
    734 # elif defined(__C51__)
    735 #  define ARCHITECTURE_ID "8051"
    736 
    737 # elif defined(__CPCP__)
    738 #  define ARCHITECTURE_ID "PCP"
    739 
    740 # else
    741 #  define ARCHITECTURE_ID ""
    742 # endif
    743 
    744 #else
    745 #  define ARCHITECTURE_ID
    746 #endif
    747 
    748 /* Convert integer to decimal digit literals.  */
    749 #define DEC(n)                   \
    750   ('0' + (((n) / 10000000)%10)), \
    751   ('0' + (((n) / 1000000)%10)),  \
    752   ('0' + (((n) / 100000)%10)),   \
    753   ('0' + (((n) / 10000)%10)),    \
    754   ('0' + (((n) / 1000)%10)),     \
    755   ('0' + (((n) / 100)%10)),      \
    756   ('0' + (((n) / 10)%10)),       \
    757   ('0' +  ((n) % 10))
    758 
    759 /* Convert integer to hex digit literals.  */
    760 #define HEX(n)             \
    761   ('0' + ((n)>>28 & 0xF)), \
    762   ('0' + ((n)>>24 & 0xF)), \
    763   ('0' + ((n)>>20 & 0xF)), \
    764   ('0' + ((n)>>16 & 0xF)), \
    765   ('0' + ((n)>>12 & 0xF)), \
    766   ('0' + ((n)>>8  & 0xF)), \
    767   ('0' + ((n)>>4  & 0xF)), \
    768   ('0' + ((n)     & 0xF))
    769 
    770 /* Construct a string literal encoding the version number. */
    771 #ifdef COMPILER_VERSION
    772 char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
    773 
    774 /* Construct a string literal encoding the version number components. */
    775 #elif defined(COMPILER_VERSION_MAJOR)
    776 char const info_version[] = {
    777   'I', 'N', 'F', 'O', ':',
    778   'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
    779   COMPILER_VERSION_MAJOR,
    780 # ifdef COMPILER_VERSION_MINOR
    781   '.', COMPILER_VERSION_MINOR,
    782 #  ifdef COMPILER_VERSION_PATCH
    783    '.', COMPILER_VERSION_PATCH,
    784 #   ifdef COMPILER_VERSION_TWEAK
    785     '.', COMPILER_VERSION_TWEAK,
    786 #   endif
    787 #  endif
    788 # endif
    789   ']','\0'};
    790 #endif
    791 
    792 /* Construct a string literal encoding the internal version number. */
    793 #ifdef COMPILER_VERSION_INTERNAL
    794 char const info_version_internal[] = {
    795   'I', 'N', 'F', 'O', ':',
    796   'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
    797   'i','n','t','e','r','n','a','l','[',
    798   COMPILER_VERSION_INTERNAL,']','\0'};
    799 #elif defined(COMPILER_VERSION_INTERNAL_STR)
    800 char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
    801 #endif
    802 
    803 /* Construct a string literal encoding the version number components. */
    804 #ifdef SIMULATE_VERSION_MAJOR
    805 char const info_simulate_version[] = {
    806   'I', 'N', 'F', 'O', ':',
    807   's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
    808   SIMULATE_VERSION_MAJOR,
    809 # ifdef SIMULATE_VERSION_MINOR
    810   '.', SIMULATE_VERSION_MINOR,
    811 #  ifdef SIMULATE_VERSION_PATCH
    812    '.', SIMULATE_VERSION_PATCH,
    813 #   ifdef SIMULATE_VERSION_TWEAK
    814     '.', SIMULATE_VERSION_TWEAK,
    815 #   endif
    816 #  endif
    817 # endif
    818   ']','\0'};
    819 #endif
    820 
    821 /* Construct the string literal in pieces to prevent the source from
    822    getting matched.  Store it in a pointer rather than an array
    823    because some compilers will just produce instructions to fill the
    824    array rather than assigning a pointer to a static array.  */
    825 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
    826 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
    827 
    828 
    829 
    830 #if !defined(__STDC__) && !defined(__clang__)
    831 # if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
    832 #  define C_VERSION "90"
    833 # else
    834 #  define C_VERSION
    835 # endif
    836 #elif __STDC_VERSION__ > 201710L
    837 # define C_VERSION "23"
    838 #elif __STDC_VERSION__ >= 201710L
    839 # define C_VERSION "17"
    840 #elif __STDC_VERSION__ >= 201000L
    841 # define C_VERSION "11"
    842 #elif __STDC_VERSION__ >= 199901L
    843 # define C_VERSION "99"
    844 #else
    845 # define C_VERSION "90"
    846 #endif
    847 const char* info_language_standard_default =
    848   "INFO" ":" "standard_default[" C_VERSION "]";
    849 
    850 const char* info_language_extensions_default = "INFO" ":" "extensions_default["
    851 #if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) ||           \
    852      defined(__TI_COMPILER_VERSION__)) &&                                     \
    853   !defined(__STRICT_ANSI__)
    854   "ON"
    855 #else
    856   "OFF"
    857 #endif
    858 "]";
    859 
    860 /*--------------------------------------------------------------------------*/
    861 
    862 #ifdef ID_VOID_MAIN
    863 void main() {}
    864 #else
    865 # if defined(__CLASSIC_C__)
    866 int main(argc, argv) int argc; char *argv[];
    867 # else
    868 int main(int argc, char* argv[])
    869 # endif
    870 {
    871   int require = 0;
    872   require += info_compiler[argc];
    873   require += info_platform[argc];
    874   require += info_arch[argc];
    875 #ifdef COMPILER_VERSION_MAJOR
    876   require += info_version[argc];
    877 #endif
    878 #ifdef COMPILER_VERSION_INTERNAL
    879   require += info_version_internal[argc];
    880 #endif
    881 #ifdef SIMULATE_ID
    882   require += info_simulate[argc];
    883 #endif
    884 #ifdef SIMULATE_VERSION_MAJOR
    885   require += info_simulate_version[argc];
    886 #endif
    887 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
    888   require += info_cray[argc];
    889 #endif
    890   require += info_language_standard_default[argc];
    891   require += info_language_extensions_default[argc];
    892   (void)argv;
    893   return require;
    894 }
    895 #endif