source: Daodan/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/11.2.0/include/stddef.h@ 1181

Last change on this file since 1181 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

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