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