]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gcc/ginclude/stddef.h
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / contrib / gcc / ginclude / stddef.h
1 /* $FreeBSD$ */
2
3 #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
4      && !defined(__STDDEF_H__)) \
5     || defined(__need_wchar_t) || defined(__need_size_t) \
6     || defined(__need_ptrdiff_t) || defined(__need_NULL) \
7     || defined(__need_wint_t)
8
9 /* Any one of these symbols __need_* means that GNU libc
10    wants us just to define one data type.  So don't define
11    the symbols that indicate this file's entire job has been done.  */
12 #if (!defined(__need_wchar_t) && !defined(__need_size_t)        \
13      && !defined(__need_ptrdiff_t) && !defined(__need_NULL)     \
14      && !defined(__need_wint_t))
15 #define _STDDEF_H
16 #define _STDDEF_H_
17 /* snaroff@next.com says the NeXT needs this.  */
18 #define _ANSI_STDDEF_H
19 /* Irix 5.1 needs this.  */
20 #define __STDDEF_H__
21 #endif
22
23 #ifndef __sys_stdtypes_h
24 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
25    There's no way to win with the other order!  Sun lossage.  */
26
27 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
28    one less case to deal with in the following.  */
29 #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
30 #include <machine/ansi.h>
31 #endif
32
33 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
34    defined if the corresponding type is *not* defined.
35    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
36 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
37 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
38 #define _SIZE_T
39 #endif
40 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
41 #define _PTRDIFF_T
42 #endif
43 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
44    instead of _WCHAR_T_. */
45 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
46 #ifndef _BSD_WCHAR_T_
47 #define _WCHAR_T
48 #endif
49 #endif
50 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
51 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
52 #undef _PTRDIFF_T_
53 #undef _BSD_PTRDIFF_T_
54 #endif
55 #if defined (__need_size_t) || defined (_STDDEF_H_)
56 #undef _SIZE_T_
57 #undef _BSD_SIZE_T_
58 #endif
59 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
60 #undef _WCHAR_T_
61 #undef _BSD_WCHAR_T_
62 #endif
63 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
64
65 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
66    Just ignore it.  */
67 #if defined (__sequent__) && defined (_PTRDIFF_T_)
68 #undef _PTRDIFF_T_
69 #endif
70
71 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
72    _TYPE_size_t which will typedef size_t.  fixincludes patched the
73    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
74    not defined, and so that defining this macro defines _GCC_SIZE_T.
75    If we find that the macros are still defined at this point, we must
76    invoke them so that the type is defined as expected.  */
77 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
78 _TYPE_ptrdiff_t;
79 #undef _TYPE_ptrdiff_t
80 #endif
81 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
82 _TYPE_size_t;
83 #undef _TYPE_size_t
84 #endif
85 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
86 _TYPE_wchar_t;
87 #undef _TYPE_wchar_t
88 #endif
89
90 /* In case nobody has defined these types, but we aren't running under
91    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
92    __WCHAR_TYPE__ have reasonable values.  This can happen if the
93    parts of GCC is compiled by an older compiler, that actually
94    include gstddef.h, such as collect2.  */
95
96 /* Signed type of difference of two pointers.  */
97
98 /* Define this type if we are doing the whole job,
99    or if we want this type in particular.  */
100 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
101 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
102 #ifndef _T_PTRDIFF_
103 #ifndef _T_PTRDIFF
104 #ifndef __PTRDIFF_T
105 #ifndef _PTRDIFF_T_
106 #ifndef _BSD_PTRDIFF_T_
107 #ifndef ___int_ptrdiff_t_h
108 #ifndef _GCC_PTRDIFF_T
109 #define _PTRDIFF_T
110 #define _T_PTRDIFF_
111 #define _T_PTRDIFF
112 #define __PTRDIFF_T
113 #define _PTRDIFF_T_
114 #define _BSD_PTRDIFF_T_
115 #define ___int_ptrdiff_t_h
116 #define _GCC_PTRDIFF_T
117 #ifndef __PTRDIFF_TYPE__
118 #define __PTRDIFF_TYPE__ long int
119 #endif
120 typedef __PTRDIFF_TYPE__ ptrdiff_t;
121 #endif /* _GCC_PTRDIFF_T */
122 #endif /* ___int_ptrdiff_t_h */
123 #endif /* _BSD_PTRDIFF_T_ */
124 #endif /* _PTRDIFF_T_ */
125 #endif /* __PTRDIFF_T */
126 #endif /* _T_PTRDIFF */
127 #endif /* _T_PTRDIFF_ */
128 #endif /* _PTRDIFF_T */
129
130 /* If this symbol has done its job, get rid of it.  */
131 #undef  __need_ptrdiff_t
132
133 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
134
135 /* Unsigned type of `sizeof' something.  */
136
137 /* Define this type if we are doing the whole job,
138    or if we want this type in particular.  */
139 #if defined (_STDDEF_H) || defined (__need_size_t)
140 #ifndef __size_t__      /* BeOS */
141 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
142 #ifndef _SYS_SIZE_T_H
143 #ifndef _T_SIZE_
144 #ifndef _T_SIZE
145 #ifndef __SIZE_T
146 #ifndef _SIZE_T_
147 #ifndef _BSD_SIZE_T_
148 #ifndef _SIZE_T_DEFINED_
149 #ifndef _SIZE_T_DEFINED
150 #ifndef ___int_size_t_h
151 #ifndef _GCC_SIZE_T
152 #ifndef _SIZET_
153 #ifndef __size_t
154 #define __size_t__      /* BeOS */
155 #define _SIZE_T
156 #define _SYS_SIZE_T_H
157 #define _T_SIZE_
158 #define _T_SIZE
159 #define __SIZE_T
160 #define _SIZE_T_
161 #define _BSD_SIZE_T_
162 #define _SIZE_T_DEFINED_
163 #define _SIZE_T_DEFINED
164 #define ___int_size_t_h
165 #define _GCC_SIZE_T
166 #define _SIZET_
167 #define __size_t
168 #ifndef __SIZE_TYPE__
169 #define __SIZE_TYPE__ long unsigned int
170 #endif
171 #if !(defined (__GNUG__) && defined (size_t))
172 typedef __SIZE_TYPE__ size_t;
173 #ifdef __BEOS__
174 typedef long ssize_t;
175 #endif /* __BEOS__ */
176 #endif /* !(defined (__GNUG__) && defined (size_t)) */
177 #endif /* __size_t */
178 #endif /* _SIZET_ */
179 #endif /* _GCC_SIZE_T */
180 #endif /* ___int_size_t_h */
181 #endif /* _SIZE_T_DEFINED */
182 #endif /* _SIZE_T_DEFINED_ */
183 #endif /* _BSD_SIZE_T_ */
184 #endif /* _SIZE_T_ */
185 #endif /* __SIZE_T */
186 #endif /* _T_SIZE */
187 #endif /* _T_SIZE_ */
188 #endif /* _SYS_SIZE_T_H */
189 #endif /* _SIZE_T */
190 #endif /* __size_t__ */
191 #undef  __need_size_t
192 #endif /* _STDDEF_H or __need_size_t.  */
193
194
195 /* Wide character type.
196    Locale-writers should change this as necessary to
197    be big enough to hold unique values not between 0 and 127,
198    and not (wchar_t) -1, for each defined multibyte character.  */
199
200 /* Define this type if we are doing the whole job,
201    or if we want this type in particular.  */
202 #if defined (_STDDEF_H) || defined (__need_wchar_t)
203 #ifndef __wchar_t__     /* BeOS */
204 #ifndef _WCHAR_T
205 #ifndef _T_WCHAR_
206 #ifndef _T_WCHAR
207 #ifndef __WCHAR_T
208 #ifndef _WCHAR_T_
209 #ifndef _BSD_WCHAR_T_
210 #ifndef _WCHAR_T_DEFINED_
211 #ifndef _WCHAR_T_DEFINED
212 #ifndef _WCHAR_T_H
213 #ifndef ___int_wchar_t_h
214 #ifndef __INT_WCHAR_T_H
215 #ifndef _GCC_WCHAR_T
216 #define __wchar_t__     /* BeOS */
217 #define _WCHAR_T
218 #define _T_WCHAR_
219 #define _T_WCHAR
220 #define __WCHAR_T
221 #define _WCHAR_T_
222 #define _BSD_WCHAR_T_
223 #define _WCHAR_T_DEFINED_
224 #define _WCHAR_T_DEFINED
225 #define _WCHAR_T_H
226 #define ___int_wchar_t_h
227 #define __INT_WCHAR_T_H
228 #define _GCC_WCHAR_T
229
230 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
231    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
232    symbols in the _FOO_T_ family, stays defined even after its
233    corresponding type is defined).  If we define wchar_t, then we
234    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
235    we undef _WCHAR_T_, then we must also define rune_t, since 
236    headers like runetype.h assume that if machine/ansi.h is included,
237    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
238    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
239    the same type." */
240 #ifdef _BSD_WCHAR_T_
241 #undef _BSD_WCHAR_T_
242 #ifdef _BSD_RUNE_T_
243 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
244 typedef _BSD_RUNE_T_ rune_t;
245 #endif
246 #endif
247 #endif
248
249 #ifndef __WCHAR_TYPE__
250 #ifdef __BEOS__
251 #define __WCHAR_TYPE__ unsigned char
252 #else
253 #define __WCHAR_TYPE__ int
254 #endif
255 #endif
256 #ifndef __cplusplus
257 typedef __WCHAR_TYPE__ wchar_t;
258 #endif
259 #endif
260 #endif
261 #endif
262 #endif
263 #endif
264 #endif
265 #endif
266 #endif
267 #endif
268 #endif
269 #endif
270 #endif
271 #endif /* __wchar_t__ */
272 #undef  __need_wchar_t
273 #endif /* _STDDEF_H or __need_wchar_t.  */
274
275 #if defined (_STDDEF_H) || defined (__need_wint_t)
276 #ifndef _WINT_T
277 #define _WINT_T
278
279 #ifndef __WINT_TYPE__
280 #define __WINT_TYPE__ unsigned int
281 #endif
282 typedef __WINT_TYPE__ wint_t;
283 #endif
284 #undef __need_wint_t
285 #endif
286
287 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
288     are already defined.  */
289 /*  BSD/OS 3.1 requires the MACHINE_ANSI_H check here.  FreeBSD 2.x apparently
290     does not, even though there is a check for MACHINE_ANSI_H above.  */
291 #if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_))
292 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
293     are probably typos and should be removed before 2.8 is released.  */
294 #ifdef _GCC_PTRDIFF_T_
295 #undef _PTRDIFF_T_
296 #undef _BSD_PTRDIFF_T_
297 #endif
298 #ifdef _GCC_SIZE_T_
299 #undef _SIZE_T_
300 #undef _BSD_SIZE_T_
301 #endif
302 #ifdef _GCC_WCHAR_T_
303 #undef _WCHAR_T_
304 #undef _BSD_WCHAR_T_
305 #endif
306 /*  The following ones are the real ones.  */
307 #ifdef _GCC_PTRDIFF_T
308 #undef _PTRDIFF_T_
309 #undef _BSD_PTRDIFF_T_
310 #endif
311 #ifdef _GCC_SIZE_T
312 #undef _SIZE_T_
313 #undef _BSD_SIZE_T_
314 #endif
315 #ifdef _GCC_WCHAR_T
316 #undef _WCHAR_T_
317 #undef _BSD_WCHAR_T_
318 #endif
319 #endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */
320
321 #endif /* __sys_stdtypes_h */
322
323 /* A null pointer constant.  */
324
325 #if defined (_STDDEF_H) || defined (__need_NULL)
326 #undef NULL             /* in case <stdio.h> has defined it. */
327 #ifdef __GNUG__
328 #define NULL __null
329 #else   /* G++ */
330 #define NULL ((void *)0)
331 #endif  /* G++ */
332 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
333 #undef  __need_NULL
334
335 #ifdef _STDDEF_H
336
337 /* Offset of member MEMBER in a struct of type TYPE.  */
338
339 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
340
341 #endif /* _STDDEF_H was defined this time */
342
343 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
344           || __need_XXX was not defined before */