IODA Bundle
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(__ibmxl__) && defined(__clang__)
182 # define COMPILER_ID "XLClang"
183 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
184 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
185 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
186 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
187 
188 
189 #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
190 # define COMPILER_ID "XL"
191  /* __IBMCPP__ = VRP */
192 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
193 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
194 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
195 
196 #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
197 # define COMPILER_ID "VisualAge"
198  /* __IBMCPP__ = VRP */
199 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
200 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
201 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
202 
203 #elif defined(__NVCOMPILER)
204 # define COMPILER_ID "NVHPC"
205 # define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
206 # define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
207 # if defined(__NVCOMPILER_PATCHLEVEL__)
208 # define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
209 # endif
210 
211 #elif defined(__PGI)
212 # define COMPILER_ID "PGI"
213 # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
214 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
215 # if defined(__PGIC_PATCHLEVEL__)
216 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
217 # endif
218 
219 #elif defined(_CRAYC)
220 # define COMPILER_ID "Cray"
221 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
222 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
223 
224 #elif defined(__TI_COMPILER_VERSION__)
225 # define COMPILER_ID "TI"
226  /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
227 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
228 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
229 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
230 
231 #elif defined(__CLANG_FUJITSU)
232 # define COMPILER_ID "FujitsuClang"
233 # define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
234 # define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
235 # define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
236 # define COMPILER_VERSION_INTERNAL_STR __clang_version__
237 
238 
239 #elif defined(__FUJITSU)
240 # define COMPILER_ID "Fujitsu"
241 # if defined(__FCC_version__)
242 # define COMPILER_VERSION __FCC_version__
243 # elif defined(__FCC_major__)
244 # define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
245 # define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
246 # define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
247 # endif
248 # if defined(__fcc_version)
249 # define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
250 # elif defined(__FCC_VERSION)
251 # define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
252 # endif
253 
254 
255 #elif defined(__ghs__)
256 # define COMPILER_ID "GHS"
257 /* __GHS_VERSION_NUMBER = VVVVRP */
258 # ifdef __GHS_VERSION_NUMBER
259 # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
260 # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
261 # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
262 # endif
263 
264 #elif defined(__SCO_VERSION__)
265 # define COMPILER_ID "SCO"
266 
267 #elif defined(__ARMCC_VERSION) && !defined(__clang__)
268 # define COMPILER_ID "ARMCC"
269 #if __ARMCC_VERSION >= 1000000
270  /* __ARMCC_VERSION = VRRPPPP */
271  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
272  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
273  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
274 #else
275  /* __ARMCC_VERSION = VRPPPP */
276  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
277  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
278  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
279 #endif
280 
281 
282 #elif defined(__clang__) && defined(__apple_build_version__)
283 # define COMPILER_ID "AppleClang"
284 # if defined(_MSC_VER)
285 # define SIMULATE_ID "MSVC"
286 # endif
287 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
288 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
289 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
290 # if defined(_MSC_VER)
291  /* _MSC_VER = VVRR */
292 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
293 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
294 # endif
295 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
296 
297 #elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
298 # define COMPILER_ID "ARMClang"
299  # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
300  # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
301  # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
302 # define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
303 
304 #elif defined(__clang__) && __has_include(<hip/hip_version.h>)
305 # define COMPILER_ID "ROCMClang"
306 # if defined(_MSC_VER)
307 # define SIMULATE_ID "MSVC"
308 # elif defined(__clang__)
309 # define SIMULATE_ID "Clang"
310 # elif defined(__GNUC__)
311 # define SIMULATE_ID "GNU"
312 # endif
313 # if defined(__clang__) && __has_include(<hip/hip_version.h>)
314 # include <hip/hip_version.h>
315 # define COMPILER_VERSION_MAJOR DEC(HIP_VERSION_MAJOR)
316 # define COMPILER_VERSION_MINOR DEC(HIP_VERSION_MINOR)
317 # define COMPILER_VERSION_PATCH DEC(HIP_VERSION_PATCH)
318 # endif
319 
320 #elif defined(__clang__)
321 # define COMPILER_ID "Clang"
322 # if defined(_MSC_VER)
323 # define SIMULATE_ID "MSVC"
324 # endif
325 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
326 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
327 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
328 # if defined(_MSC_VER)
329  /* _MSC_VER = VVRR */
330 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
331 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
332 # endif
333 
334 #elif defined(__GNUC__) || defined(__GNUG__)
335 # define COMPILER_ID "GNU"
336 # if defined(__GNUC__)
337 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
338 # else
339 # define COMPILER_VERSION_MAJOR DEC(__GNUG__)
340 # endif
341 # if defined(__GNUC_MINOR__)
342 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
343 # endif
344 # if defined(__GNUC_PATCHLEVEL__)
345 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
346 # endif
347 
348 #elif defined(_MSC_VER)
349 # define COMPILER_ID "MSVC"
350  /* _MSC_VER = VVRR */
351 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
352 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
353 # if defined(_MSC_FULL_VER)
354 # if _MSC_VER >= 1400
355  /* _MSC_FULL_VER = VVRRPPPPP */
356 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
357 # else
358  /* _MSC_FULL_VER = VVRRPPPP */
359 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
360 # endif
361 # endif
362 # if defined(_MSC_BUILD)
363 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
364 # endif
365 
366 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
367 # define COMPILER_ID "ADSP"
368 #if defined(__VISUALDSPVERSION__)
369  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
370 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
371 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
372 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
373 #endif
374 
375 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
376 # define COMPILER_ID "IAR"
377 # if defined(__VER__) && defined(__ICCARM__)
378 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
379 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
380 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
381 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
382 # elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
383 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
384 # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
385 # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
386 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
387 # endif
388 
389 
390 /* These compilers are either not known or too old to define an
391  identification macro. Try to identify the platform and guess that
392  it is the native compiler. */
393 #elif defined(__hpux) || defined(__hpua)
394 # define COMPILER_ID "HP"
395 
396 #else /* unknown compiler */
397 # define COMPILER_ID ""
398 #endif
399 
400 /* Construct the string literal in pieces to prevent the source from
401  getting matched. Store it in a pointer rather than an array
402  because some compilers will just produce instructions to fill the
403  array rather than assigning a pointer to a static array. */
404 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
405 #ifdef SIMULATE_ID
406 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
407 #endif
408 
409 #ifdef __QNXNTO__
410 char const* qnxnto = "INFO" ":" "qnxnto[]";
411 #endif
412 
413 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
414 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
415 #endif
416 
417 #define STRINGIFY_HELPER(X) #X
418 #define STRINGIFY(X) STRINGIFY_HELPER(X)
419 
420 /* Identify known platforms by name. */
421 #if defined(__linux) || defined(__linux__) || defined(linux)
422 # define PLATFORM_ID "Linux"
423 
424 #elif defined(__MSYS__)
425 # define PLATFORM_ID "MSYS"
426 
427 #elif defined(__CYGWIN__)
428 # define PLATFORM_ID "Cygwin"
429 
430 #elif defined(__MINGW32__)
431 # define PLATFORM_ID "MinGW"
432 
433 #elif defined(__APPLE__)
434 # define PLATFORM_ID "Darwin"
435 
436 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
437 # define PLATFORM_ID "Windows"
438 
439 #elif defined(__FreeBSD__) || defined(__FreeBSD)
440 # define PLATFORM_ID "FreeBSD"
441 
442 #elif defined(__NetBSD__) || defined(__NetBSD)
443 # define PLATFORM_ID "NetBSD"
444 
445 #elif defined(__OpenBSD__) || defined(__OPENBSD)
446 # define PLATFORM_ID "OpenBSD"
447 
448 #elif defined(__sun) || defined(sun)
449 # define PLATFORM_ID "SunOS"
450 
451 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
452 # define PLATFORM_ID "AIX"
453 
454 #elif defined(__hpux) || defined(__hpux__)
455 # define PLATFORM_ID "HP-UX"
456 
457 #elif defined(__HAIKU__)
458 # define PLATFORM_ID "Haiku"
459 
460 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
461 # define PLATFORM_ID "BeOS"
462 
463 #elif defined(__QNX__) || defined(__QNXNTO__)
464 # define PLATFORM_ID "QNX"
465 
466 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
467 # define PLATFORM_ID "Tru64"
468 
469 #elif defined(__riscos) || defined(__riscos__)
470 # define PLATFORM_ID "RISCos"
471 
472 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
473 # define PLATFORM_ID "SINIX"
474 
475 #elif defined(__UNIX_SV__)
476 # define PLATFORM_ID "UNIX_SV"
477 
478 #elif defined(__bsdos__)
479 # define PLATFORM_ID "BSDOS"
480 
481 #elif defined(_MPRAS) || defined(MPRAS)
482 # define PLATFORM_ID "MP-RAS"
483 
484 #elif defined(__osf) || defined(__osf__)
485 # define PLATFORM_ID "OSF1"
486 
487 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
488 # define PLATFORM_ID "SCO_SV"
489 
490 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
491 # define PLATFORM_ID "ULTRIX"
492 
493 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
494 # define PLATFORM_ID "Xenix"
495 
496 #elif defined(__WATCOMC__)
497 # if defined(__LINUX__)
498 # define PLATFORM_ID "Linux"
499 
500 # elif defined(__DOS__)
501 # define PLATFORM_ID "DOS"
502 
503 # elif defined(__OS2__)
504 # define PLATFORM_ID "OS2"
505 
506 # elif defined(__WINDOWS__)
507 # define PLATFORM_ID "Windows3x"
508 
509 # elif defined(__VXWORKS__)
510 # define PLATFORM_ID "VxWorks"
511 
512 # else /* unknown platform */
513 # define PLATFORM_ID
514 # endif
515 
516 #elif defined(__INTEGRITY)
517 # if defined(INT_178B)
518 # define PLATFORM_ID "Integrity178"
519 
520 # else /* regular Integrity */
521 # define PLATFORM_ID "Integrity"
522 # endif
523 
524 #else /* unknown platform */
525 # define PLATFORM_ID
526 
527 #endif
528 
529 /* For windows compilers MSVC and Intel we can determine
530  the architecture of the compiler being used. This is because
531  the compilers do not have flags that can change the architecture,
532  but rather depend on which compiler is being used
533 */
534 #if defined(_WIN32) && defined(_MSC_VER)
535 # if defined(_M_IA64)
536 # define ARCHITECTURE_ID "IA64"
537 
538 # elif defined(_M_ARM64EC)
539 # define ARCHITECTURE_ID "ARM64EC"
540 
541 # elif defined(_M_X64) || defined(_M_AMD64)
542 # define ARCHITECTURE_ID "x64"
543 
544 # elif defined(_M_IX86)
545 # define ARCHITECTURE_ID "X86"
546 
547 # elif defined(_M_ARM64)
548 # define ARCHITECTURE_ID "ARM64"
549 
550 # elif defined(_M_ARM)
551 # if _M_ARM == 4
552 # define ARCHITECTURE_ID "ARMV4I"
553 # elif _M_ARM == 5
554 # define ARCHITECTURE_ID "ARMV5I"
555 # else
556 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
557 # endif
558 
559 # elif defined(_M_MIPS)
560 # define ARCHITECTURE_ID "MIPS"
561 
562 # elif defined(_M_SH)
563 # define ARCHITECTURE_ID "SHx"
564 
565 # else /* unknown architecture */
566 # define ARCHITECTURE_ID ""
567 # endif
568 
569 #elif defined(__WATCOMC__)
570 # if defined(_M_I86)
571 # define ARCHITECTURE_ID "I86"
572 
573 # elif defined(_M_IX86)
574 # define ARCHITECTURE_ID "X86"
575 
576 # else /* unknown architecture */
577 # define ARCHITECTURE_ID ""
578 # endif
579 
580 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
581 # if defined(__ICCARM__)
582 # define ARCHITECTURE_ID "ARM"
583 
584 # elif defined(__ICCRX__)
585 # define ARCHITECTURE_ID "RX"
586 
587 # elif defined(__ICCRH850__)
588 # define ARCHITECTURE_ID "RH850"
589 
590 # elif defined(__ICCRL78__)
591 # define ARCHITECTURE_ID "RL78"
592 
593 # elif defined(__ICCRISCV__)
594 # define ARCHITECTURE_ID "RISCV"
595 
596 # elif defined(__ICCAVR__)
597 # define ARCHITECTURE_ID "AVR"
598 
599 # elif defined(__ICC430__)
600 # define ARCHITECTURE_ID "MSP430"
601 
602 # elif defined(__ICCV850__)
603 # define ARCHITECTURE_ID "V850"
604 
605 # elif defined(__ICC8051__)
606 # define ARCHITECTURE_ID "8051"
607 
608 # elif defined(__ICCSTM8__)
609 # define ARCHITECTURE_ID "STM8"
610 
611 # else /* unknown architecture */
612 # define ARCHITECTURE_ID ""
613 # endif
614 
615 #elif defined(__ghs__)
616 # if defined(__PPC64__)
617 # define ARCHITECTURE_ID "PPC64"
618 
619 # elif defined(__ppc__)
620 # define ARCHITECTURE_ID "PPC"
621 
622 # elif defined(__ARM__)
623 # define ARCHITECTURE_ID "ARM"
624 
625 # elif defined(__x86_64__)
626 # define ARCHITECTURE_ID "x64"
627 
628 # elif defined(__i386__)
629 # define ARCHITECTURE_ID "X86"
630 
631 # else /* unknown architecture */
632 # define ARCHITECTURE_ID ""
633 # endif
634 
635 #elif defined(__TI_COMPILER_VERSION__)
636 # if defined(__TI_ARM__)
637 # define ARCHITECTURE_ID "ARM"
638 
639 # elif defined(__MSP430__)
640 # define ARCHITECTURE_ID "MSP430"
641 
642 # elif defined(__TMS320C28XX__)
643 # define ARCHITECTURE_ID "TMS320C28x"
644 
645 # elif defined(__TMS320C6X__) || defined(_TMS320C6X)
646 # define ARCHITECTURE_ID "TMS320C6x"
647 
648 # else /* unknown architecture */
649 # define ARCHITECTURE_ID ""
650 # endif
651 
652 #else
653 # define ARCHITECTURE_ID
654 #endif
655 
656 /* Convert integer to decimal digit literals. */
657 #define DEC(n) \
658  ('0' + (((n) / 10000000)%10)), \
659  ('0' + (((n) / 1000000)%10)), \
660  ('0' + (((n) / 100000)%10)), \
661  ('0' + (((n) / 10000)%10)), \
662  ('0' + (((n) / 1000)%10)), \
663  ('0' + (((n) / 100)%10)), \
664  ('0' + (((n) / 10)%10)), \
665  ('0' + ((n) % 10))
666 
667 /* Convert integer to hex digit literals. */
668 #define HEX(n) \
669  ('0' + ((n)>>28 & 0xF)), \
670  ('0' + ((n)>>24 & 0xF)), \
671  ('0' + ((n)>>20 & 0xF)), \
672  ('0' + ((n)>>16 & 0xF)), \
673  ('0' + ((n)>>12 & 0xF)), \
674  ('0' + ((n)>>8 & 0xF)), \
675  ('0' + ((n)>>4 & 0xF)), \
676  ('0' + ((n) & 0xF))
677 
678 /* Construct a string literal encoding the version number. */
679 #ifdef COMPILER_VERSION
680 char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
681 
682 /* Construct a string literal encoding the version number components. */
683 #elif defined(COMPILER_VERSION_MAJOR)
684 char const info_version[] = {
685  'I', 'N', 'F', 'O', ':',
686  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
687  COMPILER_VERSION_MAJOR,
688 # ifdef COMPILER_VERSION_MINOR
689  '.', COMPILER_VERSION_MINOR,
690 # ifdef COMPILER_VERSION_PATCH
691  '.', COMPILER_VERSION_PATCH,
692 # ifdef COMPILER_VERSION_TWEAK
693  '.', COMPILER_VERSION_TWEAK,
694 # endif
695 # endif
696 # endif
697  ']','\0'};
698 #endif
699 
700 /* Construct a string literal encoding the internal version number. */
701 #ifdef COMPILER_VERSION_INTERNAL
702 char const info_version_internal[] = {
703  'I', 'N', 'F', 'O', ':',
704  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
705  'i','n','t','e','r','n','a','l','[',
706  COMPILER_VERSION_INTERNAL,']','\0'};
707 #elif defined(COMPILER_VERSION_INTERNAL_STR)
708 char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
709 #endif
710 
711 /* Construct a string literal encoding the version number components. */
712 #ifdef SIMULATE_VERSION_MAJOR
713 char const info_simulate_version[] = {
714  'I', 'N', 'F', 'O', ':',
715  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
716  SIMULATE_VERSION_MAJOR,
717 # ifdef SIMULATE_VERSION_MINOR
718  '.', SIMULATE_VERSION_MINOR,
719 # ifdef SIMULATE_VERSION_PATCH
720  '.', SIMULATE_VERSION_PATCH,
721 # ifdef SIMULATE_VERSION_TWEAK
722  '.', SIMULATE_VERSION_TWEAK,
723 # endif
724 # endif
725 # endif
726  ']','\0'};
727 #endif
728 
729 /* Construct the string literal in pieces to prevent the source from
730  getting matched. Store it in a pointer rather than an array
731  because some compilers will just produce instructions to fill the
732  array rather than assigning a pointer to a static array. */
733 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
734 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
735 
736 
737 
738 #if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
739 # if defined(__INTEL_CXX11_MODE__)
740 # if defined(__cpp_aggregate_nsdmi)
741 # define CXX_STD 201402L
742 # else
743 # define CXX_STD 201103L
744 # endif
745 # else
746 # define CXX_STD 199711L
747 # endif
748 #elif defined(_MSC_VER) && defined(_MSVC_LANG)
749 # define CXX_STD _MSVC_LANG
750 #else
751 # define CXX_STD __cplusplus
752 #endif
753 
754 const char* info_language_dialect_default = "INFO" ":" "dialect_default["
755 #if CXX_STD > 202002L
756  "23"
757 #elif CXX_STD > 201703L
758  "20"
759 #elif CXX_STD >= 201703L
760  "17"
761 #elif CXX_STD >= 201402L
762  "14"
763 #elif CXX_STD >= 201103L
764  "11"
765 #else
766  "98"
767 #endif
768 "]";
769 
770 /*--------------------------------------------------------------------------*/
771 
772 int main(int argc, char* argv[])
773 {
774  int require = 0;
775  require += info_compiler[argc];
776  require += info_platform[argc];
777 #ifdef COMPILER_VERSION_MAJOR
778  require += info_version[argc];
779 #endif
780 #ifdef COMPILER_VERSION_INTERNAL
781  require += info_version_internal[argc];
782 #endif
783 #ifdef SIMULATE_ID
784  require += info_simulate[argc];
785 #endif
786 #ifdef SIMULATE_VERSION_MAJOR
787  require += info_simulate_version[argc];
788 #endif
789 #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
790  require += info_cray[argc];
791 #endif
792  require += info_language_dialect_default[argc];
793  (void)argv;
794  return require;
795 }
int main(int argc, char *argv[])
const char * info_language_dialect_default
char const * info_platform
char const * info_compiler
char const * info_arch
#define COMPILER_ID
#define ARCHITECTURE_ID
#define PLATFORM_ID