OSDN Git Service

Make sure file is processed if some of the known __need_* macros is
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / stddef.h
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)
6
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))
13 #define _STDDEF_H
14 #define _STDDEF_H_
15 /* snaroff@next.com says the NeXT needs this.  */
16 #define _ANSI_STDDEF_H
17 /* Irix 5.1 needs this.  */
18 #define __STDDEF_H__
19 #endif
20
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.  */
24
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>
29 #endif
30
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_)
36 #define _SIZE_T
37 #endif
38 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
39 #define _PTRDIFF_T
40 #endif
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_)
44 #ifndef _BSD_WCHAR_T_
45 #define _WCHAR_T
46 #endif
47 #endif
48 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
49 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
50 #undef _PTRDIFF_T_
51 #undef _BSD_PTRDIFF_T_
52 #endif
53 #if defined (__need_size_t) || defined (_STDDEF_H_)
54 #undef _SIZE_T_
55 #undef _BSD_SIZE_T_
56 #endif
57 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
58 #undef _WCHAR_T_
59 #undef _BSD_WCHAR_T_
60 #endif
61 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
62
63 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
64    Just ignore it.  */
65 #if defined (__sequent__) && defined (_PTRDIFF_T_)
66 #undef _PTRDIFF_T_
67 #endif
68
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_))
76 _TYPE_ptrdiff_t;
77 #undef _TYPE_ptrdiff_t
78 #endif
79 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
80 _TYPE_size_t;
81 #undef _TYPE_size_t
82 #endif
83 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
84 _TYPE_wchar_t;
85 #undef _TYPE_wchar_t
86 #endif
87
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.  */
93
94 /* Signed type of difference of two pointers.  */
95
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. */
100 #ifndef _T_PTRDIFF_
101 #ifndef _T_PTRDIFF
102 #ifndef __PTRDIFF_T
103 #ifndef _PTRDIFF_T_
104 #ifndef _BSD_PTRDIFF_T_
105 #ifndef ___int_ptrdiff_t_h
106 #ifndef _GCC_PTRDIFF_T
107 #define _PTRDIFF_T
108 #define _T_PTRDIFF_
109 #define _T_PTRDIFF
110 #define __PTRDIFF_T
111 #define _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
117 #endif
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 */
127
128 /* If this symbol has done its job, get rid of it.  */
129 #undef  __need_ptrdiff_t
130
131 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
132
133 /* Unsigned type of `sizeof' something.  */
134
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
140 #ifndef _T_SIZE_
141 #ifndef _T_SIZE
142 #ifndef __SIZE_T
143 #ifndef _SIZE_T_
144 #ifndef _BSD_SIZE_T_
145 #ifndef _SIZE_T_DEFINED_
146 #ifndef _SIZE_T_DEFINED
147 #ifndef ___int_size_t_h
148 #ifndef _GCC_SIZE_T
149 #ifndef _SIZET_
150 #ifndef __size_t
151 #define _SIZE_T
152 #define _SYS_SIZE_T_H
153 #define _T_SIZE_
154 #define _T_SIZE
155 #define __SIZE_T
156 #define _SIZE_T_
157 #define _BSD_SIZE_T_
158 #define _SIZE_T_DEFINED_
159 #define _SIZE_T_DEFINED
160 #define ___int_size_t_h
161 #define _GCC_SIZE_T
162 #define _SIZET_
163 #define __size_t
164 #ifndef __SIZE_TYPE__
165 #define __SIZE_TYPE__ long unsigned int
166 #endif
167 #if !(defined (__GNUG__) && defined (size_t))
168 typedef __SIZE_TYPE__ size_t;
169 #endif /* !(defined (__GNUG__) && defined (size_t)) */
170 #endif /* __size_t */
171 #endif /* _SIZET_ */
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 */
179 #endif /* _T_SIZE */
180 #endif /* _T_SIZE_ */
181 #endif /* _SYS_SIZE_T_H */
182 #endif /* _SIZE_T */
183 #undef  __need_size_t
184 #endif /* _STDDEF_H or __need_size_t.  */
185
186
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.  */
191
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)
195 #ifndef _WCHAR_T
196 #ifndef _T_WCHAR_
197 #ifndef _T_WCHAR
198 #ifndef __WCHAR_T
199 #ifndef _WCHAR_T_
200 #ifndef _BSD_WCHAR_T_
201 #ifndef _WCHAR_T_DEFINED_
202 #ifndef _WCHAR_T_DEFINED
203 #ifndef _WCHAR_T_H
204 #ifndef ___int_wchar_t_h
205 #ifndef __INT_WCHAR_T_H
206 #ifndef _GCC_WCHAR_T
207 #define _WCHAR_T
208 #define _T_WCHAR_
209 #define _T_WCHAR
210 #define __WCHAR_T
211 #define _WCHAR_T_
212 #define _BSD_WCHAR_T_
213 #define _WCHAR_T_DEFINED_
214 #define _WCHAR_T_DEFINED
215 #define _WCHAR_T_H
216 #define ___int_wchar_t_h
217 #define __INT_WCHAR_T_H
218 #define _GCC_WCHAR_T
219
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
229    the same type." */
230 #ifdef _BSD_WCHAR_T_
231 #undef _BSD_WCHAR_T_
232 #ifdef _BSD_RUNE_T_
233 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
234 typedef _BSD_RUNE_T_ rune_t;
235 #endif
236 #endif
237 #endif
238
239 #ifndef __WCHAR_TYPE__
240 #define __WCHAR_TYPE__ int
241 #endif
242 #ifndef __cplusplus
243 typedef __WCHAR_TYPE__ wchar_t;
244 #endif
245 #endif
246 #endif
247 #endif
248 #endif
249 #endif
250 #endif
251 #endif
252 #endif
253 #endif
254 #endif
255 #endif
256 #endif
257 #undef  __need_wchar_t
258 #endif /* _STDDEF_H or __need_wchar_t.  */
259
260 #if defined (_STDDEF_H) || defined (__need_wint_t)
261 #ifndef _WINT_T
262 #define _WINT_T
263
264 #ifndef __WINT_TYPE__
265 #define __WINT_TYPE__ unsigned int
266 #endif
267 typedef __WINT_TYPE__ wint_t;
268 #endif
269 #undef __need_wint_t
270 #endif
271
272 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
273     are already defined.  */
274 #ifdef _ANSI_H_
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_
278 #undef _PTRDIFF_T_
279 #undef _BSD_PTRDIFF_T_
280 #endif
281 #ifdef _GCC_SIZE_T_
282 #undef _SIZE_T_
283 #undef _BSD_SIZE_T_
284 #endif
285 #ifdef _GCC_WCHAR_T_
286 #undef _WCHAR_T_
287 #undef _BSD_WCHAR_T_
288 #endif
289 /*  The following ones are the real ones.  */
290 #ifdef _GCC_PTRDIFF_T
291 #undef _PTRDIFF_T_
292 #undef _BSD_PTRDIFF_T_
293 #endif
294 #ifdef _GCC_SIZE_T
295 #undef _SIZE_T_
296 #undef _BSD_SIZE_T_
297 #endif
298 #ifdef _GCC_WCHAR_T
299 #undef _WCHAR_T_
300 #undef _BSD_WCHAR_T_
301 #endif
302 #endif /* _ANSI_H_ */
303
304 #endif /* __sys_stdtypes_h */
305
306 /* A null pointer constant.  */
307
308 #if defined (_STDDEF_H) || defined (__need_NULL)
309 #undef NULL             /* in case <stdio.h> has defined it. */
310 #ifdef __GNUG__
311 #define NULL __null
312 #else   /* G++ */
313 #define NULL ((void *)0)
314 #endif  /* G++ */
315 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
316 #undef  __need_NULL
317
318 #ifdef _STDDEF_H
319
320 /* Offset of member MEMBER in a struct of type TYPE.  */
321
322 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
323
324 #endif /* _STDDEF_H was defined this time */
325
326 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
327           || __need_XXX was not defined before */