B15F Board 15 Famulus Edition

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