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