~ubuntu-branches/ubuntu/vivid/gzip/vivid

« back to all changes in this revision

Viewing changes to lib/stdint.in.h

  • Committer: Steve Langasek
  • Date: 2012-06-29 02:07:40 UTC
  • mfrom: (4.1.9 sid)
  • Revision ID: steve.langasek@canonical.com-20120629020740-qqikrblzana08v2y
Merge version 1.5-1.1 from Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- buffer-read-only: t -*- vi: set ro: */
2
 
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
 
/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
 
1
/* Copyright (C) 2001-2002, 2004-2012 Free Software Foundation, Inc.
4
2
   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
5
3
   This file is part of gnulib.
6
4
 
15
13
   GNU General Public License for more details.
16
14
 
17
15
   You should have received a copy of the GNU General Public License
18
 
   along with this program; if not, write to the Free Software Foundation,
19
 
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
16
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
20
17
 
21
18
/*
22
19
 * ISO C 99 <stdint.h> for platforms that lack it.
23
20
 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
24
21
 */
25
22
 
26
 
#ifndef _GL_STDINT_H
 
23
#ifndef _@GUARD_PREFIX@_STDINT_H
 
24
 
 
25
#if __GNUC__ >= 3
 
26
@PRAGMA_SYSTEM_HEADER@
 
27
#endif
 
28
@PRAGMA_COLUMNS@
27
29
 
28
30
/* When including a system file that in turn includes <inttypes.h>,
29
31
   use the system <inttypes.h>, not our substitute.  This avoids
31
33
   <inttypes.h>.  */
32
34
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
33
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__ \
 
42
    && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
 
43
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
 
44
#else
 
45
 
34
46
/* Get those types that are already defined in other system include
35
47
   files, so that we can "#define int8_t signed char" below without
36
48
   worrying about a later system include file containing a "typedef
46
58
      diagnostics.  */
47
59
#  define __STDINT_H__
48
60
# endif
 
61
 
 
62
  /* Some pre-C++11 <stdint.h> implementations need this.  */
 
63
# ifdef __cplusplus
 
64
#  ifndef __STDC_CONSTANT_MACROS
 
65
#   define __STDC_CONSTANT_MACROS 1
 
66
#  endif
 
67
#  ifndef __STDC_LIMIT_MACROS
 
68
#   define __STDC_LIMIT_MACROS 1
 
69
#  endif
 
70
# endif
 
71
 
49
72
  /* Other systems may have an incomplete or buggy <stdint.h>.
50
73
     Include it before <inttypes.h>, since any "#include <stdint.h>"
51
74
     in <inttypes.h> would reinclude us, skipping our contents because
52
 
     _GL_STDINT_H is defined.
 
75
     _@GUARD_PREFIX@_STDINT_H is defined.
53
76
     The include_next requires a split double-inclusion guard.  */
54
 
# if __GNUC__ >= 3
55
 
@PRAGMA_SYSTEM_HEADER@
56
 
# endif
57
77
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
58
78
#endif
59
79
 
60
 
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
61
 
#define _GL_STDINT_H
 
80
#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
 
81
#define _@GUARD_PREFIX@_STDINT_H
62
82
 
63
83
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
64
84
   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
70
90
# include <sys/types.h>
71
91
#endif
72
92
 
73
 
/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
 
93
/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
 
94
   LONG_MIN, LONG_MAX, ULONG_MAX.  */
74
95
#include <limits.h>
75
96
 
76
97
#if @HAVE_INTTYPES_H@
93
114
 
94
115
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
95
116
 
96
 
/* Minimum and maximum values for a integer type under the usual assumption.
 
117
/* Minimum and maximum values for an integer type under the usual assumption.
97
118
   Return an unspecified value if BITS == 0, adding a check to pacify
98
119
   picky compilers.  */
99
120
 
108
129
        warnings in the signed case.  */ \
109
130
     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
110
131
 
 
132
#if !GNULIB_defined_stdint_types
 
133
 
111
134
/* 7.18.1.1. Exact-width integer types */
112
135
 
113
136
/* Here we assume a standard architecture where the hardware integer
134
157
#define int32_t gl_int32_t
135
158
#define uint32_t gl_uint32_t
136
159
 
 
160
/* If the system defines INT64_MAX, assume int64_t works.  That way,
 
161
   if the underlying platform defines int64_t to be a 64-bit long long
 
162
   int, the code below won't mistakenly define it to be a 64-bit long
 
163
   int, which would mess up C++ name mangling.  We must use #ifdef
 
164
   rather than #if, to avoid an error with HP-UX 10.20 cc.  */
 
165
 
 
166
#ifdef INT64_MAX
 
167
# define GL_INT64_T
 
168
#else
137
169
/* Do not undefine int64_t if gnulib is not being used with 64-bit
138
170
   types, since otherwise it breaks platforms like Tandem/NSK.  */
