Line |
Branch |
Exec |
Source |
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__) || defined(__ICCV850__) || defined(__ICC8051__)) |
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 |
|
|
# elif defined(__ICCV850__) |
496 |
|
|
# define ARCHITECTURE_ID "V850" |
497 |
|
|
|
498 |
|
|
# elif defined(__ICC8051__) |
499 |
|
|
# define ARCHITECTURE_ID "8051" |
500 |
|
|
|
501 |
|
|
# else /* unknown architecture */ |
502 |
|
|
# define ARCHITECTURE_ID "" |
503 |
|
|
# endif |
504 |
|
|
|
505 |
|
|
#elif defined(__ghs__) |
506 |
|
|
# if defined(__PPC64__) |
507 |
|
|
# define ARCHITECTURE_ID "PPC64" |
508 |
|
|
|
509 |
|
|
# elif defined(__ppc__) |
510 |
|
|
# define ARCHITECTURE_ID "PPC" |
511 |
|
|
|
512 |
|
|
# elif defined(__ARM__) |
513 |
|
|
# define ARCHITECTURE_ID "ARM" |
514 |
|
|
|
515 |
|
|
# elif defined(__x86_64__) |
516 |
|
|
# define ARCHITECTURE_ID "x64" |
517 |
|
|
|
518 |
|
|
# elif defined(__i386__) |
519 |
|
|
# define ARCHITECTURE_ID "X86" |
520 |
|
|
|
521 |
|
|
# else /* unknown architecture */ |
522 |
|
|
# define ARCHITECTURE_ID "" |
523 |
|
|
# endif |
524 |
|
|
#else |
525 |
|
|
# define ARCHITECTURE_ID |
526 |
|
|
#endif |
527 |
|
|
|
528 |
|
|
/* Convert integer to decimal digit literals. */ |
529 |
|
|
#define DEC(n) \ |
530 |
|
|
('0' + (((n) / 10000000)%10)), \ |
531 |
|
|
('0' + (((n) / 1000000)%10)), \ |
532 |
|
|
('0' + (((n) / 100000)%10)), \ |
533 |
|
|
('0' + (((n) / 10000)%10)), \ |
534 |
|
|
('0' + (((n) / 1000)%10)), \ |
535 |
|
|
('0' + (((n) / 100)%10)), \ |
536 |
|
|
('0' + (((n) / 10)%10)), \ |
537 |
|
|
('0' + ((n) % 10)) |
538 |
|
|
|
539 |
|
|
/* Convert integer to hex digit literals. */ |
540 |
|
|
#define HEX(n) \ |
541 |
|
|
('0' + ((n)>>28 & 0xF)), \ |
542 |
|
|
('0' + ((n)>>24 & 0xF)), \ |
543 |
|
|
('0' + ((n)>>20 & 0xF)), \ |
544 |
|
|
('0' + ((n)>>16 & 0xF)), \ |
545 |
|
|
('0' + ((n)>>12 & 0xF)), \ |
546 |
|
|
('0' + ((n)>>8 & 0xF)), \ |
547 |
|
|
('0' + ((n)>>4 & 0xF)), \ |
548 |
|
|
('0' + ((n) & 0xF)) |
549 |
|
|
|
550 |
|
|
/* Construct a string literal encoding the version number components. */ |
551 |
|
|
#ifdef COMPILER_VERSION_MAJOR |
552 |
|
|
char const info_version[] = { |
553 |
|
|
'I', 'N', 'F', 'O', ':', |
554 |
|
|
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', |
555 |
|
|
COMPILER_VERSION_MAJOR, |
556 |
|
|
# ifdef COMPILER_VERSION_MINOR |
557 |
|
|
'.', COMPILER_VERSION_MINOR, |
558 |
|
|
# ifdef COMPILER_VERSION_PATCH |
559 |
|
|
'.', COMPILER_VERSION_PATCH, |
560 |
|
|
# ifdef COMPILER_VERSION_TWEAK |
561 |
|
|
'.', COMPILER_VERSION_TWEAK, |
562 |
|
|
# endif |
563 |
|
|
# endif |
564 |
|
|
# endif |
565 |
|
|
']','\0'}; |
566 |
|
|
#endif |
567 |
|
|
|
568 |
|
|
/* Construct a string literal encoding the internal version number. */ |
569 |
|
|
#ifdef COMPILER_VERSION_INTERNAL |
570 |
|
|
char const info_version_internal[] = { |
571 |
|
|
'I', 'N', 'F', 'O', ':', |
572 |
|
|
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', |
573 |
|
|
'i','n','t','e','r','n','a','l','[', |
574 |
|
|
COMPILER_VERSION_INTERNAL,']','\0'}; |
575 |
|
|
#endif |
576 |
|
|
|
577 |
|
|
/* Construct a string literal encoding the version number components. */ |
578 |
|
|
#ifdef SIMULATE_VERSION_MAJOR |
579 |
|
|
char const info_simulate_version[] = { |
580 |
|
|
'I', 'N', 'F', 'O', ':', |
581 |
|
|
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', |
582 |
|
|
SIMULATE_VERSION_MAJOR, |
583 |
|
|
# ifdef SIMULATE_VERSION_MINOR |
584 |
|
|
'.', SIMULATE_VERSION_MINOR, |
585 |
|
|
# ifdef SIMULATE_VERSION_PATCH |
586 |
|
|
'.', SIMULATE_VERSION_PATCH, |
587 |
|
|
# ifdef SIMULATE_VERSION_TWEAK |
588 |
|
|
'.', SIMULATE_VERSION_TWEAK, |
589 |
|
|
# endif |
590 |
|
|
# endif |
591 |
|
|
# endif |
592 |
|
|
']','\0'}; |
593 |
|
|
#endif |
594 |
|
|
|
595 |
|
|
/* Construct the string literal in pieces to prevent the source from |
596 |
|
|
getting matched. Store it in a pointer rather than an array |
597 |
|
|
because some compilers will just produce instructions to fill the |
598 |
|
|
array rather than assigning a pointer to a static array. */ |
599 |
|
|
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; |
600 |
|
|
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; |
601 |
|
|
|
602 |
|
|
|
603 |
|
|
|
604 |
|
|
|
605 |
|
|
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L |
606 |
|
|
# if defined(__INTEL_CXX11_MODE__) |
607 |
|
|
# if defined(__cpp_aggregate_nsdmi) |
608 |
|
|
# define CXX_STD 201402L |
609 |
|
|
# else |
610 |
|
|
# define CXX_STD 201103L |
611 |
|
|
# endif |
612 |
|
|
# else |
613 |
|
|
# define CXX_STD 199711L |
614 |
|
|
# endif |
615 |
|
|
#elif defined(_MSC_VER) && defined(_MSVC_LANG) |
616 |
|
|
# define CXX_STD _MSVC_LANG |
617 |
|
|
#else |
618 |
|
|
# define CXX_STD __cplusplus |
619 |
|
|
#endif |
620 |
|
|
|
621 |
|
|
const char* info_language_dialect_default = "INFO" ":" "dialect_default[" |
622 |
|
|
#if CXX_STD > 201703L |
623 |
|
|
"20" |
624 |
|
|
#elif CXX_STD >= 201703L |
625 |
|
|
"17" |
626 |
|
|
#elif CXX_STD >= 201402L |
627 |
|
|
"14" |
628 |
|
|
#elif CXX_STD >= 201103L |
629 |
|
|
"11" |
630 |
|
|
#else |
631 |
|
|
"98" |
632 |
|
|
#endif |
633 |
|
|
"]"; |
634 |
|
|
|
635 |
|
|
/*--------------------------------------------------------------------------*/ |
636 |
|
|
|
637 |
|
✗ |
int main(int argc, char* argv[]) |
638 |
|
|
{ |
639 |
|
✗ |
int require = 0; |
640 |
|
✗ |
require += info_compiler[argc]; |
641 |
|
✗ |
require += info_platform[argc]; |
642 |
|
|
#ifdef COMPILER_VERSION_MAJOR |
643 |
|
✗ |
require += info_version[argc]; |
644 |
|
|
#endif |
645 |
|
|
#ifdef COMPILER_VERSION_INTERNAL |
646 |
|
|
require += info_version_internal[argc]; |
647 |
|
|
#endif |
648 |
|
|
#ifdef SIMULATE_ID |
649 |
|
|
require += info_simulate[argc]; |
650 |
|
|
#endif |
651 |
|
|
#ifdef SIMULATE_VERSION_MAJOR |
652 |
|
|
require += info_simulate_version[argc]; |
653 |
|
|
#endif |
654 |
|
|
#if defined(__CRAYXE) || defined(__CRAYXC) |
655 |
|
|
require += info_cray[argc]; |
656 |
|
|
#endif |
657 |
|
✗ |
require += info_language_dialect_default[argc]; |
658 |
|
|
(void)argv; |
659 |
|
✗ |
return require; |
660 |
|
|
} |
661 |
|
|
|