CYCAMORE
Loading...
Searching...
No Matches
CMakeCXXCompilerId.cpp
Go to the documentation of this file.
1/* This source file must have a .cpp extension so that all C++ compilers
2 recognize the extension without flags. Borland does not know .cxx for
3 example. */
4#ifndef __cplusplus
5# error "A C compiler has been selected for C++."
6#endif
7
8#if !defined(__has_include)
9/* If the compiler does not have __has_include, pretend the answer is
10 always no. */
11# define __has_include(x) 0
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 version 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_CC)
141# define COMPILER_ID "SunPro"
142# if __SUNPRO_CC >= 0x5100
143 /* __SUNPRO_CC = 0xVRRP */
144# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
145# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
146# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
147# else
148 /* __SUNPRO_CC = 0xVRP */
149# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
150# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
151# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
152# endif
153
154#elif defined(__HP_aCC)
155# define COMPILER_ID "HP"
156 /* __HP_aCC = VVRRPP */
157# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
158# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
159# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
160
161#elif defined(__DECCXX)
162# define COMPILER_ID "Compaq"
163 /* __DECCXX_VER = VVRRTPPPP */
164# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
165# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
166# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
167
168#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
169# define COMPILER_ID "zOS"
170 /* __IBMCPP__ = VRP */
171# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
172# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
173# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
174
175#elif defined(__open_xl__) && defined(__clang__)
176# define COMPILER_ID "IBMClang"
177# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
178# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
179# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
180# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
181
182
183#elif defined(__ibmxl__) && defined(__clang__)
184# define COMPILER_ID "XLClang"
185# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
186# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
187# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
188# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
189
190
191#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
192# define COMPILER_ID "XL"
193 /* __IBMCPP__ = VRP */
194# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
195# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
196# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
197
198#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
199# define COMPILER_ID "VisualAge"
200 /* __IBMCPP__ = VRP */
201# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
202# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
203# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
204
205#elif defined(__NVCOMPILER)
206# define COMPILER_ID "NVHPC"
207# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
208# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
209# if defined(__NVCOMPILER_PATCHLEVEL__)
210# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
211# endif
212
213#elif defined(__PGI)
214# define COMPILER_ID "PGI"
215# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
216# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
217# if defined(__PGIC_PATCHLEVEL__)
218# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
219# endif
220
221#elif defined(__clang__) && defined(__cray__)
222# define COMPILER_ID "CrayClang"
223# define COMPILER_VERSION_MAJOR DEC(__cray_major__)
224# define COMPILER_VERSION_MINOR DEC(__cray_minor__)
225# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__)
226# define COMPILER_VERSION_INTERNAL_STR __clang_version__
227
228
229#elif defined(_CRAYC)
230# define COMPILER_ID "Cray"
231# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
232# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
233
234#elif defined(__TI_COMPILER_VERSION__)
235# define COMPILER_ID "TI"
236 /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
237# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
238# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
239# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
240
241#elif defined(__CLANG_FUJITSU)
242# define COMPILER_ID "FujitsuClang"
243# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
244# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
245# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
246# define COMPILER_VERSION_INTERNAL_STR __clang_version__
247
248
249#elif defined(__FUJITSU)
250# define COMPILER_ID "Fujitsu"
251# if defined(__FCC_version__)
252# define COMPILER_VERSION __FCC_version__
253# elif defined(__FCC_major__)
254# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
255# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
256# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
257# endif
258# if defined(__fcc_version)
259# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
260# elif defined(__FCC_VERSION)
261# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
262# endif
263
264
265#elif defined(__ghs__)
266# define COMPILER_ID "GHS"
267/* __GHS_VERSION_NUMBER = VVVVRP */
268# ifdef __GHS_VERSION_NUMBER
269# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
270# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
271# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
272# endif
273
274#elif defined(__TASKING__)
275# define COMPILER_ID "Tasking"
276 # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
277 # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
278# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
279
280#elif defined(__ORANGEC__)
281# define COMPILER_ID "OrangeC"
282# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__)
283# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__)
284# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__)
285
286#elif defined(__SCO_VERSION__)
287# define COMPILER_ID "SCO"
288
289#elif defined(__ARMCC_VERSION) && !defined(__clang__)
290# define COMPILER_ID "ARMCC"
291#if __ARMCC_VERSION >= 1000000
292 /* __ARMCC_VERSION = VRRPPPP */
293 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
294 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
295 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
296#else
297 /* __ARMCC_VERSION = VRPPPP */
298 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
299 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
300 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
301#endif
302
303
304#elif defined(__clang__) && defined(__apple_build_version__)
305# define COMPILER_ID "AppleClang"
306# if defined(_MSC_VER)
307# define SIMULATE_ID "MSVC"
308# endif
309# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
310# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
311# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
312# if defined(_MSC_VER)
313 /* _MSC_VER = VVRR */
314# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
315# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
316# endif
317# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
318
319#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
320# define COMPILER_ID "ARMClang"
321 # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
322 # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
323 # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100)
324# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
325
326#elif defined(__clang__) && defined(__ti__)
327# define COMPILER_ID "TIClang"
328 # define COMPILER_VERSION_MAJOR DEC(__ti_major__)
329 # define COMPILER_VERSION_MINOR DEC(__ti_minor__)
330 # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__)
331# define COMPILER_VERSION_INTERNAL DEC(__ti_version__)
332
333#elif defined(__clang__)
334# define COMPILER_ID "Clang"
335# if defined(_MSC_VER)
336# define SIMULATE_ID "MSVC"
337# endif
338# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
339# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
340# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
341# if defined(_MSC_VER)
342 /* _MSC_VER = VVRR */
343# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
344# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
345# endif
346
347#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
348# define COMPILER_ID "LCC"
349# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
350# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
351# if defined(__LCC_MINOR__)
352# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
353# endif
354# if defined(__GNUC__) && defined(__GNUC_MINOR__)
355# define SIMULATE_ID "GNU"
356# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
357# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
358# if defined(__GNUC_PATCHLEVEL__)
359# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
360# endif
361# endif
362
363#elif defined(__GNUC__) || defined(__GNUG__)
364# define COMPILER_ID "GNU"
365# if defined(__GNUC__)
366# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
367# else
368# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
369# endif
370# if defined(__GNUC_MINOR__)
371# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
372# endif
373# if defined(__GNUC_PATCHLEVEL__)
374# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
375# endif
376
377#elif defined(_MSC_VER)
378# define COMPILER_ID "MSVC"
379 /* _MSC_VER = VVRR */
380# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
381# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
382# if defined(_MSC_FULL_VER)
383# if _MSC_VER >= 1400
384 /* _MSC_FULL_VER = VVRRPPPPP */
385# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
386# else
387 /* _MSC_FULL_VER = VVRRPPPP */
388# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
389# endif
390# endif
391# if defined(_MSC_BUILD)
392# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
393# endif
394
395#elif defined(_ADI_COMPILER)
396# define COMPILER_ID "ADSP"
397#if defined(__VERSIONNUM__)
398 /* __VERSIONNUM__ = 0xVVRRPPTT */
399# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
400# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
401# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
402# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
403#endif
404
405#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
406# define COMPILER_ID "IAR"
407# if defined(__VER__) && defined(__ICCARM__)
408# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
409# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
410# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
411# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
412# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
413# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
414# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
415# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
416# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
417# endif
418
419
420/* These compilers are either not known or too old to define an
421 identification macro. Try to identify the platform and guess that
422 it is the native compiler. */
423#elif defined(__hpux) || defined(__hpua)
424# define COMPILER_ID "HP"
425
426#else /* unknown compiler */
427# define COMPILER_ID ""
428#endif
429
430/* Construct the string literal in pieces to prevent the source from
431 getting matched. Store it in a pointer rather than an array
432 because some compilers will just produce instructions to fill the
433 array rather than assigning a pointer to a static array. */
434char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
435#ifdef SIMULATE_ID
436char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
437#endif
438
439#ifdef __QNXNTO__
440char const* qnxnto = "INFO" ":" "qnxnto[]";
441#endif
442
443#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
444char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
445#endif
446
447#define STRINGIFY_HELPER(X) #X
448#define STRINGIFY(X) STRINGIFY_HELPER(X)
449
450/* Identify known platforms by name. */
451#if defined(__linux) || defined(__linux__) || defined(linux)
452# define PLATFORM_ID "Linux"
453
454#elif defined(__MSYS__)
455# define PLATFORM_ID "MSYS"
456
457#elif defined(__CYGWIN__)
458# define PLATFORM_ID "Cygwin"
459
460#elif defined(__MINGW32__)
461# define PLATFORM_ID "MinGW"
462
463#elif defined(__APPLE__)
464# define PLATFORM_ID "Darwin"
465
466#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
467# define PLATFORM_ID "Windows"
468
469#elif defined(__FreeBSD__) || defined(__FreeBSD)
470# define PLATFORM_ID "FreeBSD"
471
472#elif defined(__NetBSD__) || defined(__NetBSD)
473# define PLATFORM_ID "NetBSD"
474
475#elif defined(__OpenBSD__) || defined(__OPENBSD)
476# define PLATFORM_ID "OpenBSD"
477
478#elif defined(__sun) || defined(sun)
479# define PLATFORM_ID "SunOS"
480
481#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
482# define PLATFORM_ID "AIX"
483
484#elif defined(__hpux) || defined(__hpux__)
485# define PLATFORM_ID "HP-UX"
486
487#elif defined(__HAIKU__)
488# define PLATFORM_ID "Haiku"
489
490#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
491# define PLATFORM_ID "BeOS"
492
493#elif defined(__QNX__) || defined(__QNXNTO__)
494# define PLATFORM_ID "QNX"
495
496#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
497# define PLATFORM_ID "Tru64"
498
499#elif defined(__riscos) || defined(__riscos__)
500# define PLATFORM_ID "RISCos"
501
502#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
503# define PLATFORM_ID "SINIX"
504
505#elif defined(__UNIX_SV__)
506# define PLATFORM_ID "UNIX_SV"
507
508#elif defined(__bsdos__)
509# define PLATFORM_ID "BSDOS"
510
511#elif defined(_MPRAS) || defined(MPRAS)
512# define PLATFORM_ID "MP-RAS"
513
514#elif defined(__osf) || defined(__osf__)
515# define PLATFORM_ID "OSF1"
516
517#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
518# define PLATFORM_ID "SCO_SV"
519
520#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
521# define PLATFORM_ID "ULTRIX"
522
523#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
524# define PLATFORM_ID "Xenix"
525
526#elif defined(__WATCOMC__)
527# if defined(__LINUX__)
528# define PLATFORM_ID "Linux"
529
530# elif defined(__DOS__)
531# define PLATFORM_ID "DOS"
532
533# elif defined(__OS2__)
534# define PLATFORM_ID "OS2"
535
536# elif defined(__WINDOWS__)
537# define PLATFORM_ID "Windows3x"
538
539# elif defined(__VXWORKS__)
540# define PLATFORM_ID "VxWorks"
541
542# else /* unknown platform */
543# define PLATFORM_ID
544# endif
545
546#elif defined(__INTEGRITY)
547# if defined(INT_178B)
548# define PLATFORM_ID "Integrity178"
549
550# else /* regular Integrity */
551# define PLATFORM_ID "Integrity"
552# endif
553
554# elif defined(_ADI_COMPILER)
555# define PLATFORM_ID "ADSP"
556
557#else /* unknown platform */
558# define PLATFORM_ID
559
560#endif
561
562/* For windows compilers MSVC and Intel we can determine
563 the architecture of the compiler being used. This is because
564 the compilers do not have flags that can change the architecture,
565 but rather depend on which compiler is being used
566*/
567#if defined(_WIN32) && defined(_MSC_VER)
568# if defined(_M_IA64)
569# define ARCHITECTURE_ID "IA64"
570
571# elif defined(_M_ARM64EC)
572# define ARCHITECTURE_ID "ARM64EC"
573
574# elif defined(_M_X64) || defined(_M_AMD64)
575# define ARCHITECTURE_ID "x64"
576
577# elif defined(_M_IX86)
578# define ARCHITECTURE_ID "X86"
579
580# elif defined(_M_ARM64)
581# define ARCHITECTURE_ID "ARM64"
582
583# elif defined(_M_ARM)
584# if _M_ARM == 4
585# define ARCHITECTURE_ID "ARMV4I"
586# elif _M_ARM == 5
587# define ARCHITECTURE_ID "ARMV5I"
588# else
589# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
590# endif
591
592# elif defined(_M_MIPS)
593# define ARCHITECTURE_ID "MIPS"
594
595# elif defined(_M_SH)
596# define ARCHITECTURE_ID "SHx"
597
598# else /* unknown architecture */
599# define ARCHITECTURE_ID ""
600# endif
601
602#elif defined(__WATCOMC__)
603# if defined(_M_I86)
604# define ARCHITECTURE_ID "I86"
605
606# elif defined(_M_IX86)
607# define ARCHITECTURE_ID "X86"
608
609# else /* unknown architecture */
610# define ARCHITECTURE_ID ""
611# endif
612
613#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
614# if defined(__ICCARM__)
615# define ARCHITECTURE_ID "ARM"
616
617# elif defined(__ICCRX__)
618# define ARCHITECTURE_ID "RX"
619
620# elif defined(__ICCRH850__)
621# define ARCHITECTURE_ID "RH850"
622
623# elif defined(__ICCRL78__)
624# define ARCHITECTURE_ID "RL78"
625
626# elif defined(__ICCRISCV__)
627# define ARCHITECTURE_ID "RISCV"
628
629# elif defined(__ICCAVR__)
630# define ARCHITECTURE_ID "AVR"
631
632# elif defined(__ICC430__)
633# define ARCHITECTURE_ID "MSP430"
634
635# elif defined(__ICCV850__)
636# define ARCHITECTURE_ID "V850"
637
638# elif defined(__ICC8051__)
639# define ARCHITECTURE_ID "8051"
640
641# elif defined(__ICCSTM8__)
642# define ARCHITECTURE_ID "STM8"
643
644# else /* unknown architecture */
645# define ARCHITECTURE_ID ""
646# endif
647
648#elif defined(__ghs__)
649# if defined(__PPC64__)
650# define ARCHITECTURE_ID "PPC64"
651
652# elif defined(__ppc__)
653# define ARCHITECTURE_ID "PPC"
654
655# elif defined(__ARM__)
656# define ARCHITECTURE_ID "ARM"
657
658# elif defined(__x86_64__)
659# define ARCHITECTURE_ID "x64"
660
661# elif defined(__i386__)
662# define ARCHITECTURE_ID "X86"
663
664# else /* unknown architecture */
665# define ARCHITECTURE_ID ""
666# endif
667
668#elif defined(__clang__) && defined(__ti__)
669# if defined(__ARM_ARCH)
670# define ARCHITECTURE_ID "Arm"
671
672# else /* unknown architecture */
673# define ARCHITECTURE_ID ""
674# endif
675
676#elif defined(__TI_COMPILER_VERSION__)
677# if defined(__TI_ARM__)
678# define ARCHITECTURE_ID "ARM"
679
680# elif defined(__MSP430__)
681# define ARCHITECTURE_ID "MSP430"
682
683# elif defined(__TMS320C28XX__)
684# define ARCHITECTURE_ID "TMS320C28x"
685
686# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
687# define ARCHITECTURE_ID "TMS320C6x"
688
689# else /* unknown architecture */
690# define ARCHITECTURE_ID ""
691# endif
692
693# elif defined(__ADSPSHARC__)
694# define ARCHITECTURE_ID "SHARC"
695
696# elif defined(__ADSPBLACKFIN__)
697# define ARCHITECTURE_ID "Blackfin"
698
699#elif defined(__TASKING__)
700
701# if defined(__CTC__) || defined(__CPTC__)
702# define ARCHITECTURE_ID "TriCore"
703
704# elif defined(__CMCS__)
705# define ARCHITECTURE_ID "MCS"
706
707# elif defined(__CARM__)
708# define ARCHITECTURE_ID "ARM"
709
710# elif defined(__CARC__)
711# define ARCHITECTURE_ID "ARC"
712
713# elif defined(__C51__)
714# define ARCHITECTURE_ID "8051"
715
716# elif defined(__CPCP__)
717# define ARCHITECTURE_ID "PCP"
718
719# else
720# define ARCHITECTURE_ID ""
721# endif
722
723#else
724# define ARCHITECTURE_ID
725#endif
726
727/* Convert integer to decimal digit literals. */
728#define DEC(n) \
729 ('0' + (((n) / 10000000)%10)), \
730 ('0' + (((n) / 1000000)%10)), \
731 ('0' + (((n) / 100000)%10)), \
732 ('0' + (((n) / 10000)%10)), \
733 ('0' + (((n) / 1000)%10)), \
734 ('0' + (((n) / 100)%10)), \
735 ('0' + (((n) / 10)%10)), \
736 ('0' + ((n) % 10))
737
738/* Convert integer to hex digit literals. */
739#define HEX(n) \
740 ('0' + ((n)>>28 & 0xF)), \
741 ('0' + ((n)>>24 & 0xF)), \
742 ('0' + ((n)>>20 & 0xF)), \
743 ('0' + ((n)>>16 & 0xF)), \
744 ('0' + ((n)>>12 & 0xF)), \
745 ('0' + ((n)>>8 & 0xF)), \
746 ('0' + ((n)>>4 & 0xF)), \
747 ('0' + ((n) & 0xF))
748
749/* Construct a string literal encoding the version number. */
750#ifdef COMPILER_VERSION
751char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
752
753/* Construct a string literal encoding the version number components. */
754#elif defined(COMPILER_VERSION_MAJOR)
755char const info_version[] = {
756 'I', 'N', 'F', 'O', ':',
757 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
758 COMPILER_VERSION_MAJOR,
759# ifdef COMPILER_VERSION_MINOR
760 '.', COMPILER_VERSION_MINOR,
761# ifdef COMPILER_VERSION_PATCH
762 '.', COMPILER_VERSION_PATCH,
763# ifdef COMPILER_VERSION_TWEAK
764 '.', COMPILER_VERSION_TWEAK,
765# endif
766# endif
767# endif
768 ']','\0'};
769#endif
770
771/* Construct a string literal encoding the internal version number. */
772#ifdef COMPILER_VERSION_INTERNAL
773char const info_version_internal[] = {
774 'I', 'N', 'F', 'O', ':',
775 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
776 'i','n','t','e','r','n','a','l','[',
777 COMPILER_VERSION_INTERNAL,']','\0'};
778#elif defined(COMPILER_VERSION_INTERNAL_STR)
779char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
780#endif
781
782/* Construct a string literal encoding the version number components. */
783#ifdef SIMULATE_VERSION_MAJOR
784char const info_simulate_version[] = {
785 'I', 'N', 'F', 'O', ':',
786 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
787 SIMULATE_VERSION_MAJOR,
788# ifdef SIMULATE_VERSION_MINOR
789 '.', SIMULATE_VERSION_MINOR,
790# ifdef SIMULATE_VERSION_PATCH
791 '.', SIMULATE_VERSION_PATCH,
792# ifdef SIMULATE_VERSION_TWEAK
793 '.', SIMULATE_VERSION_TWEAK,
794# endif
795# endif
796# endif
797 ']','\0'};
798#endif
799
800/* Construct the string literal in pieces to prevent the source from
801 getting matched. Store it in a pointer rather than an array
802 because some compilers will just produce instructions to fill the
803 array rather than assigning a pointer to a static array. */
804char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
805char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
806
807
808
809#define CXX_STD_98 199711L
810#define CXX_STD_11 201103L
811#define CXX_STD_14 201402L
812#define CXX_STD_17 201703L
813#define CXX_STD_20 202002L
814#define CXX_STD_23 202302L
815
816#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG)
817# if _MSVC_LANG > CXX_STD_17
818# define CXX_STD _MSVC_LANG
819# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
820# define CXX_STD CXX_STD_20
821# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17
822# define CXX_STD CXX_STD_20
823# elif _MSVC_LANG > CXX_STD_14
824# define CXX_STD CXX_STD_17
825# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)
826# define CXX_STD CXX_STD_14
827# elif defined(__INTEL_CXX11_MODE__)
828# define CXX_STD CXX_STD_11
829# else
830# define CXX_STD CXX_STD_98
831# endif
832#elif defined(_MSC_VER) && defined(_MSVC_LANG)
833# if _MSVC_LANG > __cplusplus
834# define CXX_STD _MSVC_LANG
835# else
836# define CXX_STD __cplusplus
837# endif
838#elif defined(__NVCOMPILER)
839# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
840# define CXX_STD CXX_STD_20
841# else
842# define CXX_STD __cplusplus
843# endif
844#elif defined(__INTEL_COMPILER) || defined(__PGI)
845# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes)
846# define CXX_STD CXX_STD_17
847# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
848# define CXX_STD CXX_STD_14
849# else
850# define CXX_STD __cplusplus
851# endif
852#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__)
853# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
854# define CXX_STD CXX_STD_14
855# else
856# define CXX_STD __cplusplus
857# endif
858#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__)
859# define CXX_STD CXX_STD_11
860#else
861# define CXX_STD __cplusplus
862#endif
863
864const char* info_language_standard_default = "INFO" ":" "standard_default["
865#if CXX_STD > CXX_STD_23
866 "26"
867#elif CXX_STD > CXX_STD_20
868 "23"
869#elif CXX_STD > CXX_STD_17
870 "20"
871#elif CXX_STD > CXX_STD_14
872 "17"
873#elif CXX_STD > CXX_STD_11
874 "14"
875#elif CXX_STD >= CXX_STD_11
876 "11"
877#else
878 "98"
879#endif
880"]";
881
882const char* info_language_extensions_default = "INFO" ":" "extensions_default["
883#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
884 defined(__TI_COMPILER_VERSION__)) && \
885 !defined(__STRICT_ANSI__)
886 "ON"
887#else
888 "OFF"
889#endif
890"]";
891
892/*--------------------------------------------------------------------------*/
893
894int main(int argc, char* argv[])
895{
896 int require = 0;
897 require += info_compiler[argc];
898 require += info_platform[argc];
899 require += info_arch[argc];
900#ifdef COMPILER_VERSION_MAJOR
901 require += info_version[argc];
902#endif
903#ifdef COMPILER_VERSION_INTERNAL
904 require += info_version_internal[argc];
905#endif
906#ifdef SIMULATE_ID
907 require += info_simulate[argc];
908#endif
909#ifdef SIMULATE_VERSION_MAJOR
910 require += info_simulate_version[argc];
911#endif
912#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
913 require += info_cray[argc];
914#endif
915 require += info_language_standard_default[argc];
916 require += info_language_extensions_default[argc];
917 (void)argv;
918 return require;
919}
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 PLATFORM_ID