139
 
#if LONG_MAX >> 31 >> 31 == 1
140
 
# undef int64_t
 
171
# if LONG_MAX >> 31 >> 31 == 1
 
172
#  undef int64_t
141
173
typedef long int gl_int64_t;
142
 
# define int64_t gl_int64_t
143
 
# define GL_INT64_T
144
 
#elif defined _MSC_VER
145
 
# undef int64_t
 
174
#  define int64_t gl_int64_t
 
175
#  define GL_INT64_T
 
176
# elif defined _MSC_VER
 
177
#  undef int64_t
146
178
typedef __int64 gl_int64_t;
147
 
# define int64_t gl_int64_t
148
 
# define GL_INT64_T
149
 
#elif @HAVE_LONG_LONG_INT@
150
 
# undef int64_t
 
179
#  define int64_t gl_int64_t
 
180
#  define GL_INT64_T
 
181
# elif @HAVE_LONG_LONG_INT@
 
182
#  undef int64_t
151
183
typedef long long int gl_int64_t;
152
 
# define int64_t gl_int64_t
153
 
# define GL_INT64_T
 
184
#  define int64_t gl_int64_t
 
185
#  define GL_INT64_T
 
186
# endif
154
187
#endif
155
188
 
156
 
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
157
 
# undef uint64_t
 
189
#ifdef UINT64_MAX
 
190
# define GL_UINT64_T
 
191
#else
 
192
# if ULONG_MAX >> 31 >> 31 >> 1 == 1
 
193
#  undef uint64_t
158
194
typedef unsigned long int gl_uint64_t;
159
 
# define uint64_t gl_uint64_t
160
 
# define GL_UINT64_T
161
 
#elif defined _MSC_VER
162
 
# undef uint64_t
 
195
#  define uint64_t gl_uint64_t
 
196
#  define GL_UINT64_T
 
197
# elif defined _MSC_VER
 
198
#  undef uint64_t
163
199
typedef unsigned __int64 gl_uint64_t;
164
 
# define uint64_t gl_uint64_t
165
 
# define GL_UINT64_T
166
 
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
167
 
# undef uint64_t
 
200
#  define uint64_t gl_uint64_t
 
201
#  define GL_UINT64_T
 
202
# elif @HAVE_UNSIGNED_LONG_LONG_INT@
 
203
#  undef uint64_t
168
204
typedef unsigned long long int gl_uint64_t;
169
 
# define uint64_t gl_uint64_t
170
 
# define GL_UINT64_T
 
205
#  define uint64_t gl_uint64_t
 
206
#  define GL_UINT64_T
 
207
# endif
171
208
#endif
172
209
 
173
210
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
210
247
 
211
248
/* Here we assume a standard architecture where the hardware integer
212
249
   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
213
 
   are taken from the same list of types.  Assume that 'long int'
214
 
   is fast enough for all narrower integers.  */
 
250
   are taken from the same list of types.  The following code normally
 
251
   uses types consistent with glibc, as that lessens the chance of
 
252
   incompatibility with older GNU hosts.  */
215
253
 
216
254
#undef int_fast8_t
217
255
#undef uint_fast8_t
221
259
#undef uint_fast32_t
222
260
#undef int_fast64_t
223
261
#undef uint_fast64_t
224
 
typedef long int gl_int_fast8_t;
225
 
typedef unsigned long int gl_uint_fast8_t;
226
 
typedef long int gl_int_fast16_t;
227
 
typedef unsigned long int gl_uint_fast16_t;
 
262
typedef signed char gl_int_fast8_t;
 
263
typedef unsigned char gl_uint_fast8_t;
 
264
 
 
265
#ifdef __sun
 
266
/* Define types compatible with SunOS 5.10, so that code compiled under
 
267
   earlier SunOS versions works with code compiled under SunOS 5.10.  */
 
268
typedef int gl_int_fast32_t;
 
269
typedef unsigned int gl_uint_fast32_t;
 
270
#else
228
271
typedef long int gl_int_fast32_t;
229
272
typedef unsigned long int gl_uint_fast32_t;
 
273
#endif
 
274
typedef gl_int_fast32_t gl_int_fast16_t;
 
275
typedef gl_uint_fast32_t gl_uint_fast16_t;
 
276
 
230
277
#define int_fast8_t gl_int_fast8_t
231
278
#define uint_fast8_t gl_uint_fast8_t
232
279
#define int_fast16_t gl_int_fast16_t
254
301
/* Note: These types are compiler dependent. It may be unwise to use them in
255
302
   public header files. */
256
303
 
257
 
#undef intmax_t
258
 
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 
304
/* If the system defines INTMAX_MAX, assume that intmax_t works, and
 
305
   similarly for UINTMAX_MAX and uintmax_t.  This avoids problems with
 
306
   assuming one type where another is used by the system.  */
 
