1 /* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib.
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, or (at your option)
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.
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/>. */
19 * Subset of ISO C 99 <stdint.h> for platforms that lack it.
20 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
23 #ifndef _UNISTRING_STDINT_H
25 /* When including a system file that in turn includes <inttypes.h>,
26 use the system <inttypes.h>, not our substitute. This avoids
27 problems with (for example) VMS, whose <sys/bitypes.h> includes
29 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
31 /* Get those types that are already defined in other system include
32 files, so that we can "#define int8_t signed char" below without
33 worrying about a later system include file containing a "typedef
34 signed char int8_t;" that will get messed up by our macro. Our
35 macros should all be consistent with the system versions, except
36 for the "fast" types and macros, which we recommend against using
37 in public interfaces due to compiler differences. */
40 # if defined __sgi && ! defined __c99
41 /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
42 with "This header file is to be used only for c99 mode compilations"
46 /* Other systems may have an incomplete or buggy <stdint.h>.
47 Include it before <inttypes.h>, since any "#include <stdint.h>"
48 in <inttypes.h> would reinclude us, skipping our contents because
49 _UNISTRING_STDINT_H is defined.
50 The include_next requires a split double-inclusion guard. */
52 @PRAGMA_SYSTEM_HEADER@
54 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
57 #if ! defined _UNISTRING_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
58 #define _UNISTRING_STDINT_H
60 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
61 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
62 AIX 5.2 <sys/types.h> isn't needed and causes troubles.
63 MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
64 relies on the system <stdint.h> definitions, so include
65 <sys/types.h> after @NEXT_STDINT_H@. */
66 #if @HAVE_SYS_TYPES_H@ && ! defined _AIX
67 # include <sys/types.h>
70 /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
74 /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
75 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
76 <inttypes.h> also defines intptr_t and uintptr_t. */
77 # include <inttypes.h>
78 #elif @HAVE_SYS_INTTYPES_H@
79 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
80 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
81 # include <sys/inttypes.h>
84 #if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
85 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
86 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
87 included by <sys/types.h>. */
88 # include <sys/bitypes.h>
91 #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
94 /* 7.18.1.1. Exact-width integer types */
96 /* Here we assume a standard architecture where the hardware integer
97 types have 8, 16, 32, optionally 64 bits. */
101 typedef signed char unistring_int8_t;
102 typedef unsigned char unistring_uint8_t;
103 #define int8_t unistring_int8_t
104 #define uint8_t unistring_uint8_t
108 typedef short int unistring_int16_t;
109 typedef unsigned short int unistring_uint16_t;
110 #define int16_t unistring_int16_t
111 #define uint16_t unistring_uint16_t
115 typedef int unistring_int32_t;
116 typedef unsigned int unistring_uint32_t;
117 #define int32_t unistring_int32_t
118 #define uint32_t unistring_uint32_t
120 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
125 #endif /* _UNISTRING_STDINT_H */
126 #endif /* !defined _UNISTRING_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */