6 /* Any one of these symbols __need_* means that GNU libc
7 wants us just to define one data type. So don't define
8 the symbols that indicate this file's entire job has been done. */
9 #if (!defined(__need_wchar_t) && !defined(__need_size_t) \
10 && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
13 /* snaroff@next.com says the NeXT needs this. */
14 #define _ANSI_STDDEF_H
15 /* Irix 5.1 needs this. */
19 #ifndef __sys_stdtypes_h
20 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
21 There's no way to win with the other order! Sun lossage. */
23 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
24 one less case to deal with in the following. */
25 #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
26 #include <machine/ansi.h>
29 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
30 defined if the corresponding type is *not* defined. */
32 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
35 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
38 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
39 instead of _WCHAR_T_. */
40 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
45 /* Undef _FOO_T_ if we are supposed to define foo_t. */
46 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
48 #undef _BSD_PTRDIFF_T_
50 #if defined (__need_size_t) || defined (_STDDEF_H_)
54 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
60 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
62 #if defined (__sequent__) && defined (_PTRDIFF_T_)
66 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
67 _TYPE_size_t which will typedef size_t. fixincludes patched the
68 vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
69 not defined, and so that defining this macro defines _GCC_SIZE_T.
70 If we find that the macros are still defined at this point, we must
71 invoke them so that the type is defined as expected. */
72 #if defined (TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
74 #undef _TYPE_ptrdiff_t
76 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
80 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
85 /* In case nobody has defined these types, but we aren't running under
86 GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
87 __WCHAR_TYPE__ have reasonable values. This can happen if the
88 parts of GCC is compiled by an older compiler, that actually
89 include gstddef.h, such as collect2. */
91 /* Signed type of difference of two pointers. */
93 /* Define this type if we are doing the whole job,
94 or if we want this type in particular. */
95 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
96 #ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
101 #ifndef _BSD_PTRDIFF_T_
102 #ifndef ___int_ptrdiff_t_h
103 #ifndef _GCC_PTRDIFF_T
109 #define _BSD_PTRDIFF_T_
110 #define ___int_ptrdiff_t_h
111 #define _GCC_PTRDIFF_T
112 #ifndef __PTRDIFF_TYPE__
113 #define __PTRDIFF_TYPE__ long int
115 typedef __PTRDIFF_TYPE__ ptrdiff_t;
116 #endif /* _GCC_PTRDIFF_T */
117 #endif /* ___int_ptrdiff_t_h */
118 #endif /* _BSD_PTRDIFF_T_ */
119 #endif /* _PTRDIFF_T_ */
120 #endif /* __PTRDIFF_T */
121 #endif /* _T_PTRDIFF */
122 #endif /* _T_PTRDIFF_ */
123 #endif /* _PTRDIFF_T */
125 /* If this symbol has done its job, get rid of it. */
126 #undef __need_ptrdiff_t
128 #endif /* _STDDEF_H or __need_ptrdiff_t. */
130 /* Unsigned type of `sizeof' something. */
132 /* Define this type if we are doing the whole job,
133 or if we want this type in particular. */
134 #if defined (_STDDEF_H) || defined (__need_size_t)
135 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
136 #ifndef _SYS_SIZE_T_H
142 #ifndef _SIZE_T_DEFINED_
143 #ifndef _SIZE_T_DEFINED
144 #ifndef ___int_size_t_h
149 #define _SYS_SIZE_T_H
155 #define _SIZE_T_DEFINED_
156 #define _SIZE_T_DEFINED
157 #define ___int_size_t_h
161 #ifndef __SIZE_TYPE__
162 #define __SIZE_TYPE__ long unsigned int
164 #if !(defined (__GNUG__) && defined (size_t))
165 typedef __SIZE_TYPE__ size_t;
166 #endif /* !(defined (__GNUG__) && defined (size_t)) */
167 #endif /* __size_t */
169 #endif /* _GCC_SIZE_T */
170 #endif /* ___int_size_t_h */
171 #endif /* _SIZE_T_DEFINED */
172 #endif /* _SIZE_T_DEFINED_ */
173 #endif /* _BSD_SIZE_T_ */
174 #endif /* _SIZE_T_ */
175 #endif /* __SIZE_T */
177 #endif /* _T_SIZE_ */
178 #endif /* _SYS_SIZE_T_H */
181 #endif /* _STDDEF_H or __need_size_t. */
184 /* Wide character type.
185 Locale-writers should change this as necessary to
186 be big enough to hold unique values not between 0 and 127,
187 and not (wchar_t) -1, for each defined multibyte character. */
189 /* Define this type if we are doing the whole job,
190 or if we want this type in particular. */
191 #if defined (_STDDEF_H) || defined (__need_wchar_t)
197 #ifndef _BSD_WCHAR_T_
198 #ifndef _WCHAR_T_DEFINED_
199 #ifndef _WCHAR_T_DEFINED
201 #ifndef ___int_wchar_t_h
202 #ifndef __INT_WCHAR_T_H
209 #define _BSD_WCHAR_T_
210 #define _WCHAR_T_DEFINED_
211 #define _WCHAR_T_DEFINED
213 #define ___int_wchar_t_h
214 #define __INT_WCHAR_T_H
217 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
218 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
219 symbols in the _FOO_T_ family, stays defined even after its
220 corresponding type is defined). If we define wchar_t, then we
221 must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
222 we undef _WCHAR_T_, then we must also define rune_t, since
223 headers like runetype.h assume that if machine/ansi.h is included,
224 and _BSD_WCHAR_T_ is not defined, then rune_t is available.
225 machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
230 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
231 typedef _BSD_RUNE_T_ rune_t;
236 #ifndef __WCHAR_TYPE__
237 #define __WCHAR_TYPE__ int
239 typedef __WCHAR_TYPE__ wchar_t;
252 #undef __need_wchar_t
253 #endif /* _STDDEF_H or __need_wchar_t. */
255 /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
256 are already defined. */
258 /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
259 are probably typos and should be removed before 2.7 is released. */
260 #ifdef _GCC_PTRDIFF_T_
262 #undef _BSD_PTRDIFF_T_
272 /* The following ones are the real ones. */
273 #ifdef _GCC_PTRDIFF_T
282 #endif /* _ANSI_H_ */
284 #endif /* __sys_stdtypes_h */
286 /* A null pointer constant. */
288 #if defined (_STDDEF_H) || defined (__need_NULL)
289 #undef NULL /* in case <stdio.h> has defined it. */
290 #define NULL ((void *)0)
291 #endif /* NULL not defined and <stddef.h> or need NULL. */
296 /* Offset of member MEMBER in a struct of type TYPE. */
298 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
300 #endif /* _STDDEF_H was defined this time */
302 #endif /* __STDDEF_H__ was not defined before */
303 #endif /* _ANSI_STDDEF_H was not defined before */
304 #endif /* _STDDEF_H_ was not defined before */
305 #endif /* _STDDEF_H was not defined before */