Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/int_limits.h
+++ new/usr/src/uts/common/sys/int_limits.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 + *
23 25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 */
26 28
27 29 #ifndef _SYS_INT_LIMITS_H
28 30 #define _SYS_INT_LIMITS_H
29 31
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 32 /*
33 33 * This file, <sys/int_limits.h>, is part of the Sun Microsystems implementation
34 34 * of <inttypes.h> as defined in the ISO C standard, ISO/IEC 9899:1999
35 35 * Programming language - C.
36 36 *
37 37 * Programs/Modules should not directly include this file. Access to the
38 38 * types defined in this file should be through the inclusion of one of the
39 39 * following files:
40 40 *
41 41 * <limits.h> This nested inclusion is disabled for strictly
42 42 * ANSI-C conforming compilations. The *_MIN
43 43 * definitions are not visible to POSIX or XPG
44 44 * conforming applications (due to what may be
45 45 * a bug in the specification - this is under
46 46 * investigation)
47 47 *
48 48 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
49 49 * components of <inttypes.h>.
50 50 *
51 51 * <inttypes.h> For use by applications.
52 52 *
53 53 * See these files for more details.
54 54 */
55 55
56 56 #include <sys/feature_tests.h>
57 57
58 58 #ifdef __cplusplus
59 59 extern "C" {
60 60 #endif
61 61
62 62 /*
63 63 * Limits
64 64 *
65 65 * The following define the limits for the types defined in <sys/int_types.h>.
66 66 *
67 67 * INTMAX_MIN (minimum value of the largest supported signed integer type),
68 68 * INTMAX_MAX (maximum value of the largest supported signed integer type),
69 69 * and UINTMAX_MAX (maximum value of the largest supported unsigned integer
70 70 * type) can be set to implementation defined limits.
71 71 *
72 72 * NOTE : A programmer can test to see whether an implementation supports
↓ open down ↓ |
31 lines elided |
↑ open up ↑ |
73 73 * a particular size of integer by testing if the macro that gives the
74 74 * maximum for that datatype is defined. For example, if #ifdef UINT64_MAX
75 75 * tests false, the implementation does not support unsigned 64 bit integers.
76 76 *
77 77 * The type of these macros is intentionally unspecified.
78 78 *
79 79 * The types int8_t, int_least8_t, and int_fast8_t are not defined for ISAs
80 80 * where the ABI specifies "char" as unsigned when the translation mode is
81 81 * not ANSI-C.
82 82 */
83 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
84 83 #define INT8_MAX (127)
85 -#endif
86 84 #define INT16_MAX (32767)
87 85 #define INT32_MAX (2147483647)
88 86 #if defined(_LP64)
89 87 #define INT64_MAX (9223372036854775807L)
90 88 #elif defined(_LONGLONG_TYPE)
91 89 #define INT64_MAX (9223372036854775807LL)
92 90 #endif
93 91
94 92 #define UINT8_MAX (255U)
95 93 #define UINT16_MAX (65535U)
96 94 #define UINT32_MAX (4294967295U)
97 95 #if defined(_LP64)
98 96 #define UINT64_MAX (18446744073709551615UL)
99 97 #elif defined(_LONGLONG_TYPE)
100 98 #define UINT64_MAX (18446744073709551615ULL)
101 99 #endif
102 100
103 101 #ifdef INT64_MAX
104 102 #define INTMAX_MAX INT64_MAX
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
105 103 #else
106 104 #define INTMAX_MAX INT32_MAX
107 105 #endif
108 106
109 107 #ifdef UINT64_MAX
110 108 #define UINTMAX_MAX UINT64_MAX
111 109 #else
112 110 #define UINTMAX_MAX UINT32_MAX
113 111 #endif
114 112
115 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
116 113 #define INT_LEAST8_MAX INT8_MAX
117 -#endif
118 114 #define INT_LEAST16_MAX INT16_MAX
119 115 #define INT_LEAST32_MAX INT32_MAX
120 116 #ifdef INT64_MAX
121 117 #define INT_LEAST64_MAX INT64_MAX
122 118 #endif
123 119
124 120 #define UINT_LEAST8_MAX UINT8_MAX
125 121 #define UINT_LEAST16_MAX UINT16_MAX
126 122 #define UINT_LEAST32_MAX UINT32_MAX
127 123 #ifdef UINT64_MAX
128 124 #define UINT_LEAST64_MAX UINT64_MAX
129 125 #endif
130 126
131 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
132 127 #define INT_FAST8_MAX INT8_MAX
133 -#endif
134 128 #define INT_FAST16_MAX INT16_MAX
135 129 #define INT_FAST32_MAX INT32_MAX
136 130 #ifdef INT64_MAX
137 131 #define INT_FAST64_MAX INT64_MAX
138 132 #endif
139 133
140 134 #define UINT_FAST8_MAX UINT8_MAX
141 135 #define UINT_FAST16_MAX UINT16_MAX
142 136 #define UINT_FAST32_MAX UINT32_MAX
143 137 #ifdef UINT64_MAX
144 138 #define UINT_FAST64_MAX UINT64_MAX
145 139 #endif
146 140
147 141 /*
148 142 * The following 2 macros are provided for testing whether the types
149 143 * intptr_t and uintptr_t (integers large enough to hold a void *) are
150 144 * defined in this header. They are needed in case the architecture can't
151 145 * represent a pointer in any standard integral type.
152 146 */
153 147 #if defined(_LP64) || defined(_I32LPx)
154 148 #define INTPTR_MAX INT64_MAX
155 149 #define UINTPTR_MAX UINT64_MAX
156 150 #else
157 151 #define INTPTR_MAX INT32_MAX
158 152 #define UINTPTR_MAX UINT32_MAX
159 153 #endif
160 154
161 155 /* Maximum limits of ptrdiff_t defined in <sys/types.h> */
162 156 #if defined(_LP64) || defined(_I32LPx)
163 157 #define PTRDIFF_MAX 9223372036854775807L
164 158 #else
165 159 #define PTRDIFF_MAX 2147483647
166 160 #endif
167 161
168 162 /*
169 163 * Maximum value of a "size_t". SIZE_MAX was previously defined
170 164 * in <limits.h>, however, the standards specify it be defined
171 165 * in <stdint.h>. The <stdint.h> headers includes this header as
172 166 * does <limits.h>. The value of SIZE_MAX should not deviate
173 167 * from the value of ULONG_MAX defined <sys/types.h>.
174 168 */
175 169 #if defined(_LP64)
176 170 #define SIZE_MAX 18446744073709551615UL
177 171 #else
178 172 #define SIZE_MAX 4294967295UL
179 173 #endif
180 174
181 175 /* Maximum limit of sig_atomic_t defined in <sys/types.h> */
182 176 #ifndef SIG_ATOMIC_MAX
183 177 #define SIG_ATOMIC_MAX 2147483647
184 178 #endif
185 179
186 180 /*
187 181 * Maximum limit of wchar_t. The WCHAR_* macros are also
188 182 * defined in <iso/wchar_iso.h>, but inclusion of that header
189 183 * will break ISO/IEC C namespace.
190 184 */
191 185 #ifndef WCHAR_MAX
192 186 #define WCHAR_MAX 2147483647
193 187 #endif
194 188
195 189 /* Maximum limit of wint_t */
196 190 #ifndef WINT_MAX
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
197 191 #define WINT_MAX 2147483647
198 192 #endif
199 193
200 194 /*
201 195 * It is probably a bug in the POSIX specification (IEEE-1003.1-1990) that
202 196 * when including <limits.h> that the suffix _MAX is reserved but not the
203 197 * suffix _MIN. However, until that issue is resolved....
204 198 */
205 199 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG6)
206 200
207 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
208 201 #define INT8_MIN (-128)
209 -#endif
210 202 #define INT16_MIN (-32767-1)
211 203 #define INT32_MIN (-2147483647-1)
212 204 #if defined(_LP64)
213 205 #define INT64_MIN (-9223372036854775807L-1)
214 206 #elif defined(_LONGLONG_TYPE)
215 207 #define INT64_MIN (-9223372036854775807LL-1)
216 208 #endif
217 209
218 210 #ifdef INT64_MIN
219 211 #define INTMAX_MIN INT64_MIN
220 212 #else
221 213 #define INTMAX_MIN INT32_MIN
222 214 #endif
223 215
224 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
225 216 #define INT_LEAST8_MIN INT8_MIN
226 -#endif
227 217 #define INT_LEAST16_MIN INT16_MIN
228 218 #define INT_LEAST32_MIN INT32_MIN
229 219 #ifdef INT64_MIN
230 220 #define INT_LEAST64_MIN INT64_MIN
231 221 #endif
232 222
233 -#if defined(_CHAR_IS_SIGNED) || defined(__STDC__)
234 223 #define INT_FAST8_MIN INT8_MIN
235 -#endif
236 224 #define INT_FAST16_MIN INT16_MIN
237 225 #define INT_FAST32_MIN INT32_MIN
238 226 #ifdef INT64_MIN
239 227 #define INT_FAST64_MIN INT64_MIN
240 228 #endif
241 229
242 230 /* Minimum value of a pointer-holding signed integer type */
243 231 #if defined(_LP64) || defined(_I32LPx)
244 232 #define INTPTR_MIN INT64_MIN
245 233 #else
246 234 #define INTPTR_MIN INT32_MIN
247 235 #endif
248 236
249 237 /* Minimum limits of ptrdiff_t defined in <sys/types.h> */
250 238 #if defined(_LP64) || defined(_I32LPx)
251 239 #define PTRDIFF_MIN (-9223372036854775807L-1L)
252 240 #else
253 241 #define PTRDIFF_MIN (-2147483647-1)
254 242 #endif
255 243
256 244 /* Minimum limit of sig_atomic_t defined in <sys/types.h> */
257 245 #ifndef SIG_ATOMIC_MIN
258 246 #define SIG_ATOMIC_MIN (-2147483647-1)
259 247 #endif
260 248
261 249 /*
262 250 * Minimum limit of wchar_t. The WCHAR_* macros are also
263 251 * defined in <iso/wchar_iso.h>, but inclusion of that header
264 252 * will break ISO/IEC C namespace.
265 253 */
266 254 #ifndef WCHAR_MIN
267 255 #define WCHAR_MIN (-2147483647-1)
268 256 #endif
269 257
270 258 /* Minimum limit of wint_t */
271 259 #ifndef WINT_MIN
272 260 #define WINT_MIN (-2147483647-1)
273 261 #endif
274 262
275 263 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
276 264
277 265 #ifdef __cplusplus
278 266 }
279 267 #endif
280 268
281 269 #endif /* _SYS_INT_LIMITS_H */
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX