rocprofiler-sdk/CMakeFiles/3.27.4/CompilerIdCXX/CMakeCXXCompilerId.cpp Source File

rocprofiler-sdk/CMakeFiles/3.27.4/CompilerIdCXX/CMakeCXXCompilerId.cpp Source File#

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