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