]>
Commit | Line | Data |
---|---|---|
7adcbafe | 1 | /* Copyright (C) 1989-2022 Free Software Foundation, Inc. |
fe1dbf6c | 2 | |
e531258e | 3 | This file is part of GCC. |
fe1dbf6c | 4 | |
e531258e | 5 | GCC is free software; you can redistribute it and/or modify |
fe1dbf6c | 6 | it under the terms of the GNU General Public License as published by |
748086b7 | 7 | the Free Software Foundation; either version 3, or (at your option) |
fe1dbf6c ZW |
8 | any later version. |
9 | ||
e531258e | 10 | GCC is distributed in the hope that it will be useful, |
fe1dbf6c ZW |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
748086b7 JJ |
15 | Under Section 7 of GPL version 3, you are granted additional |
16 | permissions described in the GCC Runtime Library Exception, version | |
17 | 3.1, as published by the Free Software Foundation. | |
fe1dbf6c | 18 | |
748086b7 JJ |
19 | You should have received a copy of the GNU General Public License and |
20 | a copy of the GCC Runtime Library Exception along with this program; | |
21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
22 | <http://www.gnu.org/licenses/>. */ | |
fe1dbf6c ZW |
23 | |
24 | /* | |
25 | * ISO C Standard: 7.17 Common definitions <stddef.h> | |
26 | */ | |
57bc5ea0 RK |
27 | #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ |
28 | && !defined(__STDDEF_H__)) \ | |
29 | || defined(__need_wchar_t) || defined(__need_size_t) \ | |
30 | || defined(__need_ptrdiff_t) || defined(__need_NULL) \ | |
31 | || defined(__need_wint_t) | |
77395be6 RS |
32 | |
33 | /* Any one of these symbols __need_* means that GNU libc | |
34 | wants us just to define one data type. So don't define | |
35 | the symbols that indicate this file's entire job has been done. */ | |
36 | #if (!defined(__need_wchar_t) && !defined(__need_size_t) \ | |
3464bdc4 RK |
37 | && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ |
38 | && !defined(__need_wint_t)) | |
301264e6 MM |
39 | #define _STDDEF_H |
40 | #define _STDDEF_H_ | |
cac47212 RS |
41 | /* snaroff@next.com says the NeXT needs this. */ |
42 | #define _ANSI_STDDEF_H | |
77395be6 | 43 | #endif |
301264e6 | 44 | |
da38c875 DE |
45 | #ifndef __sys_stdtypes_h |
46 | /* This avoids lossage on SunOS but only if stdtypes.h comes first. | |
47 | There's no way to win with the other order! Sun lossage. */ | |
48 | ||
ada818fd | 49 | #if defined(__NetBSD__) |
ca2ece1b | 50 | #include <machine/ansi.h> |
6be564d0 | 51 | #endif |
0402566f GP |
52 | |
53 | #if defined (__FreeBSD__) | |
081d6fb9 LR |
54 | #include <sys/_types.h> |
55 | #endif | |
6be564d0 | 56 | |
ada818fd | 57 | #if defined(__NetBSD__) |
ec2c907a | 58 | #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) |
6be564d0 RS |
59 | #define _SIZE_T |
60 | #endif | |
ec2c907a | 61 | #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_) |
6be564d0 RS |
62 | #define _PTRDIFF_T |
63 | #endif | |
73c8c157 RK |
64 | /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ |
65 | instead of _WCHAR_T_. */ | |
ec2c907a | 66 | #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_) |
73c8c157 | 67 | #ifndef _BSD_WCHAR_T_ |
6be564d0 RS |
68 | #define _WCHAR_T |
69 | #endif | |
73c8c157 | 70 | #endif |
26afdb8e | 71 | /* Undef _FOO_T_ if we are supposed to define foo_t. */ |
6de47384 | 72 | #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) |
6be564d0 | 73 | #undef _PTRDIFF_T_ |
ec2c907a | 74 | #undef _BSD_PTRDIFF_T_ |
26afdb8e | 75 | #endif |
6de47384 | 76 | #if defined (__need_size_t) || defined (_STDDEF_H_) |
ca2ece1b | 77 | #undef _SIZE_T_ |
ec2c907a | 78 | #undef _BSD_SIZE_T_ |
26afdb8e | 79 | #endif |
6de47384 | 80 | #if defined (__need_wchar_t) || defined (_STDDEF_H_) |
09dafdad | 81 | #undef _WCHAR_T_ |
ec2c907a | 82 | #undef _BSD_WCHAR_T_ |
ca2ece1b | 83 | #endif |
ada818fd | 84 | #endif /* defined(__NetBSD__) */ |
09dafdad | 85 | |
6d68f08e RS |
86 | /* Sequent's header files use _PTRDIFF_T_ in some conflicting way. |
87 | Just ignore it. */ | |
88 | #if defined (__sequent__) && defined (_PTRDIFF_T_) | |
89 | #undef _PTRDIFF_T_ | |
90 | #endif | |
91 | ||
3d356a8c ILT |
92 | /* On VxWorks, <type/vxTypesBase.h> may have defined macros like |
93 | _TYPE_size_t which will typedef size_t. fixincludes patched the | |
94 | vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is | |
95 | not defined, and so that defining this macro defines _GCC_SIZE_T. | |
96 | If we find that the macros are still defined at this point, we must | |
97 | invoke them so that the type is defined as expected. */ | |
25e0447f | 98 | #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) |
3d356a8c ILT |
99 | _TYPE_ptrdiff_t; |
100 | #undef _TYPE_ptrdiff_t | |
101 | #endif | |
102 | #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) | |
103 | _TYPE_size_t; | |
104 | #undef _TYPE_size_t | |
105 | #endif | |
106 | #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) | |
107 | _TYPE_wchar_t; | |
108 | #undef _TYPE_wchar_t | |
109 | #endif | |
110 | ||
616f7d00 | 111 | /* In case nobody has defined these types, but we aren't running under |
b7a0c86f | 112 | GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and |
616f7d00 RS |
113 | __WCHAR_TYPE__ have reasonable values. This can happen if the |
114 | parts of GCC is compiled by an older compiler, that actually | |
115 | include gstddef.h, such as collect2. */ | |
116 | ||
301264e6 MM |
117 | /* Signed type of difference of two pointers. */ |
118 | ||
c8b9d354 CH |
119 | /* Define this type if we are doing the whole job, |
120 | or if we want this type in particular. */ | |
121 | #if defined (_STDDEF_H) || defined (__need_ptrdiff_t) | |
301264e6 | 122 | #ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */ |
3308e40a | 123 | #ifndef _T_PTRDIFF_ |
301264e6 MM |
124 | #ifndef _T_PTRDIFF |
125 | #ifndef __PTRDIFF_T | |
126 | #ifndef _PTRDIFF_T_ | |
ec2c907a | 127 | #ifndef _BSD_PTRDIFF_T_ |
301264e6 | 128 | #ifndef ___int_ptrdiff_t_h |
3308e40a | 129 | #ifndef _GCC_PTRDIFF_T |
dbed5a9b | 130 | #ifndef _PTRDIFF_T_DECLARED /* DragonFly */ |
85a438fc | 131 | #ifndef __DEFINED_ptrdiff_t /* musl libc */ |
301264e6 | 132 | #define _PTRDIFF_T |
3308e40a | 133 | #define _T_PTRDIFF_ |
301264e6 MM |
134 | #define _T_PTRDIFF |
135 | #define __PTRDIFF_T | |
136 | #define _PTRDIFF_T_ | |
ec2c907a | 137 | #define _BSD_PTRDIFF_T_ |
301264e6 | 138 | #define ___int_ptrdiff_t_h |
3308e40a | 139 | #define _GCC_PTRDIFF_T |
dbed5a9b | 140 | #define _PTRDIFF_T_DECLARED |
85a438fc | 141 | #define __DEFINED_ptrdiff_t |
616f7d00 RS |
142 | #ifndef __PTRDIFF_TYPE__ |
143 | #define __PTRDIFF_TYPE__ long int | |
144 | #endif | |
301264e6 | 145 | typedef __PTRDIFF_TYPE__ ptrdiff_t; |
85a438fc | 146 | #endif /* __DEFINED_ptrdiff_t */ |
dbed5a9b | 147 | #endif /* _PTRDIFF_T_DECLARED */ |
3308e40a | 148 | #endif /* _GCC_PTRDIFF_T */ |
301264e6 | 149 | #endif /* ___int_ptrdiff_t_h */ |
ec2c907a | 150 | #endif /* _BSD_PTRDIFF_T_ */ |
301264e6 MM |
151 | #endif /* _PTRDIFF_T_ */ |
152 | #endif /* __PTRDIFF_T */ | |
153 | #endif /* _T_PTRDIFF */ | |
3308e40a | 154 | #endif /* _T_PTRDIFF_ */ |
301264e6 MM |
155 | #endif /* _PTRDIFF_T */ |
156 | ||
77395be6 RS |
157 | /* If this symbol has done its job, get rid of it. */ |
158 | #undef __need_ptrdiff_t | |
159 | ||
c8b9d354 CH |
160 | #endif /* _STDDEF_H or __need_ptrdiff_t. */ |
161 | ||
301264e6 MM |
162 | /* Unsigned type of `sizeof' something. */ |
163 | ||
c8b9d354 CH |
164 | /* Define this type if we are doing the whole job, |
165 | or if we want this type in particular. */ | |
166 | #if defined (_STDDEF_H) || defined (__need_size_t) | |
c55dcc7d | 167 | #ifndef __size_t__ /* BeOS */ |
30102605 | 168 | #ifndef __SIZE_T__ /* Cray Unicos/Mk */ |
301264e6 | 169 | #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */ |
b6126bf1 | 170 | #ifndef _SYS_SIZE_T_H |
3308e40a | 171 | #ifndef _T_SIZE_ |
301264e6 MM |
172 | #ifndef _T_SIZE |
173 | #ifndef __SIZE_T | |
174 | #ifndef _SIZE_T_ | |
ec2c907a | 175 | #ifndef _BSD_SIZE_T_ |
a1630124 | 176 | #ifndef _SIZE_T_DEFINED_ |
a2a8c03c | 177 | #ifndef _SIZE_T_DEFINED |
825abef4 | 178 | #ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */ |
081d6fb9 | 179 | #ifndef _SIZE_T_DECLARED /* FreeBSD 5 */ |
85a438fc | 180 | #ifndef __DEFINED_size_t /* musl libc */ |
301264e6 | 181 | #ifndef ___int_size_t_h |
3308e40a | 182 | #ifndef _GCC_SIZE_T |
e2f08830 | 183 | #ifndef _SIZET_ |
de9f6f43 | 184 | #ifndef __size_t |
c55dcc7d | 185 | #define __size_t__ /* BeOS */ |
30102605 | 186 | #define __SIZE_T__ /* Cray Unicos/Mk */ |
301264e6 | 187 | #define _SIZE_T |
b6126bf1 | 188 | #define _SYS_SIZE_T_H |
3308e40a | 189 | #define _T_SIZE_ |
301264e6 MM |
190 | #define _T_SIZE |
191 | #define __SIZE_T | |
192 | #define _SIZE_T_ | |
ec2c907a | 193 | #define _BSD_SIZE_T_ |
a1630124 | 194 | #define _SIZE_T_DEFINED_ |
a2a8c03c | 195 | #define _SIZE_T_DEFINED |
825abef4 | 196 | #define _BSD_SIZE_T_DEFINED_ /* Darwin */ |
081d6fb9 | 197 | #define _SIZE_T_DECLARED /* FreeBSD 5 */ |
85a438fc | 198 | #define __DEFINED_size_t /* musl libc */ |
301264e6 | 199 | #define ___int_size_t_h |
3308e40a | 200 | #define _GCC_SIZE_T |
e2f08830 | 201 | #define _SIZET_ |
0402566f | 202 | #if defined (__FreeBSD__) \ |
dbed5a9b | 203 | || defined(__DragonFly__) \ |
9bc6f25d MR |
204 | || defined(__FreeBSD_kernel__) \ |
205 | || defined(__VMS__) | |
206 | /* __size_t is a typedef, must not trash it. */ | |
081d6fb9 | 207 | #else |
de9f6f43 | 208 | #define __size_t |
081d6fb9 | 209 | #endif |
616f7d00 RS |
210 | #ifndef __SIZE_TYPE__ |
211 | #define __SIZE_TYPE__ long unsigned int | |
212 | #endif | |
e38ba83a | 213 | #if !(defined (__GNUG__) && defined (size_t)) |
301264e6 | 214 | typedef __SIZE_TYPE__ size_t; |
c55dcc7d FF |
215 | #ifdef __BEOS__ |
216 | typedef long ssize_t; | |
217 | #endif /* __BEOS__ */ | |
e38ba83a | 218 | #endif /* !(defined (__GNUG__) && defined (size_t)) */ |
de9f6f43 | 219 | #endif /* __size_t */ |
e2f08830 | 220 | #endif /* _SIZET_ */ |
3308e40a | 221 | #endif /* _GCC_SIZE_T */ |
301264e6 | 222 | #endif /* ___int_size_t_h */ |
85a438fc | 223 | #endif /* __DEFINED_size_t */ |
081d6fb9 | 224 | #endif /* _SIZE_T_DECLARED */ |
825abef4 | 225 | #endif /* _BSD_SIZE_T_DEFINED_ */ |
a2a8c03c | 226 | #endif /* _SIZE_T_DEFINED */ |
a1630124 | 227 | #endif /* _SIZE_T_DEFINED_ */ |
ec2c907a | 228 | #endif /* _BSD_SIZE_T_ */ |
301264e6 MM |
229 | #endif /* _SIZE_T_ */ |
230 | #endif /* __SIZE_T */ | |
231 | #endif /* _T_SIZE */ | |
3308e40a | 232 | #endif /* _T_SIZE_ */ |
b6126bf1 | 233 | #endif /* _SYS_SIZE_T_H */ |
301264e6 | 234 | #endif /* _SIZE_T */ |
30102605 | 235 | #endif /* __SIZE_T__ */ |
c55dcc7d | 236 | #endif /* __size_t__ */ |
77395be6 | 237 | #undef __need_size_t |
c8b9d354 | 238 | #endif /* _STDDEF_H or __need_size_t. */ |
301264e6 | 239 | |
77395be6 RS |
240 | |
241 | /* Wide character type. | |
242 | Locale-writers should change this as necessary to | |
243 | be big enough to hold unique values not between 0 and 127, | |
244 | and not (wchar_t) -1, for each defined multibyte character. */ | |
301264e6 | 245 | |
c8b9d354 CH |
246 | /* Define this type if we are doing the whole job, |
247 | or if we want this type in particular. */ | |
248 | #if defined (_STDDEF_H) || defined (__need_wchar_t) | |
c55dcc7d | 249 | #ifndef __wchar_t__ /* BeOS */ |
30102605 | 250 | #ifndef __WCHAR_T__ /* Cray Unicos/Mk */ |
301264e6 MM |
251 | #ifndef _WCHAR_T |
252 | #ifndef _T_WCHAR_ | |
b125a5a8 | 253 | #ifndef _T_WCHAR |
301264e6 MM |
254 | #ifndef __WCHAR_T |
255 | #ifndef _WCHAR_T_ | |
ec2c907a | 256 | #ifndef _BSD_WCHAR_T_ |
ee890fe2 | 257 | #ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */ |
825abef4 | 258 | #ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */ |
081d6fb9 | 259 | #ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */ |
85a438fc | 260 | #ifndef __DEFINED_wchar_t /* musl libc */ |
a1630124 | 261 | #ifndef _WCHAR_T_DEFINED_ |
a2a8c03c | 262 | #ifndef _WCHAR_T_DEFINED |
7a0b14b8 | 263 | #ifndef _WCHAR_T_H |
301264e6 | 264 | #ifndef ___int_wchar_t_h |
fda59a9a | 265 | #ifndef __INT_WCHAR_T_H |
3308e40a | 266 | #ifndef _GCC_WCHAR_T |
c55dcc7d | 267 | #define __wchar_t__ /* BeOS */ |
30102605 | 268 | #define __WCHAR_T__ /* Cray Unicos/Mk */ |
301264e6 MM |
269 | #define _WCHAR_T |
270 | #define _T_WCHAR_ | |
b125a5a8 | 271 | #define _T_WCHAR |
301264e6 MM |
272 | #define __WCHAR_T |
273 | #define _WCHAR_T_ | |
ec2c907a | 274 | #define _BSD_WCHAR_T_ |
a1630124 | 275 | #define _WCHAR_T_DEFINED_ |
a2a8c03c | 276 | #define _WCHAR_T_DEFINED |
7a0b14b8 | 277 | #define _WCHAR_T_H |
301264e6 | 278 | #define ___int_wchar_t_h |
fda59a9a | 279 | #define __INT_WCHAR_T_H |
3308e40a | 280 | #define _GCC_WCHAR_T |
081d6fb9 | 281 | #define _WCHAR_T_DECLARED |
85a438fc | 282 | #define __DEFINED_wchar_t |
73c8c157 RK |
283 | |
284 | /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ | |
285 | instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other | |
286 | symbols in the _FOO_T_ family, stays defined even after its | |
287 | corresponding type is defined). If we define wchar_t, then we | |
288 | must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if | |
289 | we undef _WCHAR_T_, then we must also define rune_t, since | |
290 | headers like runetype.h assume that if machine/ansi.h is included, | |
291 | and _BSD_WCHAR_T_ is not defined, then rune_t is available. | |
292 | machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of | |
293 | the same type." */ | |
294 | #ifdef _BSD_WCHAR_T_ | |
295 | #undef _BSD_WCHAR_T_ | |
296 | #ifdef _BSD_RUNE_T_ | |
297 | #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) | |
298 | typedef _BSD_RUNE_T_ rune_t; | |
5cb265ec | 299 | #define _BSD_WCHAR_T_DEFINED_ |
825abef4 | 300 | #define _BSD_RUNE_T_DEFINED_ /* Darwin */ |
081d6fb9 | 301 | #if defined (__FreeBSD__) && (__FreeBSD__ < 5) |
d3471d77 | 302 | /* Why is this file so hard to maintain properly? In contrast to |
17eb7951 LR |
303 | the comment above regarding BSD/386 1.1, on FreeBSD for as long |
304 | as the symbol has existed, _BSD_RUNE_T_ must not stay defined or | |
305 | redundant typedefs will occur when stdlib.h is included after this file. */ | |
306 | #undef _BSD_RUNE_T_ | |
307 | #endif | |
73c8c157 RK |
308 | #endif |
309 | #endif | |
310 | #endif | |
081d6fb9 LR |
311 | /* FreeBSD 5 can't be handled well using "traditional" logic above |
312 | since it no longer defines _BSD_RUNE_T_ yet still desires to export | |
313 | rune_t in some cases... */ | |
314 | #if defined (__FreeBSD__) && (__FreeBSD__ >= 5) | |
315 | #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) | |
316 | #if __BSD_VISIBLE | |
317 | #ifndef _RUNE_T_DECLARED | |
318 | typedef __rune_t rune_t; | |
319 | #define _RUNE_T_DECLARED | |
320 | #endif | |
321 | #endif | |
322 | #endif | |
323 | #endif | |
73c8c157 | 324 | |
616f7d00 RS |
325 | #ifndef __WCHAR_TYPE__ |
326 | #define __WCHAR_TYPE__ int | |
327 | #endif | |
cfeda197 | 328 | #ifndef __cplusplus |
301264e6 MM |
329 | typedef __WCHAR_TYPE__ wchar_t; |
330 | #endif | |
331 | #endif | |
332 | #endif | |
333 | #endif | |
334 | #endif | |
3308e40a | 335 | #endif |
84b18070 | 336 | #endif |
85a438fc | 337 | #endif /* __DEFINED_wchar_t */ |
081d6fb9 | 338 | #endif /* _WCHAR_T_DECLARED */ |
825abef4 | 339 | #endif /* _BSD_RUNE_T_DEFINED_ */ |
7a0b14b8 | 340 | #endif |
fda59a9a | 341 | #endif |
a1630124 | 342 | #endif |
ec2c907a | 343 | #endif |
a2a8c03c | 344 | #endif |
cfeda197 | 345 | #endif |
ee890fe2 | 346 | #endif |
30102605 | 347 | #endif /* __WCHAR_T__ */ |
c55dcc7d | 348 | #endif /* __wchar_t__ */ |
590f7e64 | 349 | #undef __need_wchar_t |
c8b9d354 | 350 | #endif /* _STDDEF_H or __need_wchar_t. */ |
301264e6 | 351 | |
c5ab7f91 | 352 | #if defined (__need_wint_t) |
3464bdc4 RK |
353 | #ifndef _WINT_T |
354 | #define _WINT_T | |
355 | ||
356 | #ifndef __WINT_TYPE__ | |
357 | #define __WINT_TYPE__ unsigned int | |
358 | #endif | |
3464bdc4 RK |
359 | typedef __WINT_TYPE__ wint_t; |
360 | #endif | |
3e2b54f5 | 361 | #undef __need_wint_t |
3464bdc4 | 362 | #endif |
3464bdc4 | 363 | |
ada818fd | 364 | #if defined(__NetBSD__) |
73c8c157 | 365 | /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ |
a0ab0422 | 366 | are probably typos and should be removed before 2.8 is released. */ |
26afdb8e | 367 | #ifdef _GCC_PTRDIFF_T_ |
6be564d0 | 368 | #undef _PTRDIFF_T_ |
ec2c907a | 369 | #undef _BSD_PTRDIFF_T_ |
26afdb8e RS |
370 | #endif |
371 | #ifdef _GCC_SIZE_T_ | |
6be564d0 | 372 | #undef _SIZE_T_ |
ec2c907a | 373 | #undef _BSD_SIZE_T_ |
6be564d0 | 374 | #endif |
26afdb8e RS |
375 | #ifdef _GCC_WCHAR_T_ |
376 | #undef _WCHAR_T_ | |
ec2c907a | 377 | #undef _BSD_WCHAR_T_ |
ca2ece1b | 378 | #endif |
73c8c157 RK |
379 | /* The following ones are the real ones. */ |
380 | #ifdef _GCC_PTRDIFF_T | |
381 | #undef _PTRDIFF_T_ | |
a0ab0422 | 382 | #undef _BSD_PTRDIFF_T_ |
73c8c157 RK |
383 | #endif |
384 | #ifdef _GCC_SIZE_T | |
385 | #undef _SIZE_T_ | |
a0ab0422 | 386 | #undef _BSD_SIZE_T_ |
73c8c157 RK |
387 | #endif |
388 | #ifdef _GCC_WCHAR_T | |
389 | #undef _WCHAR_T_ | |
a0ab0422 | 390 | #undef _BSD_WCHAR_T_ |
73c8c157 | 391 | #endif |
ada818fd | 392 | #endif /* __NetBSD__ */ |
6be564d0 | 393 | |
da38c875 DE |
394 | #endif /* __sys_stdtypes_h */ |
395 | ||
301264e6 MM |
396 | /* A null pointer constant. */ |
397 | ||
77395be6 | 398 | #if defined (_STDDEF_H) || defined (__need_NULL) |
301264e6 | 399 | #undef NULL /* in case <stdio.h> has defined it. */ |
7a389b48 JM |
400 | #ifdef __GNUG__ |
401 | #define NULL __null | |
402 | #else /* G++ */ | |
be78ffb2 | 403 | #ifndef __cplusplus |
301264e6 | 404 | #define NULL ((void *)0) |
be78ffb2 JM |
405 | #else /* C++ */ |
406 | #define NULL 0 | |
407 | #endif /* C++ */ | |
7a389b48 | 408 | #endif /* G++ */ |
77395be6 RS |
409 | #endif /* NULL not defined and <stddef.h> or need NULL. */ |
410 | #undef __need_NULL | |
411 | ||
412 | #ifdef _STDDEF_H | |
301264e6 | 413 | |
300e89a2 | 414 | /* Offset of member MEMBER in a struct of type TYPE. */ |
7a3ea201 RH |
415 | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) |
416 | ||
48b0b196 | 417 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \ |
d19fa6b5 JM |
418 | || (defined(__cplusplus) && __cplusplus >= 201103L) |
419 | #ifndef _GCC_MAX_ALIGN_T | |
420 | #define _GCC_MAX_ALIGN_T | |
421 | /* Type whose alignment is supported in every context and is at least | |
422 | as great as that of any standard type not using alignment | |
423 | specifiers. */ | |
424 | typedef struct { | |
425 | long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); | |
426 | long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); | |
63012d9a JM |
427 | /* _Float128 is defined as a basic type, so max_align_t must be |
428 | sufficiently aligned for it. This code must work in C++, so we | |
429 | use __float128 here; that is only available on some | |
430 | architectures, but only on i386 is extra alignment needed for | |
431 | __float128. */ | |
432 | #ifdef __i386__ | |
433 | __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); | |
434 | #endif | |
d19fa6b5 JM |
435 | } max_align_t; |
436 | #endif | |
48b0b196 | 437 | #endif /* C11 or C++11. */ |
d19fa6b5 | 438 | |
21c278c9 PC |
439 | #if defined(__cplusplus) && __cplusplus >= 201103L |
440 | #ifndef _GXX_NULLPTR_T | |
441 | #define _GXX_NULLPTR_T | |
442 | typedef decltype(nullptr) nullptr_t; | |
443 | #endif | |
444 | #endif /* C++11. */ | |
445 | ||
60d84e82 MP |
446 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) |
447 | #ifndef _GCC_NULLPTR_T | |
448 | #define _GCC_NULLPTR_T | |
449 | typedef __typeof__(nullptr) nullptr_t; | |
450 | /* ??? This doesn't define __STDC_VERSION_STDDEF_H__ yet. */ | |
451 | #endif | |
452 | #endif /* C23. */ | |
453 | ||
a1a53dc7 JM |
454 | #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L |
455 | #define unreachable() (__builtin_unreachable ()) | |
456 | #endif | |
457 | ||
77395be6 | 458 | #endif /* _STDDEF_H was defined this time */ |
8328559d | 459 | |
57bc5ea0 RK |
460 | #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ |
461 | || __need_XXX was not defined before */ |