307
 
 
308
#ifndef INTMAX_MAX
 
309
# undef INTMAX_C
 
310
# undef intmax_t
 
311
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
259
312
typedef long long int gl_intmax_t;
260
 
# define intmax_t gl_intmax_t
261
 
#elif defined GL_INT64_T
262
 
# define intmax_t int64_t
263
 
#else
 
313
#  define intmax_t gl_intmax_t
 
314
# elif defined GL_INT64_T
 
315
#  define intmax_t int64_t
 
316
# else
264
317
typedef long int gl_intmax_t;
265
 
# define intmax_t gl_intmax_t
 
318
#  define intmax_t gl_intmax_t
 
319
# endif
266
320
#endif
267
321
 
268
 
#undef uintmax_t
269
 
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 
322
#ifndef UINTMAX_MAX
 
323
# undef UINTMAX_C
 
324
# undef uintmax_t
 
325
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
270
326
typedef unsigned long long int gl_uintmax_t;
271
 
# define uintmax_t gl_uintmax_t
272
 
#elif defined GL_UINT64_T
273
 
# define uintmax_t uint64_t
274
 
#else
 
327
#  define uintmax_t gl_uintmax_t
 
328
# elif defined GL_UINT64_T
 
329
#  define uintmax_t uint64_t
 
330
# else
275
331
typedef unsigned long int gl_uintmax_t;
276
 
# define uintmax_t gl_uintmax_t
 
332
#  define uintmax_t gl_uintmax_t
 
333
# endif
277
334
#endif
278
335
 
279
336
/* Verify that intmax_t and uintmax_t have the same size.  Too much code
280
337
   breaks if this is not the case.  If this check fails, the reason is likely
281
338
   to be found in the autoconf macros.  */
282
 
typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
 
339
typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 
340
                                ? 1 : -1];
 
341
 
 
342
#define GNULIB_defined_stdint_types 1
 
343
#endif /* !GNULIB_defined_stdint_types */
283
344
 
284
345
/* 7.18.2. Limits of specified-width integer types */
285
346
 
286
 
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
287
 
 
288
347
/* 7.18.2.1. Limits of exact-width integer types */
289
348
 
290
349
/* Here we assume a standard architecture where the hardware integer
311
370
#define INT32_MAX  2147483647
312
371
#define UINT32_MAX  4294967295U
313
372
 
314
 
#undef INT64_MIN
315
 
#undef INT64_MAX
316
 
#ifdef GL_INT64_T
 
373
#if defined GL_INT64_T && ! defined INT64_MAX
317
374
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
318
375
   evaluates the latter incorrectly in preprocessor expressions.  */
319
376
# define INT64_MIN  (- INTMAX_C (1) << 63)
320
377
# define INT64_MAX  INTMAX_C (9223372036854775807)
321
378
#endif
322
379
 
323
 
#undef UINT64_MAX
324
 
#ifdef GL_UINT64_T
 
380
#if defined GL_UINT64_T && ! defined UINT64_MAX
325
381
# define UINT64_MAX  UINTMAX_C (18446744073709551615)
326
382
#endif
327
383
 
373
429
#undef INT_FAST8_MIN
374
430
#undef INT_FAST8_MAX
375
431
#undef UINT_FAST8_MAX
376
 
#define INT_FAST8_MIN  LONG_MIN
377
 
#define INT_FAST8_MAX  LONG_MAX
378
 
#define UINT_FAST8_MAX  ULONG_MAX
 
432
#define INT_FAST8_MIN  SCHAR_MIN
 
433
#define INT_FAST8_MAX  SCHAR_MAX
 
434
#define UINT_FAST8_MAX  UCHAR_MAX
379
435
 
380
436
#undef INT_FAST16_MIN
381
437
#undef INT_FAST16_MAX
382
438
#undef UINT_FAST16_MAX
383
 
#define INT_FAST16_MIN  LONG_MIN
384
 
#define INT_FAST16_MAX  LONG_MAX
385
 
#define UINT_FAST16_MAX  ULONG_MAX
 
439
#define INT_FAST16_MIN  INT_FAST32_MIN
 
440
#define INT_FAST16_MAX  INT_FAST32_MAX
 
441
#define UINT_FAST16_MAX  UINT_FAST32_MAX
386
442
 
387
443
#undef INT_FAST32_MIN
388
444
#undef INT_FAST32_MAX
389
445
#undef UINT_FAST32_MAX
390
 
#define INT_FAST32_MIN  LONG_MIN
391
 
#define INT_FAST32_MAX  LONG_MAX
392
 
#define UINT_FAST32_MAX  ULONG_MAX
 
446
#ifdef __sun
 
447
# define INT_FAST32_MIN  INT_MIN
 
