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