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