1/* -*- buffer-read-only: t -*- vi: set ro: */
2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3#line 1
4/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
5   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
6   This file is part of gnulib.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 3, or (at your option)
11   any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software Foundation,
20   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
21
22/*
23 * ISO C 99 <stdint.h> for platforms that lack it.
24 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
25 */
26
27#ifndef _GL_STDINT_H
28
29/* When including a system file that in turn includes <inttypes.h>,
30   use the system <inttypes.h>, not our substitute.  This avoids
31   problems with (for example) VMS, whose <sys/bitypes.h> includes
32   <inttypes.h>.  */
33#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
34
35/* Get those types that are already defined in other system include
36   files, so that we can "#define int8_t signed char" below without
37   worrying about a later system include file containing a "typedef
38   signed char int8_t;" that will get messed up by our macro.  Our
39   macros should all be consistent with the system versions, except
40   for the "fast" types and macros, which we recommend against using
41   in public interfaces due to compiler differences.  */
42
43#if @HAVE_STDINT_H@
44# if defined __sgi && ! defined __c99
45   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
46      with "This header file is to be used only for c99 mode compilations"
47      diagnostics.  */
48#  define __STDINT_H__
49# endif
50  /* Other systems may have an incomplete or buggy <stdint.h>.
51     Include it before <inttypes.h>, since any "#include <stdint.h>"
52     in <inttypes.h> would reinclude us, skipping our contents because
53     _GL_STDINT_H is defined.
54     The include_next requires a split double-inclusion guard.  */
55# if __GNUC__ >= 3
56@PRAGMA_SYSTEM_HEADER@
57# endif
58# @INCLUDE_NEXT@ @NEXT_STDINT_H@
59#endif
60
61#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
62#define _GL_STDINT_H
63
64/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
65   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
66   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
67   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
68   relies on the system <stdint.h> definitions, so include
69   <sys/types.h> after @NEXT_STDINT_H@.  */
70#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
71# include <sys/types.h>
72#endif
73
74/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
75#include <limits.h>
76
77#if @HAVE_INTTYPES_H@
78  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
79     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
80     <inttypes.h> also defines intptr_t and uintptr_t.  */
81# include <inttypes.h>
82#elif @HAVE_SYS_INTTYPES_H@
83  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
84     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
85# include <sys/inttypes.h>
86#endif
87
88#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
89  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
90     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
91     included by <sys/types.h>.  */
92# include <sys/bitypes.h>
93#endif
94
95#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
96
97/* Minimum and maximum values for a integer type under the usual assumption.
98   Return an unspecified value if BITS == 0, adding a check to pacify
99   picky compilers.  */
100
101#define _STDINT_MIN(signed, bits, zero) \
102  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
103
104#define _STDINT_MAX(signed, bits, zero) \
105  ((signed) \
106   ? ~ _STDINT_MIN (signed, bits, zero) \
107   : /* The expression for the unsigned case.  The subtraction of (signed) \
108        is a nop in the unsigned case and avoids "signed integer overflow" \
109        warnings in the signed case.  */ \
110     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
111
112/* 7.18.1.1. Exact-width integer types */
113
114/* Here we assume a standard architecture where the hardware integer
115   types have 8, 16, 32, optionally 64 bits.  */
116
117#undef int8_t
118#undef uint8_t
119typedef signed char gl_int8_t;
120typedef unsigned char gl_uint8_t;
121#define int8_t gl_int8_t
122#define uint8_t gl_uint8_t
123
124#undef int16_t
125#undef uint16_t
126typedef short int gl_int16_t;
127typedef unsigned short int gl_uint16_t;
128#define int16_t gl_int16_t
129#define uint16_t gl_uint16_t
130
131#undef int32_t
132#undef uint32_t
133typedef int gl_int32_t;
134typedef unsigned int gl_uint32_t;
135#define int32_t gl_int32_t
136#define uint32_t gl_uint32_t
137
138/* Do not undefine int64_t if gnulib is not being used with 64-bit
139   types, since otherwise it breaks platforms like Tandem/NSK.  */
140#if LONG_MAX >> 31 >> 31 == 1
141# undef int64_t
142typedef long int gl_int64_t;
143# define int64_t gl_int64_t
144# define GL_INT64_T
145#elif defined _MSC_VER
146# undef int64_t
147typedef __int64 gl_int64_t;
148# define int64_t gl_int64_t
149# define GL_INT64_T
150#elif @HAVE_LONG_LONG_INT@
151# undef int64_t
152typedef long long int gl_int64_t;
153# define int64_t gl_int64_t
154# define GL_INT64_T
155#endif
156
157#if ULONG_MAX >> 31 >> 31 >> 1 == 1
158# undef uint64_t
159typedef unsigned long int gl_uint64_t;
160# define uint64_t gl_uint64_t
161# define GL_UINT64_T
162#elif defined _MSC_VER
163# undef uint64_t
164typedef unsigned __int64 gl_uint64_t;
165# define uint64_t gl_uint64_t
166# define GL_UINT64_T
167#elif @HAVE_UNSIGNED_LONG_LONG_INT@
168# undef uint64_t
169typedef unsigned long long int gl_uint64_t;
170# define uint64_t gl_uint64_t
171# define GL_UINT64_T
172#endif
173
174/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
175#define _UINT8_T
176#define _UINT32_T
177#define _UINT64_T
178
179
180/* 7.18.1.2. Minimum-width integer types */
181
182/* Here we assume a standard architecture where the hardware integer
183   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
184   are the same as the corresponding N_t types.  */
185
186#undef int_least8_t
187#undef uint_least8_t
188#undef int_least16_t
189#undef uint_least16_t
190#undef int_least32_t
191#undef uint_least32_t
192#undef int_least64_t
193#undef uint_least64_t
194#define int_least8_t int8_t
195#define uint_least8_t uint8_t
196#define int_least16_t int16_t
197#define uint_least16_t uint16_t
198#define int_least32_t int32_t
199#define uint_least32_t uint32_t
200#ifdef GL_INT64_T
201# define int_least64_t int64_t
202#endif
203#ifdef GL_UINT64_T
204# define uint_least64_t uint64_t
205#endif
206
207/* 7.18.1.3. Fastest minimum-width integer types */
208
209/* Note: Other <stdint.h> substitutes may define these types differently.
210   It is not recommended to use these types in public header files. */
211
212/* Here we assume a standard architecture where the hardware integer
213   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
214   are taken from the same list of types.  Assume that 'long int'
215   is fast enough for all narrower integers.  */
216
217#undef int_fast8_t
218#undef uint_fast8_t
219#undef int_fast16_t
220#undef uint_fast16_t
221#undef int_fast32_t
222#undef uint_fast32_t
223#undef int_fast64_t
224#undef uint_fast64_t
225typedef long int gl_int_fast8_t;
226typedef unsigned long int gl_uint_fast8_t;
227typedef long int gl_int_fast16_t;
228typedef unsigned long int gl_uint_fast16_t;
229typedef long int gl_int_fast32_t;
230typedef unsigned long int gl_uint_fast32_t;
231#define int_fast8_t gl_int_fast8_t
232#define uint_fast8_t gl_uint_fast8_t
233#define int_fast16_t gl_int_fast16_t
234#define uint_fast16_t gl_uint_fast16_t
235#define int_fast32_t gl_int_fast32_t
236#define uint_fast32_t gl_uint_fast32_t
237#ifdef GL_INT64_T
238# define int_fast64_t int64_t
239#endif
240#ifdef GL_UINT64_T
241# define uint_fast64_t uint64_t
242#endif
243
244/* 7.18.1.4. Integer types capable of holding object pointers */
245
246#undef intptr_t
247#undef uintptr_t
248typedef long int gl_intptr_t;
249typedef unsigned long int gl_uintptr_t;
250#define intptr_t gl_intptr_t
251#define uintptr_t gl_uintptr_t
252
253/* 7.18.1.5. Greatest-width integer types */
254
255/* Note: These types are compiler dependent. It may be unwise to use them in
256   public header files. */
257
258#undef intmax_t
259#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
260typedef long long int gl_intmax_t;
261# define intmax_t gl_intmax_t
262#elif defined GL_INT64_T
263# define intmax_t int64_t
264#else
265typedef long int gl_intmax_t;
266# define intmax_t gl_intmax_t
267#endif
268
269#undef uintmax_t
270#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
271typedef unsigned long long int gl_uintmax_t;
272# define uintmax_t gl_uintmax_t
273#elif defined GL_UINT64_T
274# define uintmax_t uint64_t
275#else
276typedef unsigned long int gl_uintmax_t;
277# define uintmax_t gl_uintmax_t
278#endif
279
280/* Verify that intmax_t and uintmax_t have the same size.  Too much code
281   breaks if this is not the case.  If this check fails, the reason is likely
282   to be found in the autoconf macros.  */
283typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
284
285/* 7.18.2. Limits of specified-width integer types */
286
287#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
288
289/* 7.18.2.1. Limits of exact-width integer types */
290
291/* Here we assume a standard architecture where the hardware integer
292   types have 8, 16, 32, optionally 64 bits.  */
293
294#undef INT8_MIN
295#undef INT8_MAX
296#undef UINT8_MAX
297#define INT8_MIN  (~ INT8_MAX)
298#define INT8_MAX  127
299#define UINT8_MAX  255
300
301#undef INT16_MIN
302#undef INT16_MAX
303#undef UINT16_MAX
304#define INT16_MIN  (~ INT16_MAX)
305#define INT16_MAX  32767
306#define UINT16_MAX  65535
307
308#undef INT32_MIN
309#undef INT32_MAX
310#undef UINT32_MAX
311#define INT32_MIN  (~ INT32_MAX)
312#define INT32_MAX  2147483647
313#define UINT32_MAX  4294967295U
314
315#undef INT64_MIN
316#undef INT64_MAX
317#ifdef GL_INT64_T
318/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
319   evaluates the latter incorrectly in preprocessor expressions.  */
320# define INT64_MIN  (- INTMAX_C (1) << 63)
321# define INT64_MAX  INTMAX_C (9223372036854775807)
322#endif
323
324#undef UINT64_MAX
325#ifdef GL_UINT64_T
326# define UINT64_MAX  UINTMAX_C (18446744073709551615)
327#endif
328
329/* 7.18.2.2. Limits of minimum-width integer types */
330
331/* Here we assume a standard architecture where the hardware integer
332   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
333   are the same as the corresponding N_t types.  */
334
335#undef INT_LEAST8_MIN
336#undef INT_LEAST8_MAX
337#undef UINT_LEAST8_MAX
338#define INT_LEAST8_MIN  INT8_MIN
339#define INT_LEAST8_MAX  INT8_MAX
340#define UINT_LEAST8_MAX  UINT8_MAX
341
342#undef INT_LEAST16_MIN
343#undef INT_LEAST16_MAX
344#undef UINT_LEAST16_MAX
345#define INT_LEAST16_MIN  INT16_MIN
346#define INT_LEAST16_MAX  INT16_MAX
347#define UINT_LEAST16_MAX  UINT16_MAX
348
349#undef INT_LEAST32_MIN
350#undef INT_LEAST32_MAX
351#undef UINT_LEAST32_MAX
352#define INT_LEAST32_MIN  INT32_MIN
353#define INT_LEAST32_MAX  INT32_MAX
354#define UINT_LEAST32_MAX  UINT32_MAX
355
356#undef INT_LEAST64_MIN
357#undef INT_LEAST64_MAX
358#ifdef GL_INT64_T
359# define INT_LEAST64_MIN  INT64_MIN
360# define INT_LEAST64_MAX  INT64_MAX
361#endif
362
363#undef UINT_LEAST64_MAX
364#ifdef GL_UINT64_T
365# define UINT_LEAST64_MAX  UINT64_MAX
366#endif
367
368/* 7.18.2.3. Limits of fastest minimum-width integer types */
369
370/* Here we assume a standard architecture where the hardware integer
371   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
372   are taken from the same list of types.  */
373
374#undef INT_FAST8_MIN
375#undef INT_FAST8_MAX
376#undef UINT_FAST8_MAX
377#define INT_FAST8_MIN  LONG_MIN
378#define INT_FAST8_MAX  LONG_MAX
379#define UINT_FAST8_MAX  ULONG_MAX
380
381#undef INT_FAST16_MIN
382#undef INT_FAST16_MAX
383#undef UINT_FAST16_MAX
384#define INT_FAST16_MIN  LONG_MIN
385#define INT_FAST16_MAX  LONG_MAX
386#define UINT_FAST16_MAX  ULONG_MAX
387
388#undef INT_FAST32_MIN
389#undef INT_FAST32_MAX
390#undef UINT_FAST32_MAX
391#define INT_FAST32_MIN  LONG_MIN
392#define INT_FAST32_MAX  LONG_MAX
393#define UINT_FAST32_MAX  ULONG_MAX
394
395#undef INT_FAST64_MIN
396#undef INT_FAST64_MAX
397#ifdef GL_INT64_T
398# define INT_FAST64_MIN  INT64_MIN
399# define INT_FAST64_MAX  INT64_MAX
400#endif
401
402#undef UINT_FAST64_MAX
403#ifdef GL_UINT64_T
404# define UINT_FAST64_MAX  UINT64_MAX
405#endif
406
407/* 7.18.2.4. Limits of integer types capable of holding object pointers */
408
409#undef INTPTR_MIN
410#undef INTPTR_MAX
411#undef UINTPTR_MAX
412#define INTPTR_MIN  LONG_MIN
413#define INTPTR_MAX  LONG_MAX
414#define UINTPTR_MAX  ULONG_MAX
415
416/* 7.18.2.5. Limits of greatest-width integer types */
417
418#undef INTMAX_MIN
419#undef INTMAX_MAX
420#ifdef INT64_MAX
421# define INTMAX_MIN  INT64_MIN
422# define INTMAX_MAX  INT64_MAX
423#else
424# define INTMAX_MIN  INT32_MIN
425# define INTMAX_MAX  INT32_MAX
426#endif
427
428#undef UINTMAX_MAX
429#ifdef UINT64_MAX
430# define UINTMAX_MAX  UINT64_MAX
431#else
432# define UINTMAX_MAX  UINT32_MAX
433#endif
434
435/* 7.18.3. Limits of other integer types */
436
437/* ptrdiff_t limits */
438#undef PTRDIFF_MIN
439#undef PTRDIFF_MAX
440#if @APPLE_UNIVERSAL_BUILD@
441# ifdef _LP64
442#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
443#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
444# else
445#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
446#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
447# endif
448#else
449# define PTRDIFF_MIN  \
450    _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
451# define PTRDIFF_MAX  \
452    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
453#endif
454
455/* sig_atomic_t limits */
456#undef SIG_ATOMIC_MIN
457#undef SIG_ATOMIC_MAX
458#define SIG_ATOMIC_MIN  \
459   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
460                0@SIG_ATOMIC_T_SUFFIX@)
461#define SIG_ATOMIC_MAX  \
462   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
463                0@SIG_ATOMIC_T_SUFFIX@)
464
465
466/* size_t limit */
467#undef SIZE_MAX
468#if @APPLE_UNIVERSAL_BUILD@
469# ifdef _LP64
470#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
471# else
472#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
473# endif
474#else
475# define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
476#endif
477
478/* wchar_t limits */
479/* Get WCHAR_MIN, WCHAR_MAX.
480   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
481   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
482   <stdint.h> and assumes its types are already defined.  */
483#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
484# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
485# include <wchar.h>
486# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
487#endif
488#undef WCHAR_MIN
489#undef WCHAR_MAX
490#define WCHAR_MIN  \
491   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
492#define WCHAR_MAX  \
493   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
494
495/* wint_t limits */
496#undef WINT_MIN
497#undef WINT_MAX
498#define WINT_MIN  \
499   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
500#define WINT_MAX  \
501   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
502
503#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
504
505/* 7.18.4. Macros for integer constants */
506
507#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
508
509/* 7.18.4.1. Macros for minimum-width integer constants */
510/* According to ISO C 99 Technical Corrigendum 1 */
511
512/* Here we assume a standard architecture where the hardware integer
513   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
514
515#undef INT8_C
516#undef UINT8_C
517#define INT8_C(x) x
518#define UINT8_C(x) x
519
520#undef INT16_C
521#undef UINT16_C
522#define INT16_C(x) x
523#define UINT16_C(x) x
524
525#undef INT32_C
526#undef UINT32_C
527#define INT32_C(x) x
528#define UINT32_C(x) x ## U
529
530#undef INT64_C
531#undef UINT64_C
532#if LONG_MAX >> 31 >> 31 == 1
533# define INT64_C(x) x##L
534#elif defined _MSC_VER
535# define INT64_C(x) x##i64
536#elif @HAVE_LONG_LONG_INT@
537# define INT64_C(x) x##LL
538#endif
539#if ULONG_MAX >> 31 >> 31 >> 1 == 1
540# define UINT64_C(x) x##UL
541#elif defined _MSC_VER
542# define UINT64_C(x) x##ui64
543#elif @HAVE_UNSIGNED_LONG_LONG_INT@
544# define UINT64_C(x) x##ULL
545#endif
546
547/* 7.18.4.2. Macros for greatest-width integer constants */
548
549#undef INTMAX_C
550#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
551# define INTMAX_C(x)   x##LL
552#elif defined GL_INT64_T
553# define INTMAX_C(x)   INT64_C(x)
554#else
555# define INTMAX_C(x)   x##L
556#endif
557
558#undef UINTMAX_C
559#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
560# define UINTMAX_C(x)  x##ULL
561#elif defined GL_UINT64_T
562# define UINTMAX_C(x)  UINT64_C(x)
563#else
564# define UINTMAX_C(x)  x##UL
565#endif
566
567#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
568
569#endif /* _GL_STDINT_H */
570#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
571