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)
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))
17 /* snaroff@next.com says the NeXT needs this. */
18 #define _ANSI_STDDEF_H
19 /* Irix 5.1 needs this. */
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. */
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>
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_)
40 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
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_)
50 /* Undef _FOO_T_ if we are supposed to define foo_t. */
51 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
53 #undef _BSD_PTRDIFF_T_
55 #if defined (__need_size_t) || defined (_STDDEF_H_)
59 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
63 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
65 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
67 #if defined (__sequent__) && defined (_PTRDIFF_T_)
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_))
79 #undef _TYPE_ptrdiff_t
81 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
85 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
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. */
96 /* Signed type of difference of two pointers. */
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. */
106 #ifndef _BSD_PTRDIFF_T_
107 #ifndef ___int_ptrdiff_t_h
108 #ifndef _GCC_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
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 */
130 /* If this symbol has done its job, get rid of it. */
131 #undef __need_ptrdiff_t
133 #endif /* _STDDEF_H or __need_ptrdiff_t. */
135 /* Unsigned type of `sizeof' something. */
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
148 #ifndef _SIZE_T_DEFINED_
149 #ifndef _SIZE_T_DEFINED
150 #ifndef ___int_size_t_h
154 #define __size_t__ /* BeOS */
156 #define _SYS_SIZE_T_H
162 #define _SIZE_T_DEFINED_
163 #define _SIZE_T_DEFINED
164 #define ___int_size_t_h
168 #ifndef __SIZE_TYPE__
169 #define __SIZE_TYPE__ long unsigned int
171 #if !(defined (__GNUG__) && defined (size_t))
172 typedef __SIZE_TYPE__ size_t;
174 typedef long ssize_t;
175 #endif /* __BEOS__ */
176 #endif /* !(defined (__GNUG__) && defined (size_t)) */
177 #endif /* __size_t */
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 */
187 #endif /* _T_SIZE_ */
188 #endif /* _SYS_SIZE_T_H */
190 #endif /* __size_t__ */
192 #endif /* _STDDEF_H or __need_size_t. */
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. */
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 */
209 #ifndef _BSD_WCHAR_T_
210 #ifndef _WCHAR_T_DEFINED_
211 #ifndef _WCHAR_T_DEFINED
213 #ifndef ___int_wchar_t_h
214 #ifndef __INT_WCHAR_T_H
216 #define __wchar_t__ /* BeOS */
222 #define _BSD_WCHAR_T_
223 #define _WCHAR_T_DEFINED_
224 #define _WCHAR_T_DEFINED
226 #define ___int_wchar_t_h
227 #define __INT_WCHAR_T_H
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
243 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
244 typedef _BSD_RUNE_T_ rune_t;
249 #ifndef __WCHAR_TYPE__
251 #define __WCHAR_TYPE__ unsigned char
253 #define __WCHAR_TYPE__ int
257 typedef __WCHAR_TYPE__ wchar_t;
271 #endif /* __wchar_t__ */
272 #undef __need_wchar_t
273 #endif /* _STDDEF_H or __need_wchar_t. */
275 #if defined (_STDDEF_H) || defined (__need_wint_t)
279 #ifndef __WINT_TYPE__
280 #define __WINT_TYPE__ unsigned int
282 typedef __WINT_TYPE__ wint_t;
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_
296 #undef _BSD_PTRDIFF_T_
306 /* The following ones are the real ones. */
307 #ifdef _GCC_PTRDIFF_T
309 #undef _BSD_PTRDIFF_T_
319 #endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */
321 #endif /* __sys_stdtypes_h */
323 /* A null pointer constant. */
325 #if defined (_STDDEF_H) || defined (__need_NULL)
326 #undef NULL /* in case <stdio.h> has defined it. */
330 #define NULL ((void *)0)
332 #endif /* NULL not defined and <stddef.h> or need NULL. */
337 /* Offset of member MEMBER in a struct of type TYPE. */
339 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
341 #endif /* _STDDEF_H was defined this time */
343 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
344 || __need_XXX was not defined before */