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