1 #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
2 && !defined(__STDDEF_H__)) \
3 || defined(__need_wchar_t) || defined(__need_size_t) \
4 || defined(__need_ptrdiff_t) || defined(__need_NULL) \
5 || defined(__need_wint_t)
7 /* Any one of these symbols __need_* means that GNU libc
8 wants us just to define one data type. So don't define
9 the symbols that indicate this file's entire job has been done. */
10 #if (!defined(__need_wchar_t) && !defined(__need_size_t) \
11 && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \
12 && !defined(__need_wint_t))
15 /* snaroff@next.com says the NeXT needs this. */
16 #define _ANSI_STDDEF_H
17 /* Irix 5.1 needs this. */
21 #ifndef __sys_stdtypes_h
22 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
23 There's no way to win with the other order! Sun lossage. */
25 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
26 one less case to deal with in the following. */
27 #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
28 #include <machine/ansi.h>
31 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
32 defined if the corresponding type is *not* defined.
33 FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
34 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
35 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
38 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
41 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
42 instead of _WCHAR_T_. */
43 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
48 /* Undef _FOO_T_ if we are supposed to define foo_t. */
49 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
51 #undef _BSD_PTRDIFF_T_
53 #if defined (__need_size_t) || defined (_STDDEF_H_)
57 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
61 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
63 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
65 #if defined (__sequent__) && defined (_PTRDIFF_T_)
69 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
70 _TYPE_size_t which will typedef size_t. fixincludes patched the
71 vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
72 not defined, and so that defining this macro defines _GCC_SIZE_T.
73 If we find that the macros are still defined at this point, we must
74 invoke them so that the type is defined as expected. */
75 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
77 #undef _TYPE_ptrdiff_t
79 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
83 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
88 /* In case nobody has defined these types, but we aren't running under
89 GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
90 __WCHAR_TYPE__ have reasonable values. This can happen if the
91 parts of GCC is compiled by an older compiler, that actually
92 include gstddef.h, such as collect2. */
94 /* Signed type of difference of two pointers. */
96 /* Define this type if we are doing the whole job,
97 or if we want this type in particular. */
98 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
99 #ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
104 #ifndef _BSD_PTRDIFF_T_
105 #ifndef ___int_ptrdiff_t_h
106 #ifndef _GCC_PTRDIFF_T
112 #define _BSD_PTRDIFF_T_
113 #define ___int_ptrdiff_t_h
114 #define _GCC_PTRDIFF_T
115 #ifndef __PTRDIFF_TYPE__
116 #define __PTRDIFF_TYPE__ long int
118 typedef __PTRDIFF_TYPE__ ptrdiff_t;
119 #endif /* _GCC_PTRDIFF_T */
120 #endif /* ___int_ptrdiff_t_h */
121 #endif /* _BSD_PTRDIFF_T_ */
122 #endif /* _PTRDIFF_T_ */
123 #endif /* __PTRDIFF_T */
124 #endif /* _T_PTRDIFF */
125 #endif /* _T_PTRDIFF_ */
126 #endif /* _PTRDIFF_T */
128 /* If this symbol has done its job, get rid of it. */
129 #undef __need_ptrdiff_t
131 #endif /* _STDDEF_H or __need_ptrdiff_t. */
133 /* Unsigned type of `sizeof' something. */
135 /* Define this type if we are doing the whole job,
136 or if we want this type in particular. */
137 #if defined (_STDDEF_H) || defined (__need_size_t)
138 #ifndef __size_t__ /* BeOS */
139 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
140 #ifndef _SYS_SIZE_T_H
146 #ifndef _SIZE_T_DEFINED_
147 #ifndef _SIZE_T_DEFINED
148 #ifndef ___int_size_t_h
152 #define __size_t__ /* BeOS */
154 #define _SYS_SIZE_T_H
160 #define _SIZE_T_DEFINED_
161 #define _SIZE_T_DEFINED
162 #define ___int_size_t_h
166 #ifndef __SIZE_TYPE__
167 #define __SIZE_TYPE__ long unsigned int
169 #if !(defined (__GNUG__) && defined (size_t))
170 typedef __SIZE_TYPE__ size_t;
172 typedef long ssize_t;
173 #endif /* __BEOS__ */
174 #endif /* !(defined (__GNUG__) && defined (size_t)) */
175 #endif /* __size_t */
177 #endif /* _GCC_SIZE_T */
178 #endif /* ___int_size_t_h */
179 #endif /* _SIZE_T_DEFINED */
180 #endif /* _SIZE_T_DEFINED_ */
181 #endif /* _BSD_SIZE_T_ */
182 #endif /* _SIZE_T_ */
183 #endif /* __SIZE_T */
185 #endif /* _T_SIZE_ */
186 #endif /* _SYS_SIZE_T_H */
188 #endif /* __size_t__ */
190 #endif /* _STDDEF_H or __need_size_t. */
193 /* Wide character type.
194 Locale-writers should change this as necessary to
195 be big enough to hold unique values not between 0 and 127,
196 and not (wchar_t) -1, for each defined multibyte character. */
198 /* Define this type if we are doing the whole job,
199 or if we want this type in particular. */
200 #if defined (_STDDEF_H) || defined (__need_wchar_t)
201 #ifndef __wchar_t__ /* BeOS */
207 #ifndef _BSD_WCHAR_T_
208 #ifndef _WCHAR_T_DEFINED_
209 #ifndef _WCHAR_T_DEFINED
211 #ifndef ___int_wchar_t_h
212 #ifndef __INT_WCHAR_T_H
214 #define __wchar_t__ /* BeOS */
220 #define _BSD_WCHAR_T_
221 #define _WCHAR_T_DEFINED_
222 #define _WCHAR_T_DEFINED
224 #define ___int_wchar_t_h
225 #define __INT_WCHAR_T_H
228 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
229 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
230 symbols in the _FOO_T_ family, stays defined even after its
231 corresponding type is defined). If we define wchar_t, then we
232 must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
233 we undef _WCHAR_T_, then we must also define rune_t, since
234 headers like runetype.h assume that if machine/ansi.h is included,
235 and _BSD_WCHAR_T_ is not defined, then rune_t is available.
236 machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
241 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
242 typedef _BSD_RUNE_T_ rune_t;
247 #ifndef __WCHAR_TYPE__
249 #define __WCHAR_TYPE__ unsigned char
251 #define __WCHAR_TYPE__ int
255 typedef __WCHAR_TYPE__ wchar_t;
269 #endif /* __wchar_t__ */
270 #undef __need_wchar_t
271 #endif /* _STDDEF_H or __need_wchar_t. */
273 #if defined (_STDDEF_H) || defined (__need_wint_t)
277 #ifndef __WINT_TYPE__
278 #define __WINT_TYPE__ unsigned int
280 typedef __WINT_TYPE__ wint_t;
285 /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
286 are already defined. */
287 /* BSD/OS 3.1 requires the MACHINE_ANSI_H check here. FreeBSD 2.x apparently
288 does not, even though there is a check for MACHINE_ANSI_H above. */
289 #if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_))
290 /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
291 are probably typos and should be removed before 2.8 is released. */
292 #ifdef _GCC_PTRDIFF_T_
294 #undef _BSD_PTRDIFF_T_
304 /* The following ones are the real ones. */
305 #ifdef _GCC_PTRDIFF_T
307 #undef _BSD_PTRDIFF_T_
317 #endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */
319 #endif /* __sys_stdtypes_h */
321 /* A null pointer constant. */
323 #if defined (_STDDEF_H) || defined (__need_NULL)
324 #undef NULL /* in case <stdio.h> has defined it. */
328 #define NULL ((void *)0)
330 #endif /* NULL not defined and <stddef.h> or need NULL. */
335 /* Offset of member MEMBER in a struct of type TYPE. */
337 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
339 #endif /* _STDDEF_H was defined this time */
341 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
342 || __need_XXX was not defined before */