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 /* in case <sys/types.h> has defined it. */
139 #ifndef _SYS_SIZE_T_H
145 #ifndef _SIZE_T_DEFINED_
146 #ifndef _SIZE_T_DEFINED
147 #ifndef ___int_size_t_h
152 #define _SYS_SIZE_T_H
158 #define _SIZE_T_DEFINED_
159 #define _SIZE_T_DEFINED
160 #define ___int_size_t_h
164 #ifndef __SIZE_TYPE__
165 #define __SIZE_TYPE__ long unsigned int
167 #if !(defined (__GNUG__) && defined (size_t))
168 typedef __SIZE_TYPE__ size_t;
169 #endif /* !(defined (__GNUG__) && defined (size_t)) */
170 #endif /* __size_t */
172 #endif /* _GCC_SIZE_T */
173 #endif /* ___int_size_t_h */
174 #endif /* _SIZE_T_DEFINED */
175 #endif /* _SIZE_T_DEFINED_ */
176 #endif /* _BSD_SIZE_T_ */
177 #endif /* _SIZE_T_ */
178 #endif /* __SIZE_T */
180 #endif /* _T_SIZE_ */
181 #endif /* _SYS_SIZE_T_H */
184 #endif /* _STDDEF_H or __need_size_t. */
187 /* Wide character type.
188 Locale-writers should change this as necessary to
189 be big enough to hold unique values not between 0 and 127,
190 and not (wchar_t) -1, for each defined multibyte character. */
192 /* Define this type if we are doing the whole job,
193 or if we want this type in particular. */
194 #if defined (_STDDEF_H) || defined (__need_wchar_t)
200 #ifndef _BSD_WCHAR_T_
201 #ifndef _WCHAR_T_DEFINED_
202 #ifndef _WCHAR_T_DEFINED
204 #ifndef ___int_wchar_t_h
205 #ifndef __INT_WCHAR_T_H
212 #define _BSD_WCHAR_T_
213 #define _WCHAR_T_DEFINED_
214 #define _WCHAR_T_DEFINED
216 #define ___int_wchar_t_h
217 #define __INT_WCHAR_T_H
220 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
221 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
222 symbols in the _FOO_T_ family, stays defined even after its
223 corresponding type is defined). If we define wchar_t, then we
224 must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
225 we undef _WCHAR_T_, then we must also define rune_t, since
226 headers like runetype.h assume that if machine/ansi.h is included,
227 and _BSD_WCHAR_T_ is not defined, then rune_t is available.
228 machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
233 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
234 typedef _BSD_RUNE_T_ rune_t;
239 #ifndef __WCHAR_TYPE__
240 #define __WCHAR_TYPE__ int
243 typedef __WCHAR_TYPE__ wchar_t;
257 #undef __need_wchar_t
258 #endif /* _STDDEF_H or __need_wchar_t. */
260 #if defined (_STDDEF_H) || defined (__need_wint_t)
264 #ifndef __WINT_TYPE__
265 #define __WINT_TYPE__ unsigned int
267 typedef __WINT_TYPE__ wint_t;
272 /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
273 are already defined. */
275 /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
276 are probably typos and should be removed before 2.8 is released. */
277 #ifdef _GCC_PTRDIFF_T_
279 #undef _BSD_PTRDIFF_T_
289 /* The following ones are the real ones. */
290 #ifdef _GCC_PTRDIFF_T
292 #undef _BSD_PTRDIFF_T_
302 #endif /* _ANSI_H_ */
304 #endif /* __sys_stdtypes_h */
306 /* A null pointer constant. */
308 #if defined (_STDDEF_H) || defined (__need_NULL)
309 #undef NULL /* in case <stdio.h> has defined it. */
313 #define NULL ((void *)0)
315 #endif /* NULL not defined and <stddef.h> or need NULL. */
320 /* Offset of member MEMBER in a struct of type TYPE. */
322 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
324 #endif /* _STDDEF_H was defined this time */
326 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
327 || __need_XXX was not defined before */