libcopp  1.1.0
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  /* __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(__TINYC__)
176 # define COMPILER_ID "TinyCC"
177 
178 #elif defined(__BCC__)
179 # define COMPILER_ID "Bruce"
180 
181 #elif defined(__SCO_VERSION__)
182 # define COMPILER_ID "SCO"
183 
184 #elif defined(__clang__) && defined(__apple_build_version__)
185 # define COMPILER_ID "AppleClang"
186 # if defined(_MSC_VER)
187 # define SIMULATE_ID "MSVC"
188 # endif
189 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
190 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
191 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
192 # if defined(_MSC_VER)
193  /* _MSC_VER = VVRR */
194 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
195 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
196 # endif
197 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
198 
199 #elif defined(__clang__)
200 # define COMPILER_ID "Clang"
201 # if defined(_MSC_VER)
202 # define SIMULATE_ID "MSVC"
203 # endif
204 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
205 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
206 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
207 # if defined(_MSC_VER)
208  /* _MSC_VER = VVRR */
209 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
210 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
211 # endif
212 
213 #elif defined(__GNUC__)
214 # define COMPILER_ID "GNU"
215 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
216 # if defined(__GNUC_MINOR__)
217 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
218 # endif
219 # if defined(__GNUC_PATCHLEVEL__)
220 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
221 # endif
222 
223 #elif defined(_MSC_VER)
224 # define COMPILER_ID "MSVC"
225  /* _MSC_VER = VVRR */
226 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
227 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
228 # if defined(_MSC_FULL_VER)
229 # if _MSC_VER >= 1400
230  /* _MSC_FULL_VER = VVRRPPPPP */
231 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
232 # else
233  /* _MSC_FULL_VER = VVRRPPPP */
234 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
235 # endif
236 # endif
237 # if defined(_MSC_BUILD)
238 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
239 # endif
240 
241 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
242 # define COMPILER_ID "ADSP"
243 #if defined(__VISUALDSPVERSION__)
244  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
245 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
246 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
247 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
248 #endif
249 
250 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
251 # define COMPILER_ID "IAR"
252 # if defined(__VER__)
253 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
254 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
255 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
256 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
257 # endif
258 
259 #elif defined(__ARMCC_VERSION)
260 # define COMPILER_ID "ARMCC"
261 #if __ARMCC_VERSION >= 1000000
262  /* __ARMCC_VERSION = VRRPPPP */
263  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
264  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
265  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
266 #else
267  /* __ARMCC_VERSION = VRPPPP */
268  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
269  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
270  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
271 #endif
272 
273 
274 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
275 # define COMPILER_ID "SDCC"
276 # if defined(__SDCC_VERSION_MAJOR)
277 # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
278 # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
279 # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
280 # else
281  /* SDCC = VRP */
282 # define COMPILER_VERSION_MAJOR DEC(SDCC/100)
283 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
284 # define COMPILER_VERSION_PATCH DEC(SDCC % 10)
285 # endif
286 
287 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
288 # define COMPILER_ID "MIPSpro"
289 # if defined(_SGI_COMPILER_VERSION)
290  /* _SGI_COMPILER_VERSION = VRP */
291 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
292 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
293 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
294 # else
295  /* _COMPILER_VERSION = VRP */
296 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
297 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
298 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
299 # endif
300 
301 
302 /* These compilers are either not known or too old to define an
303  identification macro. Try to identify the platform and guess that
304  it is the native compiler. */
305 #elif defined(__sgi)
306 # define COMPILER_ID "MIPSpro"
307 
308 #elif defined(__hpux) || defined(__hpua)
309 # define COMPILER_ID "HP"
310 
311 #else /* unknown compiler */
312 # define COMPILER_ID ""
313 #endif
314 
315 /* Construct the string literal in pieces to prevent the source from
316  getting matched. Store it in a pointer rather than an array
317  because some compilers will just produce instructions to fill the
318  array rather than assigning a pointer to a static array. */
319 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
320 #ifdef SIMULATE_ID
321 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
322 #endif
323 
324 #ifdef __QNXNTO__
325 char const* qnxnto = "INFO" ":" "qnxnto[]";
326 #endif
327 
328 #if defined(__CRAYXE) || defined(__CRAYXC)
329 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
330 #endif
331 
332 #define STRINGIFY_HELPER(X) #X
333 #define STRINGIFY(X) STRINGIFY_HELPER(X)
334 
335 /* Identify known platforms by name. */
336 #if defined(__linux) || defined(__linux__) || defined(linux)
337 # define PLATFORM_ID "Linux"
338 
339 #elif defined(__CYGWIN__)
340 # define PLATFORM_ID "Cygwin"
341 
342 #elif defined(__MINGW32__)
343 # define PLATFORM_ID "MinGW"
344 
345 #elif defined(__APPLE__)
346 # define PLATFORM_ID "Darwin"
347 
348 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
349 # define PLATFORM_ID "Windows"
350 
351 #elif defined(__FreeBSD__) || defined(__FreeBSD)
352 # define PLATFORM_ID "FreeBSD"
353 
354 #elif defined(__NetBSD__) || defined(__NetBSD)
355 # define PLATFORM_ID "NetBSD"
356 
357 #elif defined(__OpenBSD__) || defined(__OPENBSD)
358 # define PLATFORM_ID "OpenBSD"
359 
360 #elif defined(__sun) || defined(sun)
361 # define PLATFORM_ID "SunOS"
362 
363 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
364 # define PLATFORM_ID "AIX"
365 
366 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
367 # define PLATFORM_ID "IRIX"
368 
369 #elif defined(__hpux) || defined(__hpux__)
370 # define PLATFORM_ID "HP-UX"
371 
372 #elif defined(__HAIKU__)
373 # define PLATFORM_ID "Haiku"
374 
375 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
376 # define PLATFORM_ID "BeOS"
377 
378 #elif defined(__QNX__) || defined(__QNXNTO__)
379 # define PLATFORM_ID "QNX"
380 
381 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
382 # define PLATFORM_ID "Tru64"
383 
384 #elif defined(__riscos) || defined(__riscos__)
385 # define PLATFORM_ID "RISCos"
386 
387 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
388 # define PLATFORM_ID "SINIX"
389 
390 #elif defined(__UNIX_SV__)
391 # define PLATFORM_ID "UNIX_SV"
392 
393 #elif defined(__bsdos__)
394 # define PLATFORM_ID "BSDOS"
395 
396 #elif defined(_MPRAS) || defined(MPRAS)
397 # define PLATFORM_ID "MP-RAS"
398 
399 #elif defined(__osf) || defined(__osf__)
400 # define PLATFORM_ID "OSF1"
401 
402 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
403 # define PLATFORM_ID "SCO_SV"
404 
405 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
406 # define PLATFORM_ID "ULTRIX"
407 
408 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
409 # define PLATFORM_ID "Xenix"
410 
411 #elif defined(__WATCOMC__)
412 # if defined(__LINUX__)
413 # define PLATFORM_ID "Linux"
414 
415 # elif defined(__DOS__)
416 # define PLATFORM_ID "DOS"
417 
418 # elif defined(__OS2__)
419 # define PLATFORM_ID "OS2"
420 
421 # elif defined(__WINDOWS__)
422 # define PLATFORM_ID "Windows3x"
423 
424 # else /* unknown platform */
425 # define PLATFORM_ID
426 # endif
427 
428 #else /* unknown platform */
429 # define PLATFORM_ID
430 
431 #endif
432 
433 /* For windows compilers MSVC and Intel we can determine
434  the architecture of the compiler being used. This is because
435  the compilers do not have flags that can change the architecture,
436  but rather depend on which compiler is being used
437 */
438 #if defined(_WIN32) && defined(_MSC_VER)
439 # if defined(_M_IA64)
440 # define ARCHITECTURE_ID "IA64"
441 
442 # elif defined(_M_X64) || defined(_M_AMD64)
443 # define ARCHITECTURE_ID "x64"
444 
445 # elif defined(_M_IX86)
446 # define ARCHITECTURE_ID "X86"
447 
448 # elif defined(_M_ARM64)
449 # define ARCHITECTURE_ID "ARM64"
450 
451 # elif defined(_M_ARM)
452 # if _M_ARM == 4
453 # define ARCHITECTURE_ID "ARMV4I"
454 # elif _M_ARM == 5
455 # define ARCHITECTURE_ID "ARMV5I"
456 # else
457 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
458 # endif
459 
460 # elif defined(_M_MIPS)
461 # define ARCHITECTURE_ID "MIPS"
462 
463 # elif defined(_M_SH)
464 # define ARCHITECTURE_ID "SHx"
465 
466 # else /* unknown architecture */
467 # define ARCHITECTURE_ID ""
468 # endif
469 
470 #elif defined(__WATCOMC__)
471 # if defined(_M_I86)
472 # define ARCHITECTURE_ID "I86"
473 
474 # elif defined(_M_IX86)
475 # define ARCHITECTURE_ID "X86"
476 
477 # else /* unknown architecture */
478 # define ARCHITECTURE_ID ""
479 # endif
480 
481 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
482 # if defined(__ICCARM__)
483 # define ARCHITECTURE_ID "ARM"
484 
485 # elif defined(__ICCAVR__)
486 # define ARCHITECTURE_ID "AVR"
487 
488 # else /* unknown architecture */
489 # define ARCHITECTURE_ID ""
490 # endif
491 #else
492 # define ARCHITECTURE_ID
493 #endif
494 
495 /* Convert integer to decimal digit literals. */
496 #define DEC(n) \
497  ('0' + (((n) / 10000000)%10)), \
498  ('0' + (((n) / 1000000)%10)), \
499  ('0' + (((n) / 100000)%10)), \
500  ('0' + (((n) / 10000)%10)), \
501  ('0' + (((n) / 1000)%10)), \
502  ('0' + (((n) / 100)%10)), \
503  ('0' + (((n) / 10)%10)), \
504  ('0' + ((n) % 10))
505 
506 /* Convert integer to hex digit literals. */
507 #define HEX(n) \
508  ('0' + ((n)>>28 & 0xF)), \
509  ('0' + ((n)>>24 & 0xF)), \
510  ('0' + ((n)>>20 & 0xF)), \
511  ('0' + ((n)>>16 & 0xF)), \
512  ('0' + ((n)>>12 & 0xF)), \
513  ('0' + ((n)>>8 & 0xF)), \
514  ('0' + ((n)>>4 & 0xF)), \
515  ('0' + ((n) & 0xF))
516 
517 /* Construct a string literal encoding the version number components. */
518 #ifdef COMPILER_VERSION_MAJOR
519 char const info_version[] = {
520  'I', 'N', 'F', 'O', ':',
521  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
522  COMPILER_VERSION_MAJOR,
523 # ifdef COMPILER_VERSION_MINOR
524  '.', COMPILER_VERSION_MINOR,
525 # ifdef COMPILER_VERSION_PATCH
526  '.', COMPILER_VERSION_PATCH,
527 # ifdef COMPILER_VERSION_TWEAK
528  '.', COMPILER_VERSION_TWEAK,
529 # endif
530 # endif
531 # endif
532  ']','\0'};
533 #endif
534 
535 /* Construct a string literal encoding the internal version number. */
536 #ifdef COMPILER_VERSION_INTERNAL
537 char const info_version_internal[] = {
538  'I', 'N', 'F', 'O', ':',
539  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
540  'i','n','t','e','r','n','a','l','[',
541  COMPILER_VERSION_INTERNAL,']','\0'};
542 #endif
543 
544 /* Construct a string literal encoding the version number components. */
545 #ifdef SIMULATE_VERSION_MAJOR
546 char const info_simulate_version[] = {
547  'I', 'N', 'F', 'O', ':',
548  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
549  SIMULATE_VERSION_MAJOR,
550 # ifdef SIMULATE_VERSION_MINOR
551  '.', SIMULATE_VERSION_MINOR,
552 # ifdef SIMULATE_VERSION_PATCH
553  '.', SIMULATE_VERSION_PATCH,
554 # ifdef SIMULATE_VERSION_TWEAK
555  '.', SIMULATE_VERSION_TWEAK,
556 # endif
557 # endif
558 # endif
559  ']','\0'};
560 #endif
561 
562 /* Construct the string literal in pieces to prevent the source from
563  getting matched. Store it in a pointer rather than an array
564  because some compilers will just produce instructions to fill the
565  array rather than assigning a pointer to a static array. */
566 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
567 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
568 
569 
570 
571 
572 #if !defined(__STDC__)
573 # if (defined(_MSC_VER) && !defined(__clang__)) \
574  || (defined(__ibmxl__) || defined(__IBMC__))
575 # define C_DIALECT "90"
576 # else
577 # define C_DIALECT
578 # endif
579 #elif __STDC_VERSION__ >= 201000L
580 # define C_DIALECT "11"
581 #elif __STDC_VERSION__ >= 199901L
582 # define C_DIALECT "99"
583 #else
584 # define C_DIALECT "90"
585 #endif
587  "INFO" ":" "dialect_default[" C_DIALECT "]";
588 
589 /*--------------------------------------------------------------------------*/
590 
591 #ifdef ID_VOID_MAIN
592 void main() {}
593 #else
594 # if defined(__CLASSIC_C__)
595 int main(argc, argv) int argc; char *argv[];
596 # else
597 int main(int argc, char* argv[])
598 # endif
599 {
600  int require = 0;
601  require += info_compiler[argc];
602  require += info_platform[argc];
603  require += info_arch[argc];
604 #ifdef COMPILER_VERSION_MAJOR
605  require += info_version[argc];
606 #endif
607 #ifdef COMPILER_VERSION_INTERNAL
608  require += info_version_internal[argc];
609 #endif
610 #ifdef SIMULATE_ID
611  require += info_simulate[argc];
612 #endif
613 #ifdef SIMULATE_VERSION_MAJOR
614  require += info_simulate_version[argc];
615 #endif
616 #if defined(__CRAYXE) || defined(__CRAYXC)
617  require += info_cray[argc];
618 #endif
619  require += info_language_dialect_default[argc];
620  (void)argv;
621  return require;
622 }
623 #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