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