gcc50/stddef.h: Remove __FreeBSD only conditions
[dragonfly.git] / contrib / gcc-5.0 / gcc / ginclude / stddef.h
1 /* Copyright (C) 1989-2015 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 GCC 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 General Public License for more details.
14
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.
18
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/>.  */
23
24 /*
25  * ISO C Standard:  7.17  Common definitions  <stddef.h>
26  */
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)
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)        \
37      && !defined(__need_ptrdiff_t) && !defined(__need_NULL)     \
38      && !defined(__need_wint_t))
39 #define _STDDEF_H
40 #define _STDDEF_H_
41 /* snaroff@next.com says the NeXT needs this.  */
42 #define _ANSI_STDDEF_H
43 #endif
44
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
49 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
50    defined if the corresponding type is *not* defined.
51    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
52    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_ */
53 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_)  || defined(_I386_ANSI_H_)
54 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
55 #define _SIZE_T
56 #endif
57 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
58 #define _PTRDIFF_T
59 #endif
60 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
61    instead of _WCHAR_T_. */
62 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
63 #ifndef _BSD_WCHAR_T_
64 #define _WCHAR_T
65 #endif
66 #endif
67 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
68 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
69 #undef _PTRDIFF_T_
70 #undef _BSD_PTRDIFF_T_
71 #endif
72 #if defined (__need_size_t) || defined (_STDDEF_H_)
73 #undef _SIZE_T_
74 #undef _BSD_SIZE_T_
75 #endif
76 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
77 #undef _WCHAR_T_
78 #undef _BSD_WCHAR_T_
79 #endif
80 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) */
81
82 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
83    Just ignore it.  */
84 #if defined (__sequent__) && defined (_PTRDIFF_T_)
85 #undef _PTRDIFF_T_
86 #endif
87
88 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
89    _TYPE_size_t which will typedef size_t.  fixincludes patched the
90    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
91    not defined, and so that defining this macro defines _GCC_SIZE_T.
92    If we find that the macros are still defined at this point, we must
93    invoke them so that the type is defined as expected.  */
94 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
95 _TYPE_ptrdiff_t;
96 #undef _TYPE_ptrdiff_t
97 #endif
98 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
99 _TYPE_size_t;
100 #undef _TYPE_size_t
101 #endif
102 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
103 _TYPE_wchar_t;
104 #undef _TYPE_wchar_t
105 #endif
106
107 /* In case nobody has defined these types, but we aren't running under
108    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
109    __WCHAR_TYPE__ have reasonable values.  This can happen if the
110    parts of GCC is compiled by an older compiler, that actually
111    include gstddef.h, such as collect2.  */
112
113 /* Signed type of difference of two pointers.  */
114
115 /* Define this type if we are doing the whole job,
116    or if we want this type in particular.  */
117 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
118 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
119 #ifndef _T_PTRDIFF_
120 #ifndef _T_PTRDIFF
121 #ifndef __PTRDIFF_T
122 #ifndef _PTRDIFF_T_
123 #ifndef _BSD_PTRDIFF_T_
124 #ifndef ___int_ptrdiff_t_h
125 #ifndef _GCC_PTRDIFF_T
126 #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
127 #define _PTRDIFF_T
128 #define _T_PTRDIFF_
129 #define _T_PTRDIFF
130 #define __PTRDIFF_T
131 #define _PTRDIFF_T_
132 #define _BSD_PTRDIFF_T_
133 #define ___int_ptrdiff_t_h
134 #define _GCC_PTRDIFF_T
135 #define _PTRDIFF_T_DECLARED
136 #ifndef __PTRDIFF_TYPE__
137 #define __PTRDIFF_TYPE__ long int
138 #endif
139 typedef __PTRDIFF_TYPE__ ptrdiff_t;
140 #endif /* _PTRDIFF_T_DECLARED */
141 #endif /* _GCC_PTRDIFF_T */
142 #endif /* ___int_ptrdiff_t_h */
143 #endif /* _BSD_PTRDIFF_T_ */
144 #endif /* _PTRDIFF_T_ */
145 #endif /* __PTRDIFF_T */
146 #endif /* _T_PTRDIFF */
147 #endif /* _T_PTRDIFF_ */
148 #endif /* _PTRDIFF_T */
149
150 /* If this symbol has done its job, get rid of it.  */
151 #undef  __need_ptrdiff_t
152
153 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
154
155 /* Unsigned type of `sizeof' something.  */
156
157 /* Define this type if we are doing the whole job,
158    or if we want this type in particular.  */
159 #if defined (_STDDEF_H) || defined (__need_size_t)
160 #ifndef __size_t__      /* BeOS */
161 #ifndef __SIZE_T__      /* Cray Unicos/Mk */
162 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
163 #ifndef _SYS_SIZE_T_H
164 #ifndef _T_SIZE_
165 #ifndef _T_SIZE
166 #ifndef __SIZE_T
167 #ifndef _SIZE_T_
168 #ifndef _BSD_SIZE_T_
169 #ifndef _SIZE_T_DEFINED_
170 #ifndef _SIZE_T_DEFINED
171 #ifndef _BSD_SIZE_T_DEFINED_    /* Darwin */
172 #ifndef _SIZE_T_DECLARED        /* FreeBSD 5 */
173 #ifndef ___int_size_t_h
174 #ifndef _GCC_SIZE_T
175 #ifndef _SIZET_
176 #ifndef __size_t
177 #define __size_t__      /* BeOS */
178 #define __SIZE_T__      /* Cray Unicos/Mk */
179 #define _SIZE_T
180 #define _SYS_SIZE_T_H
181 #define _T_SIZE_
182 #define _T_SIZE
183 #define __SIZE_T
184 #define _SIZE_T_
185 #define _BSD_SIZE_T_
186 #define _SIZE_T_DEFINED_
187 #define _SIZE_T_DEFINED
188 #define _BSD_SIZE_T_DEFINED_    /* Darwin */
189 #define _SIZE_T_DECLARED        /* FreeBSD 5 */
190 #define ___int_size_t_h
191 #define _GCC_SIZE_T
192 #define _SIZET_
193 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
194   || defined(__DragonFly__) \
195   || defined(__FreeBSD_kernel__)
196 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
197 #elif defined (__VMS__)
198 /* __size_t is also a typedef on VMS.  */
199 #else
200 #define __size_t
201 #endif
202 #ifndef __SIZE_TYPE__
203 #define __SIZE_TYPE__ long unsigned int
204 #endif
205 #if !(defined (__GNUG__) && defined (size_t))
206 typedef __SIZE_TYPE__ size_t;
207 #ifdef __BEOS__
208 typedef long ssize_t;
209 #endif /* __BEOS__ */
210 #endif /* !(defined (__GNUG__) && defined (size_t)) */
211 #endif /* __size_t */
212 #endif /* _SIZET_ */
213 #endif /* _GCC_SIZE_T */
214 #endif /* ___int_size_t_h */
215 #endif /* _SIZE_T_DECLARED */
216 #endif /* _BSD_SIZE_T_DEFINED_ */
217 #endif /* _SIZE_T_DEFINED */
218 #endif /* _SIZE_T_DEFINED_ */
219 #endif /* _BSD_SIZE_T_ */
220 #endif /* _SIZE_T_ */
221 #endif /* __SIZE_T */
222 #endif /* _T_SIZE */
223 #endif /* _T_SIZE_ */
224 #endif /* _SYS_SIZE_T_H */
225 #endif /* _SIZE_T */
226 #endif /* __SIZE_T__ */
227 #endif /* __size_t__ */
228 #undef  __need_size_t
229 #endif /* _STDDEF_H or __need_size_t.  */
230
231
232 /* Wide character type.
233    Locale-writers should change this as necessary to
234    be big enough to hold unique values not between 0 and 127,
235    and not (wchar_t) -1, for each defined multibyte character.  */
236
237 /* Define this type if we are doing the whole job,
238    or if we want this type in particular.  */
239 #if defined (_STDDEF_H) || defined (__need_wchar_t)
240 #ifndef __wchar_t__     /* BeOS */
241 #ifndef __WCHAR_T__     /* Cray Unicos/Mk */
242 #ifndef _WCHAR_T
243 #ifndef _T_WCHAR_
244 #ifndef _T_WCHAR
245 #ifndef __WCHAR_T
246 #ifndef _WCHAR_T_
247 #ifndef _BSD_WCHAR_T_
248 #ifndef _BSD_WCHAR_T_DEFINED_    /* Darwin */
249 #ifndef _BSD_RUNE_T_DEFINED_    /* Darwin */
250 #ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
251 #ifndef _WCHAR_T_DEFINED_
252 #ifndef _WCHAR_T_DEFINED
253 #ifndef _WCHAR_T_H
254 #ifndef ___int_wchar_t_h
255 #ifndef __INT_WCHAR_T_H
256 #ifndef _GCC_WCHAR_T
257 #define __wchar_t__     /* BeOS */
258 #define __WCHAR_T__     /* Cray Unicos/Mk */
259 #define _WCHAR_T
260 #define _T_WCHAR_
261 #define _T_WCHAR
262 #define __WCHAR_T
263 #define _WCHAR_T_
264 #define _BSD_WCHAR_T_
265 #define _WCHAR_T_DEFINED_
266 #define _WCHAR_T_DEFINED
267 #define _WCHAR_T_H
268 #define ___int_wchar_t_h
269 #define __INT_WCHAR_T_H
270 #define _GCC_WCHAR_T
271 #define _WCHAR_T_DECLARED
272
273 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
274    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
275    symbols in the _FOO_T_ family, stays defined even after its
276    corresponding type is defined).  If we define wchar_t, then we
277    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
278    we undef _WCHAR_T_, then we must also define rune_t, since 
279    headers like runetype.h assume that if machine/ansi.h is included,
280    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
281    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
282    the same type." */
283 #ifdef _BSD_WCHAR_T_
284 #undef _BSD_WCHAR_T_
285 #ifdef _BSD_RUNE_T_
286 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
287 typedef _BSD_RUNE_T_ rune_t;
288 #define _BSD_WCHAR_T_DEFINED_
289 #define _BSD_RUNE_T_DEFINED_    /* Darwin */
290 #endif
291 #endif
292 #endif
293
294 #ifndef __WCHAR_TYPE__
295 #define __WCHAR_TYPE__ int
296 #endif
297 #ifndef __cplusplus
298 typedef __WCHAR_TYPE__ wchar_t;
299 #endif
300 #endif
301 #endif
302 #endif
303 #endif
304 #endif
305 #endif
306 #endif /* _WCHAR_T_DECLARED */
307 #endif /* _BSD_RUNE_T_DEFINED_ */
308 #endif
309 #endif
310 #endif
311 #endif
312 #endif
313 #endif
314 #endif
315 #endif /* __WCHAR_T__ */
316 #endif /* __wchar_t__ */
317 #undef  __need_wchar_t
318 #endif /* _STDDEF_H or __need_wchar_t.  */
319
320 #if defined (__need_wint_t)
321 #ifndef _WINT_T
322 #define _WINT_T
323
324 #ifndef __WINT_TYPE__
325 #define __WINT_TYPE__ unsigned int
326 #endif
327 typedef __WINT_TYPE__ wint_t;
328 #endif
329 #undef __need_wint_t
330 #endif
331
332 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
333     are already defined.  */
334 /*  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.  */
335 /*  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.  */
336 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_)
337 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
338     are probably typos and should be removed before 2.8 is released.  */
339 #ifdef _GCC_PTRDIFF_T_
340 #undef _PTRDIFF_T_
341 #undef _BSD_PTRDIFF_T_
342 #endif
343 #ifdef _GCC_SIZE_T_
344 #undef _SIZE_T_
345 #undef _BSD_SIZE_T_
346 #endif
347 #ifdef _GCC_WCHAR_T_
348 #undef _WCHAR_T_
349 #undef _BSD_WCHAR_T_
350 #endif
351 /*  The following ones are the real ones.  */
352 #ifdef _GCC_PTRDIFF_T
353 #undef _PTRDIFF_T_
354 #undef _BSD_PTRDIFF_T_
355 #endif
356 #ifdef _GCC_SIZE_T
357 #undef _SIZE_T_
358 #undef _BSD_SIZE_T_
359 #endif
360 #ifdef _GCC_WCHAR_T
361 #undef _WCHAR_T_
362 #undef _BSD_WCHAR_T_
363 #endif
364 #endif /* _ANSI_H_ || _MACHINE_ANSI_H_ || _X86_64_ANSI_H_ || _I386_ANSI_H_ */
365
366 #endif /* __sys_stdtypes_h */
367
368 /* A null pointer constant.  */
369
370 #if defined (_STDDEF_H) || defined (__need_NULL)
371 #undef NULL             /* in case <stdio.h> has defined it. */
372 #ifdef __GNUG__
373 #define NULL __null
374 #else   /* G++ */
375 #ifndef __cplusplus
376 #define NULL ((void *)0)
377 #else   /* C++ */
378 #define NULL 0
379 #endif  /* C++ */
380 #endif  /* G++ */
381 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
382 #undef  __need_NULL
383
384 #ifdef _STDDEF_H
385
386 /* Offset of member MEMBER in a struct of type TYPE. */
387 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
388
389 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
390   || (defined(__cplusplus) && __cplusplus >= 201103L)
391 #ifndef _GCC_MAX_ALIGN_T
392 #define _GCC_MAX_ALIGN_T
393 /* Type whose alignment is supported in every context and is at least
394    as great as that of any standard type not using alignment
395    specifiers.  */
396 typedef struct {
397   long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
398   long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
399 } max_align_t;
400 #endif
401 #endif /* C11 or C++11.  */
402
403 #if defined(__cplusplus) && __cplusplus >= 201103L
404 #ifndef _GXX_NULLPTR_T
405 #define _GXX_NULLPTR_T
406   typedef decltype(nullptr) nullptr_t;
407 #endif
408 #endif /* C++11.  */
409
410 #endif /* _STDDEF_H was defined this time */
411
412 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
413           || __need_XXX was not defined before */