448
# define INT_FAST32_MAX  INT_MAX
 
449
# define UINT_FAST32_MAX  UINT_MAX
 
450
#else
 
451
# define INT_FAST32_MIN  LONG_MIN
 
452
# define INT_FAST32_MAX  LONG_MAX
 
453
# define UINT_FAST32_MAX  ULONG_MAX
 
454
#endif
393
455
 
394
456
#undef INT_FAST64_MIN
395
457
#undef INT_FAST64_MAX
414
476
 
415
477
/* 7.18.2.5. Limits of greatest-width integer types */
416
478
 
417
 
#undef INTMAX_MIN
418
 
#undef INTMAX_MAX
419
 
#ifdef INT64_MAX
420
 
# define INTMAX_MIN  INT64_MIN
421
 
# define INTMAX_MAX  INT64_MAX
422
 
#else
423
 
# define INTMAX_MIN  INT32_MIN
424
 
# define INTMAX_MAX  INT32_MAX
 
479
#ifndef INTMAX_MAX
 
480
# undef INTMAX_MIN
 
481
# ifdef INT64_MAX
 
482
#  define INTMAX_MIN  INT64_MIN
 
483
#  define INTMAX_MAX  INT64_MAX
 
484
# else
 
485
#  define INTMAX_MIN  INT32_MIN
 
486
#  define INTMAX_MAX  INT32_MAX
 
487
# endif
425
488
#endif
426
489
 
427
 
#undef UINTMAX_MAX
428
 
#ifdef UINT64_MAX
429
 
# define UINTMAX_MAX  UINT64_MAX
430
 
#else
431
 
# define UINTMAX_MAX  UINT32_MAX
 
490
#ifndef UINTMAX_MAX
 
491
# ifdef UINT64_MAX
 
492
#  define UINTMAX_MAX  UINT64_MAX
 
493
# else
 
494
#  define UINTMAX_MAX  UINT32_MAX
 
495
# endif
432
496
#endif
433
497
 
434
498
/* 7.18.3. Limits of other integer types */
476
540
 
477
541
/* wchar_t limits */
478
542
/* Get WCHAR_MIN, WCHAR_MAX.
479
 
   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
480
 
   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
 
543
   This include is not on the top, above, because on OSF/1 4.0 we have a
 
544
   sequence of nested includes
 
545
   <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
481
546
   <stdint.h> and assumes its types are already defined.  */
482
 
#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
 
547
#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
 
548
  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 
549
     included before <wchar.h>.  */
 
550
# include <stddef.h>
 
551
# include <stdio.h>
 
552
# include <time.h>
483
553
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
484
554
# include <wchar.h>
485
555
# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
499
569
#define WINT_MAX  \
500
570
   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
501
571
 
502
 
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
503
 
 
504
572
/* 7.18.4. Macros for integer constants */
505
573
 
506
 
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
507
 
 
508
574
/* 7.18.4.1. Macros for minimum-width integer constants */
509
575
/* According to ISO C 99 Technical Corrigendum 1 */
510
576
 
545
611
 
546
612
/* 7.18.4.2. Macros for greatest-width integer constants */
547
613
 
548
 
#undef INTMAX_C
549
 
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
550
 
# define INTMAX_C(x)   x##LL
551
 
#elif defined GL_INT64_T
552
 
# define INTMAX_C(x)   INT64_C(x)
553
 
#else
554
 
# define INTMAX_C(x)   x##L
555
 
#endif
556
 
 
557
 
#undef UINTMAX_C
558
 
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
559
 
# define UINTMAX_C(x)  x##ULL
560
 
#elif defined GL_UINT64_T
561
 
# define UINTMAX_C(x)  UINT64_C(x)
562
 
#else
563
 
# define UINTMAX_C(x)  x##UL
564
 
#endif
565
 
 
566
 
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
567
 
 
568
 
#endif /* _GL_STDINT_H */
569
 
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
 
614
#ifndef INTMAX_C
 
615
# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 
616
#  define INTMAX_C(x)   x##LL
 
617
# elif defined GL_INT64_T
 
618
#  define INTMAX_C(x)   INT64_C(x)
 
619
# else
 
620
#  define INTMAX_C(x)   x##L
 
621
# endif
 
622
#endif
 
623
 
 
624
#ifndef UINTMAX_C
 
625
# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 
626
#  define UINTMAX_C(x)  x##ULL
 
627
# elif defined GL_UINT64_T
 
628
#  define UINTMAX_C(x)  UINT64_C(x)
 
629
# else
 
630
#  define UINTMAX_C(x)  x##UL
 
631
# endif
 
632
#endif
 
633
 
 
634
#endif /* _@GUARD_PREFIX@_STDINT_H */
 
635
#endif /* !(defined __ANDROID__ && ...) */
 
636
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */