Debian Codegraph @

lib/stdint.in.h

raw
1 /* Copyright (C) 2001-2002, 2004-2026 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 /*
19 * ISO C 99 <stdint.h> for platforms that lack it.
20 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html>
21 */
22
23 #ifndef _@GUARD_PREFIX@_STDINT_H
24
25 #if __GNUC__ >= 3
26 @PRAGMA_SYSTEM_HEADER@
27 #endif
28 @PRAGMA_COLUMNS@
29
30 /* When including a system file that in turn includes <inttypes.h>,
31 use the system <inttypes.h>, not our substitute. This avoids
32 problems with (for example) VMS, whose <sys/bitypes.h> includes
33 <inttypes.h>. */
34 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
35
36 /* On Android (Bionic libc), <sys/types.h> includes this file before
37 having defined 'time_t'. Therefore in this case avoid including
38 other system header files; just include the system's <stdint.h>.
39 Ideally we should test __BIONIC__ here, but it is only defined after
40 <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
41 #if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
42 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
43 #else
44
45 /* Get those types that are already defined in other system include
46 files, so that we can "#define int8_t signed char" below without
47 worrying about a later system include file containing a "typedef
48 signed char int8_t;" that will get messed up by our macro. Our
49 macros should all be consistent with the system versions, except
50 for the "fast" types and macros, which we recommend against using
51 in public interfaces due to compiler differences. */
52
53 #if @HAVE_STDINT_H@
54 /* Some pre-C++11 <stdint.h> implementations need this. */
55 # ifdef __cplusplus
56 # ifndef __STDC_CONSTANT_MACROS
57 # define __STDC_CONSTANT_MACROS 1
58 # endif
59 # ifndef __STDC_LIMIT_MACROS
60 # define __STDC_LIMIT_MACROS 1
61 # endif
62 # endif
63
64 /* Other systems may have an incomplete or buggy <stdint.h>.
65 Include it before <inttypes.h>, since any "#include <stdint.h>"
66 in <inttypes.h> would reinclude us, skipping our contents because
67 _@GUARD_PREFIX@_STDINT_H is defined.
68 The include_next requires a split double-inclusion guard. */
69 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
70 #endif
71
72 #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
73 #define _@GUARD_PREFIX@_STDINT_H
74
75 /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
76 LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */
77 #include <limits.h>
78
79 /* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
80 wint_t. */
81 #if @GNULIBHEADERS_OVERRIDE_WINT_T@
82 # undef WINT_MIN
83 # undef WINT_MAX
84 # define WINT_MIN 0x0U
85 # define WINT_MAX 0xffffffffU
86 #endif
87
88 #if ! @HAVE_C99_STDINT_H@
89
90 /* <sys/types.h> defines some of the stdint.h types as well, on glibc and
91 OpenBSD 3.8 (via <machine/types.h>).
92 AIX 5.2 <sys/types.h> isn't needed and causes troubles.
93 Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
94 relies on the system <stdint.h> definitions, so include
95 <sys/types.h> after @NEXT_STDINT_H@. */
96 # if @HAVE_SYS_TYPES_H@ && ! defined _AIX
97 # include <sys/types.h>
98 # endif
99
100 # if @HAVE_INTTYPES_H@
101 /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
102 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
103 <inttypes.h> also defines intptr_t and uintptr_t. */
104 # include <inttypes.h>
105 # elif @HAVE_SYS_INTTYPES_H@
106 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
107 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
108 # include <sys/inttypes.h>
109 # endif
110
111 # if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
112 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
113 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
114 included by <sys/types.h>. */
115 # include <sys/bitypes.h>
116 # endif
117
118 # undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
119
120 /* Minimum and maximum values for an integer type under the usual assumption.
121 Return an unspecified value if BITS == 0, adding a check to pacify
122 picky compilers. */
123
124 /* These are separate macros, because if you try to merge these macros into
125 a single one, HP-UX cc rejects the resulting expression in constant
126 expressions. */
127 # define _STDINT_UNSIGNED_MIN(bits, zero) \
128 (zero)
129 # define _STDINT_SIGNED_MIN(bits, zero) \
130 (~ _STDINT_MAX (1, bits, zero))
131
132 # define _STDINT_MAX(signed, bits, zero) \
133 (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
134
135 #if !GNULIB_defined_stdint_types
136
137 /* 7.18.1.1. Exact-width integer types */
138
139 /* Here we assume a standard architecture where the hardware integer
140 types have 8, 16, 32, optionally 64 bits. */
141
142 # undef int8_t
143 # undef uint8_t
144 typedef signed char gl_int8_t;
145 typedef unsigned char gl_uint8_t;
146 # define int8_t gl_int8_t
147 # define uint8_t gl_uint8_t
148
149 # undef int16_t
150 # undef uint16_t
151 typedef short int gl_int16_t;
152 typedef unsigned short int gl_uint16_t;
153 # define int16_t gl_int16_t
154 # define uint16_t gl_uint16_t
155
156 # undef int32_t
157 # undef uint32_t
158 typedef int gl_int32_t;
159 typedef unsigned int gl_uint32_t;
160 # define int32_t gl_int32_t
161 # define uint32_t gl_uint32_t
162
163 /* If the system defines INT64_MAX, assume int64_t works. That way,
164 if the underlying platform defines int64_t to be a 64-bit long long
165 int, the code below won't mistakenly define it to be a 64-bit long
166 int, which would mess up C++ name mangling. We must use #ifdef
167 rather than #if, to avoid an error with HP-UX 10.20 cc. */
168
169 # ifdef INT64_MAX
170 # define GL_INT64_T
171 # else
172 /* Do not undefine int64_t if gnulib is not being used with 64-bit
173 types, since otherwise it breaks platforms like Tandem/NSK. */
174 # if LONG_MAX >> 31 >> 31 == 1
175 # undef int64_t
176 typedef long int gl_int64_t;
177 # define int64_t gl_int64_t
178 # define GL_INT64_T
179 # elif defined _MSC_VER
180 # undef int64_t
181 typedef __int64 gl_int64_t;
182 # define int64_t gl_int64_t
183 # define GL_INT64_T
184 # else
185 /* Verify that 'long long' has exactly 64 bits. */
186 typedef _gl_verify_int64_bits[
187 _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1
188 ? 1 : -1];
189 # undef int64_t
190 typedef long long int gl_int64_t;
191 # define int64_t gl_int64_t
192 # define GL_INT64_T
193 # endif
194 # endif
195
196 # ifdef UINT64_MAX
197 # define GL_UINT64_T
198 # else
199 # if ULONG_MAX >> 31 >> 31 >> 1 == 1
200 # undef uint64_t
201 typedef unsigned long int gl_uint64_t;
202 # define uint64_t gl_uint64_t
203 # define GL_UINT64_T
204 # elif defined _MSC_VER
205 # undef uint64_t
206 typedef unsigned __int64 gl_uint64_t;
207 # define uint64_t gl_uint64_t
208 # define GL_UINT64_T
209 # else
210 /* Verify that 'unsigned long long' has exactly 64 bits. */
211 typedef _gl_verify_uint64_bits[
212 _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull)
213 >> 31 >> 31 >> 1 == 1
214 ? 1 : -1];
215 # undef uint64_t
216 typedef unsigned long long int gl_uint64_t;
217 # define uint64_t gl_uint64_t
218 # define GL_UINT64_T
219 # endif
220 # endif
221
222 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
223 # define _UINT8_T
224 # define _UINT32_T
225 # define _UINT64_T
226
227
228 /* 7.18.1.2. Minimum-width integer types */
229
230 /* Here we assume a standard architecture where the hardware integer
231 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
232 are the same as the corresponding N_t types. */
233
234 # undef int_least8_t
235 # undef uint_least8_t
236 # undef int_least16_t
237 # undef uint_least16_t
238 # undef int_least32_t
239 # undef uint_least32_t
240 # undef int_least64_t
241 # undef uint_least64_t
242 # define int_least8_t int8_t
243 # define uint_least8_t uint8_t
244 # define int_least16_t int16_t
245 # define uint_least16_t uint16_t
246 # define int_least32_t int32_t
247 # define uint_least32_t uint32_t
248 # ifdef GL_INT64_T
249 # define int_least64_t int64_t
250 # endif
251 # ifdef GL_UINT64_T
252 # define uint_least64_t uint64_t
253 # endif
254
255 /* 7.18.1.3. Fastest minimum-width integer types */
256
257 /* Note: Other <stdint.h> substitutes may define these types differently.
258 It is not recommended to use these types in public header files. */
259
260 /* Here we assume a standard architecture where the hardware integer
261 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
262 are taken from the same list of types. The following code normally
263 uses types consistent with glibc, as that lessens the chance of
264 incompatibility with older GNU hosts. */
265
266 # undef int_fast8_t
267 # undef uint_fast8_t
268 # undef int_fast16_t
269 # undef uint_fast16_t
270 # undef int_fast32_t
271 # undef uint_fast32_t
272 # undef int_fast64_t
273 # undef uint_fast64_t
274 typedef signed char gl_int_fast8_t;
275 typedef unsigned char gl_uint_fast8_t;
276
277 # ifdef __sun
278 /* Define types compatible with SunOS 5.10, so that code compiled under
279 earlier SunOS versions works with code compiled under SunOS 5.10. */
280 typedef int gl_int_fast32_t;
281 typedef unsigned int gl_uint_fast32_t;
282 # else
283 typedef long int gl_int_fast32_t;
284 typedef unsigned long int gl_uint_fast32_t;
285 # endif
286 typedef gl_int_fast32_t gl_int_fast16_t;
287 typedef gl_uint_fast32_t gl_uint_fast16_t;
288
289 # define int_fast8_t gl_int_fast8_t
290 # define uint_fast8_t gl_uint_fast8_t
291 # define int_fast16_t gl_int_fast16_t
292 # define uint_fast16_t gl_uint_fast16_t
293 # define int_fast32_t gl_int_fast32_t
294 # define uint_fast32_t gl_uint_fast32_t
295 # ifdef GL_INT64_T
296 # define int_fast64_t int64_t
297 # endif
298 # ifdef GL_UINT64_T
299 # define uint_fast64_t uint64_t
300 # endif
301
302 /* 7.18.1.4. Integer types capable of holding object pointers */
303
304 /* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own
305 definitions of intptr_t and uintptr_t (which use int and unsigned)
306 to avoid clashes with declarations of system functions like sbrk.
307 Similarly, MinGW WSL-5.4.1 <stdint.h> needs its own intptr_t and
308 uintptr_t to avoid conflicting declarations of system functions like
309 _findclose in <io.h>. */
310 # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
311 || (defined __INTPTR_WIDTH__ \
312 && __INTPTR_WIDTH__ != (defined _WIN64 ? LLONG_WIDTH : LONG_WIDTH)) \
313 || defined __MINGW32__)
314 # undef intptr_t
315 # undef uintptr_t
316 # ifdef _WIN64
317 typedef long long int gl_intptr_t;
318 typedef unsigned long long int gl_uintptr_t;
319 # else
320 typedef long int gl_intptr_t;
321 typedef unsigned long int gl_uintptr_t;
322 # endif
323 # define intptr_t gl_intptr_t
324 # define uintptr_t gl_uintptr_t
325 # endif
326
327 /* 7.18.1.5. Greatest-width integer types */
328
329 /* Note: These types are compiler dependent. It may be unwise to use them in
330 public header files. */
331
332 /* If the system defines INTMAX_MAX, assume that intmax_t works, and
333 similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
334 assuming one type where another is used by the system. */
335
336 # ifndef INTMAX_MAX
337 # undef INTMAX_C
338 # undef intmax_t
339 # if LONG_MAX >> 30 == 1
340 typedef long long int gl_intmax_t;
341 # define intmax_t gl_intmax_t
342 # elif defined GL_INT64_T
343 # define intmax_t int64_t
344 # else
345 typedef long int gl_intmax_t;
346 # define intmax_t gl_intmax_t
347 # endif
348 # endif
349
350 # ifndef UINTMAX_MAX
351 # undef UINTMAX_C
352 # undef uintmax_t
353 # if ULONG_MAX >> 31 == 1
354 typedef unsigned long long int gl_uintmax_t;
355 # define uintmax_t gl_uintmax_t
356 # elif defined GL_UINT64_T
357 # define uintmax_t uint64_t
358 # else
359 typedef unsigned long int gl_uintmax_t;
360 # define uintmax_t gl_uintmax_t
361 # endif
362 # endif
363
364 /* Verify that intmax_t and uintmax_t have the same size. Too much code
365 breaks if this is not the case. If this check fails, the reason is likely
366 to be found in the autoconf macros. */
367 typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
368 ? 1 : -1];
369
370 # define GNULIB_defined_stdint_types 1
371 # endif /* !GNULIB_defined_stdint_types */
372
373 /* 7.18.2. Limits of specified-width integer types */
374
375 /* 7.18.2.1. Limits of exact-width integer types */
376
377 /* Here we assume a standard architecture where the hardware integer
378 types have 8, 16, 32, optionally 64 bits. */
379
380 # undef INT8_MIN
381 # undef INT8_MAX
382 # undef UINT8_MAX
383 # define INT8_MIN (~ INT8_MAX)
384 # define INT8_MAX 127
385 # define UINT8_MAX 255
386
387 # undef INT16_MIN
388 # undef INT16_MAX
389 # undef UINT16_MAX
390 # define INT16_MIN (~ INT16_MAX)
391 # define INT16_MAX 32767
392 # define UINT16_MAX 65535
393
394 # undef INT32_MIN
395 # undef INT32_MAX
396 # undef UINT32_MAX
397 # define INT32_MIN (~ INT32_MAX)
398 # define INT32_MAX 2147483647
399 # define UINT32_MAX 4294967295U
400
401 # if defined GL_INT64_T && ! defined INT64_MAX
402 /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
403 evaluates the latter incorrectly in preprocessor expressions. */
404 # define INT64_MIN (- INTMAX_C (1) << 63)
405 # define INT64_MAX INTMAX_C (9223372036854775807)
406 # endif
407
408 # if defined GL_UINT64_T && ! defined UINT64_MAX
409 # define UINT64_MAX UINTMAX_C (18446744073709551615)
410 # endif
411
412 /* 7.18.2.2. Limits of minimum-width integer types */
413
414 /* Here we assume a standard architecture where the hardware integer
415 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
416 are the same as the corresponding N_t types. */
417
418 # undef INT_LEAST8_MIN
419 # undef INT_LEAST8_MAX
420 # undef UINT_LEAST8_MAX
421 # define INT_LEAST8_MIN INT8_MIN
422 # define INT_LEAST8_MAX INT8_MAX
423 # define UINT_LEAST8_MAX UINT8_MAX
424
425 # undef INT_LEAST16_MIN
426 # undef INT_LEAST16_MAX
427 # undef UINT_LEAST16_MAX
428 # define INT_LEAST16_MIN INT16_MIN
429 # define INT_LEAST16_MAX INT16_MAX
430 # define UINT_LEAST16_MAX UINT16_MAX
431
432 # undef INT_LEAST32_MIN
433 # undef INT_LEAST32_MAX
434 # undef UINT_LEAST32_MAX
435 # define INT_LEAST32_MIN INT32_MIN
436 # define INT_LEAST32_MAX INT32_MAX
437 # define UINT_LEAST32_MAX UINT32_MAX
438
439 # undef INT_LEAST64_MIN
440 # undef INT_LEAST64_MAX
441 # ifdef GL_INT64_T
442 # define INT_LEAST64_MIN INT64_MIN
443 # define INT_LEAST64_MAX INT64_MAX
444 # endif
445
446 # undef UINT_LEAST64_MAX
447 # ifdef GL_UINT64_T
448 # define UINT_LEAST64_MAX UINT64_MAX
449 # endif
450
451 /* 7.18.2.3. Limits of fastest minimum-width integer types */
452
453 /* Here we assume a standard architecture where the hardware integer
454 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
455 are taken from the same list of types. */
456
457 # undef INT_FAST8_MIN
458 # undef INT_FAST8_MAX
459 # undef UINT_FAST8_MAX
460 # define INT_FAST8_MIN SCHAR_MIN
461 # define INT_FAST8_MAX SCHAR_MAX
462 # define UINT_FAST8_MAX UCHAR_MAX
463
464 # undef INT_FAST16_MIN
465 # undef INT_FAST16_MAX
466 # undef UINT_FAST16_MAX
467 # define INT_FAST16_MIN INT_FAST32_MIN
468 # define INT_FAST16_MAX INT_FAST32_MAX
469 # define UINT_FAST16_MAX UINT_FAST32_MAX
470
471 # undef INT_FAST32_MIN
472 # undef INT_FAST32_MAX
473 # undef UINT_FAST32_MAX
474 # ifdef __sun
475 # define INT_FAST32_MIN INT_MIN
476 # define INT_FAST32_MAX INT_MAX
477 # define UINT_FAST32_MAX UINT_MAX
478 # else
479 # define INT_FAST32_MIN LONG_MIN
480 # define INT_FAST32_MAX LONG_MAX
481 # define UINT_FAST32_MAX ULONG_MAX
482 # endif
483
484 # undef INT_FAST64_MIN
485 # undef INT_FAST64_MAX
486 # ifdef GL_INT64_T
487 # define INT_FAST64_MIN INT64_MIN
488 # define INT_FAST64_MAX INT64_MAX
489 # endif
490
491 # undef UINT_FAST64_MAX
492 # ifdef GL_UINT64_T
493 # define UINT_FAST64_MAX UINT64_MAX
494 # endif
495
496 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
497
498 # undef INTPTR_MIN
499 # undef INTPTR_MAX
500 # undef UINTPTR_MAX
501 # ifdef _WIN64
502 # define INTPTR_MIN LLONG_MIN
503 # define INTPTR_MAX LLONG_MAX
504 # define UINTPTR_MAX ULLONG_MAX
505 # else
506 # define INTPTR_MIN LONG_MIN
507 # define INTPTR_MAX LONG_MAX
508 # define UINTPTR_MAX ULONG_MAX
509 # endif
510
511 /* 7.18.2.5. Limits of greatest-width integer types */
512
513 # ifndef INTMAX_MAX
514 # undef INTMAX_MIN
515 # ifdef INT64_MAX
516 # define INTMAX_MIN INT64_MIN
517 # define INTMAX_MAX INT64_MAX
518 # else
519 # define INTMAX_MIN INT32_MIN
520 # define INTMAX_MAX INT32_MAX
521 # endif
522 # endif
523
524 # ifndef UINTMAX_MAX
525 # ifdef UINT64_MAX
526 # define UINTMAX_MAX UINT64_MAX
527 # else
528 # define UINTMAX_MAX UINT32_MAX
529 # endif
530 # endif
531
532 /* 7.18.3. Limits of other integer types */
533
534 /* ptrdiff_t limits */
535 # undef PTRDIFF_MIN
536 # undef PTRDIFF_MAX
537 # if @APPLE_UNIVERSAL_BUILD@
538 # ifdef _LP64
539 # define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l)
540 # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
541 # else
542 # define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0)
543 # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
544 # endif
545 # else
546 # define PTRDIFF_MIN \
547 _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
548 # define PTRDIFF_MAX \
549 _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
550 # endif
551
552 /* sig_atomic_t limits */
553 # undef SIG_ATOMIC_MIN
554 # undef SIG_ATOMIC_MAX
555 # if @HAVE_SIGNED_SIG_ATOMIC_T@
556 # define SIG_ATOMIC_MIN \
557 _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
558 # else
559 # define SIG_ATOMIC_MIN \
560 _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
561 # endif
562 # define SIG_ATOMIC_MAX \
563 _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
564 0@SIG_ATOMIC_T_SUFFIX@)
565
566
567 /* size_t limit */
568 # undef SIZE_MAX
569 # if @APPLE_UNIVERSAL_BUILD@
570 # ifdef _LP64
571 # define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
572 # else
573 # define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
574 # endif
575 # else
576 # define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
577 # endif
578
579 /* wchar_t limits */
580 /* Get WCHAR_MIN, WCHAR_MAX. */
581 # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
582 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
583 # include <wchar.h>
584 # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
585 # endif
586 # undef WCHAR_MIN
587 # undef WCHAR_MAX
588 # if @HAVE_SIGNED_WCHAR_T@
589 # define WCHAR_MIN \
590 _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
591 # else
592 # define WCHAR_MIN \
593 _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
594 # endif
595 # define WCHAR_MAX \
596 _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
597
598 /* wint_t limits */
599 /* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not
600 accurate, therefore use the definitions from above. */
601 # if !@GNULIBHEADERS_OVERRIDE_WINT_T@
602 # undef WINT_MIN
603 # undef WINT_MAX
604 # if @HAVE_SIGNED_WINT_T@
605 # define WINT_MIN \
606 _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
607 # else
608 # define WINT_MIN \
609 _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
610 # endif
611 # define WINT_MAX \
612 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
613 # endif
614
615 /* 7.18.4. Macros for integer constants */
616
617 /* 7.18.4.1. Macros for minimum-width integer constants */
618 /* According to ISO C 99 Technical Corrigendum 1 */
619
620 /* Here we assume a standard architecture where the hardware integer
621 types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
622
623 # undef INT8_C
624 # undef UINT8_C
625 # define INT8_C(x) x
626 # define UINT8_C(x) x
627
628 # undef INT16_C
629 # undef UINT16_C
630 # define INT16_C(x) x
631 # define UINT16_C(x) x
632
633 # undef INT32_C
634 # undef UINT32_C
635 # define INT32_C(x) x
636 # define UINT32_C(x) x ## U
637
638 # undef INT64_C
639 # undef UINT64_C
640 # if LONG_MAX >> 31 >> 31 == 1
641 # define INT64_C(x) x##L
642 # elif defined _MSC_VER
643 # define INT64_C(x) x##i64
644 # else
645 # define INT64_C(x) x##LL
646 # endif
647 # if ULONG_MAX >> 31 >> 31 >> 1 == 1
648 # define UINT64_C(x) x##UL
649 # elif defined _MSC_VER
650 # define UINT64_C(x) x##ui64
651 # else
652 # define UINT64_C(x) x##ULL
653 # endif
654
655 /* 7.18.4.2. Macros for greatest-width integer constants */
656
657 # ifndef INTMAX_C
658 # if LONG_MAX >> 30 == 1
659 # define INTMAX_C(x) x##LL
660 # elif defined GL_INT64_T
661 # define INTMAX_C(x) INT64_C(x)
662 # else
663 # define INTMAX_C(x) x##L
664 # endif
665 # endif
666
667 # ifndef UINTMAX_C
668 # if ULONG_MAX >> 31 == 1
669 # define UINTMAX_C(x) x##ULL
670 # elif defined GL_UINT64_T
671 # define UINTMAX_C(x) UINT64_C(x)
672 # else
673 # define UINTMAX_C(x) x##UL
674 # endif
675 # endif
676
677 #endif /* !@HAVE_C99_STDINT_H@ */
678
679 /* Macros specified by ISO/IEC TS 18661-1:2014. */
680
681 #if (!defined UINTMAX_WIDTH \
682 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
683 # ifdef INT8_MAX
684 # define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
685 # endif
686 # ifdef UINT8_MAX
687 # define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
688 # endif
689 # ifdef INT16_MAX
690 # define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
691 # endif
692 # ifdef UINT16_MAX
693 # define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
694 # endif
695 # ifdef INT32_MAX
696 # define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
697 # endif
698 # ifdef UINT32_MAX
699 # define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
700 # endif
701 # ifdef INT64_MAX
702 # define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
703 # endif
704 # ifdef UINT64_MAX
705 # define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
706 # endif
707 # define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
708 # define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
709 # define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
710 # define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
711 # define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
712 # define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
713 # define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
714 # define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
715 # define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
716 # define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
717 # define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
718 # define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
719 # define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
720 # define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
721 # define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
722 # define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
723 # define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
724 # define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
725 # define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
726 # define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
727 # define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
728 # define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
729 # define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
730 # ifdef WINT_MAX
731 # define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
732 # endif
733 # ifdef SIG_ATOMIC_MAX
734 # define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
735 # endif
736 #endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
737
738 #endif /* _@GUARD_PREFIX@_STDINT_H */
739 #endif /* !(defined __ANDROID__ && ...) */
740 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */