IODA Bundle
CMakeCCompilerId.c
Go to the documentation of this file.
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__) && __has_include(<hip/hip_version.h>)
311 # define COMPILER_ID "ROCMClang"
312 # if defined(_MSC_VER)
313 # define SIMULATE_ID "MSVC"
314 # elif defined(__clang__)
315 # define SIMULATE_ID "Clang"
316 # elif defined(__GNUC__)
317 # define SIMULATE_ID "GNU"
318 # endif
319 # if defined(__clang__) && __has_include(<hip/hip_version.h>)
320 # include <hip/hip_version.h>
321 # define COMPILER_VERSION_MAJOR DEC(HIP_VERSION_MAJOR)
322 # define COMPILER_VERSION_MINOR DEC(HIP_VERSION_MINOR)
323 # define COMPILER_VERSION_PATCH DEC(HIP_VERSION_PATCH)
324 # endif
325 
326 #elif defined(__clang__)
327 # define COMPILER_ID "Clang"
328 # if defined(_MSC_VER)
329 # define SIMULATE_ID "MSVC"
330 # endif
331 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
332 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
333 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
334 # if defined(_MSC_VER)
335  /* _MSC_VER = VVRR */
336 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
337 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
338 # endif
339 
340 #elif defined(__GNUC__)
341 # define COMPILER_ID "GNU"
342 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
343 # if defined(__GNUC_MINOR__)
344 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
345 # endif
346 # if defined(__GNUC_PATCHLEVEL__)
347 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
348 # endif
349 
350 #elif defined(_MSC_VER)
351 # define COMPILER_ID "MSVC"
352  /* _MSC_VER = VVRR */
353 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
354 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
355 # if defined(_MSC_FULL_VER)
356 # if _MSC_VER >= 1400
357  /* _MSC_FULL_VER = VVRRPPPPP */
358 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
359 # else
360  /* _MSC_FULL_VER = VVRRPPPP */
361 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
362 # endif
363 # endif
364 # if defined(_MSC_BUILD)
365 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
366 # endif
367 
368 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
369 # define COMPILER_ID "ADSP"
370 #if defined(__VISUALDSPVERSION__)
371  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
372 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
373 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
374 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
375 #endif
376 
377 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
378 # define COMPILER_ID "IAR"
379 # if defined(__VER__) && defined(__ICCARM__)
380 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
381 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
382 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
383 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
384 # elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
385 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
386 # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
387 # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
388 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
389 # endif
390 
391 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
392 # define COMPILER_ID "SDCC"
393 # if defined(__SDCC_VERSION_MAJOR)
394 # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
395 # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
396 # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
397 # else
398  /* SDCC = VRP */
399 # define COMPILER_VERSION_MAJOR DEC(SDCC/100)
400 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
401 # define COMPILER_VERSION_PATCH DEC(SDCC % 10)
402 # endif
403 
404 
405 /* These compilers are either not known or too old to define an
406  identification macro. Try to identify the platform and guess that
407  it is the native compiler. */
408 #elif defined(__hpux) || defined(__hpua)
409 # define COMPILER_ID "HP"
410 
411 #else /* unknown compiler */
412 # define COMPILER_ID ""
413 #endif
414 
415 /* Construct the string literal in pieces to prevent the source from
416  getting matched. Store it in a pointer rather than an array
417  because some compilers will just produce instructions to fill the
418  array rather than assigning a pointer to a static array. */
419 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
420 #ifdef SIMULATE_ID
421 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
422 #endif
423 
424 #ifdef __QNXNTO__
425 char const* qnxnto = "INFO" ":" "qnxnto[]";
426 #endif
427 
428 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
429 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
430 #endif
431 
432 #define STRINGIFY_HELPER(X) #X
433 #define STRINGIFY(X) STRINGIFY_HELPER(X)
434 
435 /* Identify known platforms by name. */
436 #if defined(__linux) || defined(__linux__) || defined(linux)
437 # define PLATFORM_ID "Linux"
438 
439 #elif defined(__MSYS__)
440 # define PLATFORM_ID "MSYS"
441 
442 #elif defined(__CYGWIN__)
443 # define PLATFORM_ID "Cygwin"
444 
445 #elif defined(__MINGW32__)
446 # define PLATFORM_ID "MinGW"
447 
448 #elif defined(__APPLE__)
449 # define PLATFORM_ID "Darwin"
450 
451 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
452 # define PLATFORM_ID "Windows"
453 
454 #elif defined(__FreeBSD__) || defined(__FreeBSD)
455 # define PLATFORM_ID "FreeBSD"
456 
457 #elif defined(__NetBSD__) || defined(__NetBSD)
458 # define PLATFORM_ID "NetBSD"
459 
460 #elif defined(__OpenBSD__) || defined(__OPENBSD)
461 # define PLATFORM_ID "OpenBSD"
462 
463 #elif defined(__sun) || defined(sun)
464 # define PLATFORM_ID "SunOS"
465 
466 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
467 # define PLATFORM_ID "AIX"
468 
469 #elif defined(__hpux) || defined(__hpux__)
470 # define PLATFORM_ID "HP-UX"
471 
472 #elif defined(__HAIKU__)
473 # define PLATFORM_ID "Haiku"
474 
475 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
476 # define PLATFORM_ID "BeOS"
477 
478 #elif defined(__QNX__) || defined(__QNXNTO__)
479 # define PLATFORM_ID "QNX"
480 
481 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
482 # define PLATFORM_ID "Tru64"
483 
484 #elif defined(__riscos) || defined(__riscos__)
485 # define PLATFORM_ID "RISCos"
486 
487 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
488 # define PLATFORM_ID "SINIX"
489 
490 #elif defined(__UNIX_SV__)
491 # define PLATFORM_ID "UNIX_SV"
492 
493 #elif defined(__bsdos__)
494 # define PLATFORM_ID "BSDOS"
495 
496 #elif defined(_MPRAS) || defined(MPRAS)
497 # define PLATFORM_ID "MP-RAS"
498 
499 #elif defined(__osf) || defined(__osf__)
500 # define PLATFORM_ID "OSF1"
501 
502 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
503 # define PLATFORM_ID "SCO_SV"
504 
505 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
506 # define PLATFORM_ID "ULTRIX"
507 
508 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
509 # define PLATFORM_ID "Xenix"
510 
511 #elif defined(__WATCOMC__)
512 # if defined(__LINUX__)
513 # define PLATFORM_ID "Linux"
514 
515 # elif defined(__DOS__)
516 # define PLATFORM_ID "DOS"
517 
518 # elif defined(__OS2__)
519 # define PLATFORM_ID "OS2"
520 
521 # elif defined(__WINDOWS__)
522 # define PLATFORM_ID "Windows3x"
523 
524 # elif defined(__VXWORKS__)
525 # define PLATFORM_ID "VxWorks"
526 
527 # else /* unknown platform */
528 # define PLATFORM_ID
529 # endif
530 
531 #elif defined(__INTEGRITY)
532 # if defined(INT_178B)
533 # define PLATFORM_ID "Integrity178"
534 
535 # else /* regular Integrity */
536 # define PLATFORM_ID "Integrity"
537 # endif
538 
539 #else /* unknown platform */
540 # define PLATFORM_ID
541 
542 #endif
543 
544 /* For windows compilers MSVC and Intel we can determine
545  the architecture of the compiler being used. This is because
546  the compilers do not have flags that can change the architecture,
547  but rather depend on which compiler is being used
548 */
549 #if defined(_WIN32) && defined(_MSC_VER)
550 # if defined(_M_IA64)
551 # define ARCHITECTURE_ID "IA64"
552 
553 # elif defined(_M_ARM64EC)
554 # define ARCHITECTURE_ID "ARM64EC"
555 
556 # elif defined(_M_X64) || defined(_M_AMD64)
557 # define ARCHITECTURE_ID "x64"
558 
559 # elif defined(_M_IX86)
560 # define ARCHITECTURE_ID "X86"
561 
562 # elif defined(_M_ARM64)
563 # define ARCHITECTURE_ID "ARM64"
564 
565 # elif defined(_M_ARM)
566 # if _M_ARM == 4
567 # define ARCHITECTURE_ID "ARMV4I"
568 # elif _M_ARM == 5
569 # define ARCHITECTURE_ID "ARMV5I"
570 # else
571 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
572 # endif
573 
574 # elif defined(_M_MIPS)
575 # define ARCHITECTURE_ID "MIPS"
576 
577 # elif defined(_M_SH)
578 # define ARCHITECTURE_ID "SHx"
579 
580 # else /* unknown architecture */
581 # define ARCHITECTURE_ID ""
582 # endif
583 
584 #elif defined(__WATCOMC__)
585 # if defined(_M_I86)
586 # define ARCHITECTURE_ID "I86"
587 
588 # elif defined(_M_IX86)
589 # define ARCHITECTURE_ID "X86"
590 
591 # else /* unknown architecture */
592 # define ARCHITECTURE_ID ""
593 # endif
594 
595 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
596 # if defined(__ICCARM__)
597 # define ARCHITECTURE_ID "ARM"
598 
599 # elif defined(__ICCRX__)
600 # define ARCHITECTURE_ID "RX"
601 
602 # elif defined(__ICCRH850__)
603 # define ARCHITECTURE_ID "RH850"
604 
605 # elif defined(__ICCRL78__)
606 # define ARCHITECTURE_ID "RL78"
607 
608 # elif defined(__ICCRISCV__)
609 # define ARCHITECTURE_ID "RISCV"
610 
611 # elif defined(__ICCAVR__)
612 # define ARCHITECTURE_ID "AVR"
613 
614 # elif defined(__ICC430__)
615 # define ARCHITECTURE_ID "MSP430"
616 
617 # elif defined(__ICCV850__)
618 # define ARCHITECTURE_ID "V850"
619 
620 # elif defined(__ICC8051__)
621 # define ARCHITECTURE_ID "8051"
622 
623 # elif defined(__ICCSTM8__)
624 # define ARCHITECTURE_ID "STM8"
625 
626 # else /* unknown architecture */
627 # define ARCHITECTURE_ID ""
628 # endif
629 
630 #elif defined(__ghs__)
631 # if defined(__PPC64__)
632 # define ARCHITECTURE_ID "PPC64"
633 
634 # elif defined(__ppc__)
635 # define ARCHITECTURE_ID "PPC"
636 
637 # elif defined(__ARM__)
638 # define ARCHITECTURE_ID "ARM"
639 
640 # elif defined(__x86_64__)
641 # define ARCHITECTURE_ID "x64"
642 
643 # elif defined(__i386__)
644 # define ARCHITECTURE_ID "X86"
645 
646 # else /* unknown architecture */
647 # define ARCHITECTURE_ID ""
648 # endif
649 
650 #elif defined(__TI_COMPILER_VERSION__)
651 # if defined(__TI_ARM__)
652 # define ARCHITECTURE_ID "ARM"
653 
654 # elif defined(__MSP430__)
655 # define ARCHITECTURE_ID "MSP430"
656 
657 # elif defined(__TMS320C28XX__)
658 # define ARCHITECTURE_ID "TMS320C28x"
659 
660 # elif defined(__TMS320C6X__) || defined(_TMS320C6X)
661 # define ARCHITECTURE_ID "TMS320C6x"
662 
663 # else /* unknown architecture */
664 # define ARCHITECTURE_ID ""
665 # endif
666 
667 #else
668 # define ARCHITECTURE_ID
669 #endif
670 
671 /* Convert integer to decimal digit literals. */
672 #define DEC(n) \
673  ('0' + (((n) / 10000000)%10)), \
674  ('0' + (((n) / 1000000)%10)), \
675  ('0' + (((n) / 100000)%10)), \
676  ('0' + (((n) / 10000)%10)), \
677  ('0' + (((n) / 1000)%10)), \
678  ('0' + (((n) / 100)%10)), \
679  ('0' + (((n) / 10)%10)), \
680  ('0' + ((n) % 10))
681 
682 /* Convert integer to hex digit literals. */
683 #define HEX(n) \
684  ('0' + ((n)>>28 & 0xF)), \
685  ('0' + ((n)>>24 & 0xF)), \
686  ('0' + ((n)>>20 & 0xF)), \
687  ('0' + ((n)>>16 & 0xF)), \
688  ('0' + ((n)>>12 & 0xF)), \
689  ('0' + ((n)>>8 & 0xF)), \
690  ('0' + ((n)>>4 & 0xF)), \
691  ('0' + ((n) & 0xF))
692 
693 /* Construct a string literal encoding the version number. */
694 #ifdef COMPILER_VERSION
695 char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
696 
697 /* Construct a string literal encoding the version number components. */
698 #elif defined(COMPILER_VERSION_MAJOR)
699 char const info_version[] = {
700  'I', 'N', 'F', 'O', ':',
701  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
702  COMPILER_VERSION_MAJOR,
703 # ifdef COMPILER_VERSION_MINOR
704  '.', COMPILER_VERSION_MINOR,
705 # ifdef COMPILER_VERSION_PATCH
706  '.', COMPILER_VERSION_PATCH,
707 # ifdef COMPILER_VERSION_TWEAK
708  '.', COMPILER_VERSION_TWEAK,
709 # endif
710 # endif
711 # endif
712  ']','\0'};
713 #endif
714 
715 /* Construct a string literal encoding the internal version number. */
716 #ifdef COMPILER_VERSION_INTERNAL
717 char const info_version_internal[] = {
718  'I', 'N', 'F', 'O', ':',
719  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
720  'i','n','t','e','r','n','a','l','[',
721  COMPILER_VERSION_INTERNAL,']','\0'};
722 #elif defined(COMPILER_VERSION_INTERNAL_STR)
723 char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
724 #endif
725 
726 /* Construct a string literal encoding the version number components. */
727 #ifdef SIMULATE_VERSION_MAJOR
728 char const info_simulate_version[] = {
729  'I', 'N', 'F', 'O', ':',
730  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
731  SIMULATE_VERSION_MAJOR,
732 # ifdef SIMULATE_VERSION_MINOR
733  '.', SIMULATE_VERSION_MINOR,
734 # ifdef SIMULATE_VERSION_PATCH
735  '.', SIMULATE_VERSION_PATCH,
736 # ifdef SIMULATE_VERSION_TWEAK
737  '.', SIMULATE_VERSION_TWEAK,
738 # endif
739 # endif
740 # endif
741  ']','\0'};
742 #endif
743 
744 /* Construct the string literal in pieces to prevent the source from
745  getting matched. Store it in a pointer rather than an array
746  because some compilers will just produce instructions to fill the
747  array rather than assigning a pointer to a static array. */
748 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
749 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
750 
751 
752 
753 #if !defined(__STDC__) && !defined(__clang__)
754 # if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
755 # define C_DIALECT "90"
756 # else
757 # define C_DIALECT
758 # endif
759 #elif __STDC_VERSION__ > 201710L
760 # define C_DIALECT "23"
761 #elif __STDC_VERSION__ >= 201710L
762 # define C_DIALECT "17"
763 #elif __STDC_VERSION__ >= 201000L
764 # define C_DIALECT "11"
765 #elif __STDC_VERSION__ >= 199901L
766 # define C_DIALECT "99"
767 #else
768 # define C_DIALECT "90"
769 #endif
771  "INFO" ":" "dialect_default[" C_DIALECT "]";
772 
773 /*--------------------------------------------------------------------------*/
774 
775 #ifdef ID_VOID_MAIN
776 void main() {}
777 #else
778 # if defined(__CLASSIC_C__)
779 int main(argc, argv) int argc; char *argv[];
780 # else
781 int main(int argc, char* argv[])
782 # endif
783 {
784  int require = 0;
785  require += info_compiler[argc];
786  require += info_platform[argc];
787  require += info_arch[argc];
788 #ifdef COMPILER_VERSION_MAJOR
789  require += info_version[argc];
790 #endif
791 #ifdef COMPILER_VERSION_INTERNAL
792  require += info_version_internal[argc];
793 #endif
794 #ifdef SIMULATE_ID
795  require += info_simulate[argc];
796 #endif
797 #ifdef SIMULATE_VERSION_MAJOR
798  require += info_simulate_version[argc];
799 #endif
800 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
801  require += info_cray[argc];
802 #endif
803  require += info_language_dialect_default[argc];
804  (void)argv;
805  return require;
806 }
807 #endif
#define C_DIALECT
int main(int argc, char *argv[])
const char * info_language_dialect_default
char const * info_platform
char const * info_compiler
char const * info_arch
#define COMPILER_ID
#define ARCHITECTURE_ID
#define PLATFORM_ID