Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Utilities / KWIML / ABI.h.in
1 /*============================================================================
2   Kitware Information Macro Library
3   Copyright 2010-2011 Kitware, Inc.
4   All rights reserved.
5
6   Redistribution and use in source and binary forms, with or without
7   modification, are permitted provided that the following conditions
8   are met:
9
10   * Redistributions of source code must retain the above copyright
11     notice, this list of conditions and the following disclaimer.
12
13   * Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17   * Neither the name of Kitware, Inc. nor the names of its contributors
18     may be used to endorse or promote products derived from this
19     software without specific prior written permission.
20
21   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ============================================================================*/
33 #ifndef @KWIML@_ABI_H
34 #define @KWIML@_ABI_H
35 /*
36 This header defines macros with information about the C ABI.
37 Only information that can be determined using the preprocessor at
38 compilation time is available.  No try-compile results may be added
39 here.  Instead we memorize results on platforms of interest.
40
41 An includer may optionally define the following macros to suppress errors:
42
43   @KWIML@_ABI_NO_VERIFY          = skip verification declarations
44   @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown
45   @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown
46   @KWIML@_ABI_NO_ERROR_ENDIAN    = byte order of CPU may be unknown
47
48 An includer may test the following macros after inclusion:
49
50   @KWIML@_ABI_SIZEOF_DATA_PTR   = sizeof(void*)
51   @KWIML@_ABI_SIZEOF_CODE_PTR   = sizeof(void(*)(void))
52   @KWIML@_ABI_SIZEOF_FLOAT      = sizeof(float)
53   @KWIML@_ABI_SIZEOF_DOUBLE     = sizeof(double)
54   @KWIML@_ABI_SIZEOF_CHAR       = sizeof(char)
55   @KWIML@_ABI_SIZEOF_SHORT      = sizeof(short)
56   @KWIML@_ABI_SIZEOF_INT        = sizeof(int)
57   @KWIML@_ABI_SIZEOF_LONG       = sizeof(long)
58
59   @KWIML@_ABI_SIZEOF_LONG_LONG  = sizeof(long long) or 0 if not a type
60     Undefined if existence is unknown and error suppression macro
61     @KWIML@_ABI_NO_ERROR_LONG_LONG was defined.
62
63   @KWIML@_ABI_SIZEOF___INT64    = 8 if '__int64' exists or 0 if not
64     Undefined if existence is unknown.
65
66   @KWIML@_ABI___INT64_IS_LONG   = 1 if '__int64' is 'long' (same type)
67     Undefined otherwise.
68   @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type)
69     Undefined otherwise.
70   @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type
71     Undefined otherwise.
72
73   @KWIML@_ABI_CHAR_IS_UNSIGNED  = 1 if 'char' is unsigned, else undefined
74   @KWIML@_ABI_CHAR_IS_SIGNED    = 1 if 'char' is signed, else undefined
75     One of these is defined unless signedness of 'char' is unknown and
76     error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined.
77
78   @KWIML@_ABI_ENDIAN_ID_BIG    = id for big-endian (always defined)
79   @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined)
80   @KWIML@_ABI_ENDIAN_ID        = id of byte order of target CPU
81     Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE
82     unless byte order is unknown and error suppression macro
83     @KWIML@_ABI_NO_ERROR_ENDIAN was defined.
84
85 We verify most results using dummy "extern" declarations that are
86 invalid if the macros are wrong.  Verification is disabled if
87 suppression macro @KWIML@_ABI_NO_VERIFY was defined.
88 */
89
90 /*--------------------------------------------------------------------------*/
91 #if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
92 # if defined(__SIZEOF_POINTER__)
93 #  define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__
94 # elif defined(_SIZE_PTR)
95 #  define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3)
96 # elif defined(_LP64) || defined(__LP64__)
97 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
98 # elif defined(_ILP32)
99 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 4
100 # elif defined(__64BIT__) /* IBM XL */
101 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
102 # elif defined(_M_X64)
103 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
104 # elif defined(__ia64)
105 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
106 # elif defined(__sparcv9)
107 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
108 # elif defined(__x86_64) || defined(__x86_64__)
109 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
110 # elif defined(__amd64) || defined(__amd64__)
111 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
112 # elif defined(__i386) || defined(__i386__)
113 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 4
114 # endif
115 #endif
116 #if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
117 # define @KWIML@_ABI_SIZEOF_DATA_PTR 4
118 #endif
119 #if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR)
120 # define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR
121 #endif
122
123 /*--------------------------------------------------------------------------*/
124 #if !defined(@KWIML@_ABI_SIZEOF_CHAR)
125 # define @KWIML@_ABI_SIZEOF_CHAR 1
126 #endif
127
128 #if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED)
129 # if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others?  */
130 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
131 # elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others?  */
132 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
133 # elif defined(_CHAR_SIGNED) /* IBM XL, others? */
134 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
135 # elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */
136 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
137 # elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */
138 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
139 # elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */
140 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
141 # elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */
142 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
143 # elif defined(__GNUC__) /* GNU default */
144 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
145 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */
146 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
147 # elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */
148 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
149 # elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */
150 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
151 # elif defined(__PGIC__) /* PGI default */
152 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
153 # elif defined(_MSC_VER) /* MSVC default */
154 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
155 # elif defined(__WATCOMC__) /* Watcom default */
156 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
157 # elif defined(__BORLANDC__) /* Borland default */
158 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
159 # elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */
160 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */
161 # endif
162 #endif
163 #if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \
164  && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN)
165 # error "Signedness of 'char' unknown."
166 #endif
167
168 /*--------------------------------------------------------------------------*/
169 #if !defined(@KWIML@_ABI_SIZEOF_SHORT)
170 # if defined(__SIZEOF_SHORT__)
171 #  define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__
172 # endif
173 #endif
174 #if !defined(@KWIML@_ABI_SIZEOF_SHORT)
175 # define @KWIML@_ABI_SIZEOF_SHORT 2
176 #endif
177
178 /*--------------------------------------------------------------------------*/
179 #if !defined(@KWIML@_ABI_SIZEOF_INT)
180 # if defined(__SIZEOF_INT__)
181 #  define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__
182 # elif defined(_SIZE_INT)
183 #  define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3)
184 # endif
185 #endif
186 #if !defined(@KWIML@_ABI_SIZEOF_INT)
187 # define @KWIML@_ABI_SIZEOF_INT 4
188 #endif
189
190 /*--------------------------------------------------------------------------*/
191 #if !defined(@KWIML@_ABI_SIZEOF_LONG)
192 # if defined(__SIZEOF_LONG__)
193 #  define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__
194 # elif defined(_SIZE_LONG)
195 #  define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3)
196 # elif defined(__LONG_MAX__)
197 #  if __LONG_MAX__ == 0x7fffffff
198 #   define @KWIML@_ABI_SIZEOF_LONG 4
199 #  elif __LONG_MAX__>>32 == 0x7fffffff
200 #   define @KWIML@_ABI_SIZEOF_LONG 8
201 #  endif
202 # elif defined(_MSC_VER) /* MSVC and Intel on Windows */
203 #  define @KWIML@_ABI_SIZEOF_LONG 4
204 # endif
205 #endif
206 #if !defined(@KWIML@_ABI_SIZEOF_LONG)
207 # define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR
208 #endif
209
210 /*--------------------------------------------------------------------------*/
211 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
212 # if defined(__SIZEOF_LONG_LONG__)
213 #  define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
214 # elif defined(__LONG_LONG_MAX__)
215 #  if __LONG_LONG_MAX__ == 0x7fffffff
216 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 4
217 #  elif __LONG_LONG_MAX__>>32 == 0x7fffffff
218 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
219 #  endif
220 # endif
221 #endif
222 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
223 # if defined(_LONGLONG) /* SGI, some GNU, perhaps others.  */ \
224   && !defined(_MSC_VER)
225 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
226 # elif defined(_LONG_LONG) /* IBM XL, perhaps others.  */
227 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
228 # elif defined(__NO_LONG_LONG) /* EDG */
229 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 0
230 # elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */
231 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
232 # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
233 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
234 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */
235 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
236 # elif defined(__HP_cc) || defined(__HP_aCC) /* HP */
237 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
238 # elif defined(__PGIC__) /* PGI */
239 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
240 # elif defined(__WATCOMC__) /* Watcom */
241 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
242 # elif defined(__INTEL_COMPILER) /* Intel */
243 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
244 # elif defined(__BORLANDC__) /* Borland */
245 #  if __BORLANDC__ >= 0x0560
246 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
247 #  else
248 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 0
249 #  endif
250 # elif defined(_MSC_VER) /* Microsoft */
251 #  if _MSC_VER >= 1310
252 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
253 #  else
254 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 0
255 #  endif
256 # elif defined(__GNUC__) /* GNU */
257 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
258 # elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */
259 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
260 # endif
261 #endif
262 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG)
263 # error "Existence of 'long long' unknown."
264 #endif
265
266 /*--------------------------------------------------------------------------*/
267 #if !defined(@KWIML@_ABI_SIZEOF___INT64)
268 # if defined(__INTEL_COMPILER)
269 #  define @KWIML@_ABI_SIZEOF___INT64 8
270 # elif defined(_MSC_VER)
271 #  define @KWIML@_ABI_SIZEOF___INT64 8
272 # elif defined(__BORLANDC__)
273 #  define @KWIML@_ABI_SIZEOF___INT64 8
274 # else
275 #  define @KWIML@_ABI_SIZEOF___INT64 0
276 # endif
277 #endif
278
279 #if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
280 # if @KWIML@_ABI_SIZEOF_LONG == 8
281 #  define @KWIML@_ABI___INT64_IS_LONG 1
282 # elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
283 #  define @KWIML@_ABI___INT64_IS_LONG_LONG 1
284 # else
285 #  define @KWIML@_ABI___INT64_IS_UNIQUE 1
286 # endif
287 #endif
288
289 /*--------------------------------------------------------------------------*/
290 #if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
291 # if defined(__SIZEOF_FLOAT__)
292 #  define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__
293 # endif
294 #endif
295 #if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
296 # define @KWIML@_ABI_SIZEOF_FLOAT 4
297 #endif
298
299 /*--------------------------------------------------------------------------*/
300 #if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
301 # if defined(__SIZEOF_DOUBLE__)
302 #  define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__
303 # endif
304 #endif
305 #if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
306 # define @KWIML@_ABI_SIZEOF_DOUBLE 8
307 #endif
308
309 /*--------------------------------------------------------------------------*/
310 /* Identify possible endian cases.  The macro @KWIML@_ABI_ENDIAN_ID will be
311    defined to one of these, or undefined if unknown.  */
312 #if !defined(@KWIML@_ABI_ENDIAN_ID_BIG)
313 # define @KWIML@_ABI_ENDIAN_ID_BIG    4321
314 #endif
315 #if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE)
316 # define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234
317 #endif
318 #if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE
319 # error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE"
320 #endif
321
322 #if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined.  */
323
324 /* Use dedicated symbols if the compiler defines them.  Do this first
325    because some architectures allow runtime byte order selection by
326    the operating system (values for such architectures below are
327    guesses for compilers that do not define a dedicated symbol).
328    Ensure that only one is defined in case the platform or a header
329    defines both as possible values for some third symbol.  */
330 #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
331 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
332 #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
333 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
334 #elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
335 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
336 #elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
337 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
338
339 /* Alpha */
340 #elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
341 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
342
343 /* Arm */
344 #elif defined(__arm__)
345 # if !defined(__ARMEB__)
346 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
347 # else
348 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
349 # endif
350
351 /* Intel x86 */
352 #elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
353 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
354 #elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
355 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
356 #elif defined(__MWERKS__) && defined(__INTEL__)
357 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
358
359 /* Intel x86-64 */
360 #elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
361 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
362 #elif defined(__amd64) || defined(__amd64__)
363 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
364
365 /* Intel Architecture-64 (Itanium) */
366 #elif defined(__ia64) || defined(__ia64__)
367 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
368 #elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
369 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
370
371 /* PowerPC */
372 #elif defined(__powerpc) || defined(__powerpc__)
373 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
374 #elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
375 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
376
377 /* SPARC */
378 #elif defined(__sparc) || defined(__sparc__)
379 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
380
381 /* HP/PA RISC */
382 #elif defined(__hppa) || defined(__hppa__)
383 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
384
385 /* Motorola 68k */
386 #elif defined(__m68k__) || defined(M68000)
387 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
388
389 /* MIPSel (MIPS little endian) */
390 #elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
391 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
392
393 /* MIPSeb (MIPS big endian) */
394 #elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)
395 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
396
397 /* MIPS (fallback, big endian) */
398 #elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
399 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
400
401 /* RS/6000 */
402 #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
403 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
404 #elif defined(_ARCH_PWR) || defined(_ARCH_PWR2)
405 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
406
407 /* System/370 */
408 #elif defined(__370__) || defined(__THW_370__)
409 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
410
411 /* System/390 */
412 #elif defined(__s390__) || defined(__s390x__)
413 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
414
415 /* z/Architecture */
416 #elif defined(__SYSC_ZARCH__)
417 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
418
419 /* VAX */
420 #elif defined(__vax__)
421 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
422
423 /* Aarch64 */
424 #elif defined(__aarch64__)
425 # if !defined(__AARCH64EB__)
426 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
427 # else
428 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
429 # endif
430
431 /* Unknown CPU */
432 #elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN)
433 # error "Byte order of target CPU unknown."
434 #endif
435
436 /*--------------------------------------------------------------------------*/
437 #if !defined(@KWIML@_ABI_NO_VERIFY)
438 #define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y]
439 #define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*)
440 #if defined(__cplusplus)
441 # define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*)
442 #else
443 # define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */
444 #endif
445 #define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3)
446 #define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t))
447 #define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y)
448 #define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y)
449
450 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*);
451 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int));
452 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char);
453 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short);
454 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int);
455 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long);
456 #if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
457 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long);
458 #endif
459 #if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
460 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64);
461 #endif
462 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float);
463 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double);
464
465 #if defined(@KWIML@_ABI___INT64_IS_LONG)
466 @KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long);
467 #elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG)
468 @KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long);
469 #elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
470 @KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long);
471 # if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
472 @KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long);
473 # endif
474 #endif
475
476 #if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED)
477 @KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0);
478 #elif defined(@KWIML@_ABI_CHAR_IS_SIGNED)
479 @KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED,   (char)0x80 < 0);
480 #endif
481
482 #undef @KWIML@_ABI__VERIFY_DIFF
483 #undef @KWIML@_ABI__VERIFY_SAME
484 #undef @KWIML@_ABI__VERIFY_SIZE
485 #undef @KWIML@_ABI__VERIFY_BOOL
486 #undef @KWIML@_ABI__VERIFY3
487 #undef @KWIML@_ABI__VERIFY2
488 #undef @KWIML@_ABI__VERIFY
489
490 #endif
491
492 #endif