OSDN Git Service

* ginclude/stddef.h (wint_t): Don't wrap with #ifndef __cplusplus.
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / stddef.h
1 #ifndef _STDDEF_H
2 #ifndef _STDDEF_H_
3 #ifndef _ANSI_STDDEF_H
4 #ifndef __STDDEF_H__
5
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)     \
11      && !defined(__need_wint_t))
12 #define _STDDEF_H
13 #define _STDDEF_H_
14 /* snaroff@next.com says the NeXT needs this.  */
15 #define _ANSI_STDDEF_H
16 /* Irix 5.1 needs this.  */
17 #define __STDDEF_H__
18 #endif
19
20 #ifndef __sys_stdtypes_h
21 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
22    There's no way to win with the other order!  Sun lossage.  */
23
24 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
25    one less case to deal with in the following.  */
26 #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
27 #include <machine/ansi.h>
28 #endif
29
30 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
31    defined if the corresponding type is *not* defined.
32    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
33 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
34 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
35 #define _SIZE_T
36 #endif
37 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
38 #define _PTRDIFF_T
39 #endif
40 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
41    instead of _WCHAR_T_. */
42 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
43 #ifndef _BSD_WCHAR_T_
44 #define _WCHAR_T
45 #endif
46 #endif
47 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
48 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
49 #undef _PTRDIFF_T_
50 #undef _BSD_PTRDIFF_T_
51 #endif
52 #if defined (__need_size_t) || defined (_STDDEF_H_)
53 #undef _SIZE_T_
54 #undef _BSD_SIZE_T_
55 #endif
56 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
57 #undef _WCHAR_T_
58 #undef _BSD_WCHAR_T_
59 #endif
60 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
61
62 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
63    Just ignore it.  */
64 #if defined (__sequent__) && defined (_PTRDIFF_T_)
65 #undef _PTRDIFF_T_
66 #endif
67
68 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
69    _TYPE_size_t which will typedef size_t.  fixincludes patched the
70    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
71    not defined, and so that defining this macro defines _GCC_SIZE_T.
72    If we find that the macros are still defined at this point, we must
73    invoke them so that the type is defined as expected.  */
74 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
75 _TYPE_ptrdiff_t;
76 #undef _TYPE_ptrdiff_t
77 #endif
78 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
79 _TYPE_size_t;
80 #undef _TYPE_size_t
81 #endif
82 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
83 _TYPE_wchar_t;
84 #undef _TYPE_wchar_t
85 #endif
86
87 /* In case nobody has defined these types, but we aren't running under
88    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
89    __WCHAR_TYPE__ have reasonable values.  This can happen if the
90    parts of GCC is compiled by an older compiler, that actually
91    include gstddef.h, such as collect2.  */
92
93 /* Signed type of difference of two pointers.  */
94
95 /* Define this type if we are doing the whole job,
96    or if we want this type in particular.  */
97 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
98 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
99 #ifndef _T_PTRDIFF_
100 #ifndef _T_PTRDIFF
101 #ifndef __PTRDIFF_T
102 #ifndef _PTRDIFF_T_
103 #ifndef _BSD_PTRDIFF_T_
104 #ifndef ___int_ptrdiff_t_h
105 #ifndef _GCC_PTRDIFF_T
106 #define _PTRDIFF_T
107 #define _T_PTRDIFF_
108 #define _T_PTRDIFF
109 #define __PTRDIFF_T
110 #define _PTRDIFF_T_
111 #define _BSD_PTRDIFF_T_
112 #define ___int_ptrdiff_t_h
113 #define _GCC_PTRDIFF_T
114 #ifndef __PTRDIFF_TYPE__
115 #define __PTRDIFF_TYPE__ long int
116 #endif
117 typedef __PTRDIFF_TYPE__ ptrdiff_t;
118 #endif /* _GCC_PTRDIFF_T */
119 #endif /* ___int_ptrdiff_t_h */
120 #endif /* _BSD_PTRDIFF_T_ */
121 #endif /* _PTRDIFF_T_ */
122 #endif /* __PTRDIFF_T */
123 #endif /* _T_PTRDIFF */
124 #endif /* _T_PTRDIFF_ */
125 #endif /* _PTRDIFF_T */
126
127 /* If this symbol has done its job, get rid of it.  */
128 #undef  __need_ptrdiff_t
129
130 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
131
132 /* Unsigned type of `sizeof' something.  */
133
134 /* Define this type if we are doing the whole job,
135    or if we want this type in particular.  */
136 #if defined (_STDDEF_H) || defined (__need_size_t)
137 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
138 #ifndef _SYS_SIZE_T_H
139 #ifndef _T_SIZE_
140 #ifndef _T_SIZE
141 #ifndef __SIZE_T
142 #ifndef _SIZE_T_
143 #ifndef _BSD_SIZE_T_
144 #ifndef _SIZE_T_DEFINED_
145 #ifndef _SIZE_T_DEFINED
146 #ifndef ___int_size_t_h
147 #ifndef _GCC_SIZE_T
148 #ifndef _SIZET_
149 #ifndef __size_t
150 #define _SIZE_T
151 #define _SYS_SIZE_T_H
152 #define _T_SIZE_
153 #define _T_SIZE
154 #define __SIZE_T
155 #define _SIZE_T_
156 #define _BSD_SIZE_T_
157 #define _SIZE_T_DEFINED_
158 #define _SIZE_T_DEFINED
159 #define ___int_size_t_h
160 #define _GCC_SIZE_T
161 #define _SIZET_
162 #define __size_t
163 #ifndef __SIZE_TYPE__
164 #define __SIZE_TYPE__ long unsigned int
165 #endif
166 #if !(defined (__GNUG__) && defined (size_t))
167 typedef __SIZE_TYPE__ size_t;
168 #endif /* !(defined (__GNUG__) && defined (size_t)) */
169 #endif /* __size_t */
170 #endif /* _SIZET_ */
171 #endif /* _GCC_SIZE_T */
172 #endif /* ___int_size_t_h */
173 #endif /* _SIZE_T_DEFINED */
174 #endif /* _SIZE_T_DEFINED_ */
175 #endif /* _BSD_SIZE_T_ */
176 #endif /* _SIZE_T_ */
177 #endif /* __SIZE_T */
178 #endif /* _T_SIZE */
179 #endif /* _T_SIZE_ */
180 #endif /* _SYS_SIZE_T_H */
181 #endif /* _SIZE_T */
182 #undef  __need_size_t
183 #endif /* _STDDEF_H or __need_size_t.  */
184
185
186 /* Wide character type.
187    Locale-writers should change this as necessary to
188    be big enough to hold unique values not between 0 and 127,
189    and not (wchar_t) -1, for each defined multibyte character.  */
190
191 /* Define this type if we are doing the whole job,
192    or if we want this type in particular.  */
193 #if defined (_STDDEF_H) || defined (__need_wchar_t)
194 #ifndef _WCHAR_T
195 #ifndef _T_WCHAR_
196 #ifndef _T_WCHAR
197 #ifndef __WCHAR_T
198 #ifndef _WCHAR_T_
199 #ifndef _BSD_WCHAR_T_
200 #ifndef _WCHAR_T_DEFINED_
201 #ifndef _WCHAR_T_DEFINED
202 #ifndef _WCHAR_T_H
203 #ifndef ___int_wchar_t_h
204 #ifndef __INT_WCHAR_T_H
205 #ifndef _GCC_WCHAR_T
206 #define _WCHAR_T
207 #define _T_WCHAR_
208 #define _T_WCHAR
209 #define __WCHAR_T
210 #define _WCHAR_T_
211 #define _BSD_WCHAR_T_
212 #define _WCHAR_T_DEFINED_
213 #define _WCHAR_T_DEFINED
214 #define _WCHAR_T_H
215 #define ___int_wchar_t_h
216 #define __INT_WCHAR_T_H
217 #define _GCC_WCHAR_T
218
219 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
220    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
221    symbols in the _FOO_T_ family, stays defined even after its
222    corresponding type is defined).  If we define wchar_t, then we
223    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
224    we undef _WCHAR_T_, then we must also define rune_t, since 
225    headers like runetype.h assume that if machine/ansi.h is included,
226    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
227    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
228    the same type." */
229 #ifdef _BSD_WCHAR_T_
230 #undef _BSD_WCHAR_T_
231 #ifdef _BSD_RUNE_T_
232 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
233 typedef _BSD_RUNE_T_ rune_t;
234 #endif
235 #endif
236 #endif
237
238 #ifndef __WCHAR_TYPE__
239 #define __WCHAR_TYPE__ int
240 #endif
241 #ifndef __cplusplus
242 typedef __WCHAR_TYPE__ wchar_t;
243 #endif
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 #undef  __need_wchar_t
257 #endif /* _STDDEF_H or __need_wchar_t.  */
258
259 #if defined (_STDDEF_H) || defined (__need_wint_t)
260 #ifndef _WINT_T
261 #define _WINT_T
262
263 #ifndef __WINT_TYPE__
264 #define __WINT_TYPE__ unsigned int
265 #endif
266 typedef __WINT_TYPE__ wint_t;
267 #endif
268 #endif
269
270 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
271     are already defined.  */
272 #ifdef _ANSI_H_
273 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
274     are probably typos and should be removed before 2.8 is released.  */
275 #ifdef _GCC_PTRDIFF_T_
276 #undef _PTRDIFF_T_
277 #undef _BSD_PTRDIFF_T_
278 #endif
279 #ifdef _GCC_SIZE_T_
280 #undef _SIZE_T_
281 #undef _BSD_SIZE_T_
282 #endif
283 #ifdef _GCC_WCHAR_T_
284 #undef _WCHAR_T_
285 #undef _BSD_WCHAR_T_
286 #endif
287 /*  The following ones are the real ones.  */
288 #ifdef _GCC_PTRDIFF_T
289 #undef _PTRDIFF_T_
290 #undef _BSD_PTRDIFF_T_
291 #endif
292 #ifdef _GCC_SIZE_T
293 #undef _SIZE_T_
294 #undef _BSD_SIZE_T_
295 #endif
296 #ifdef _GCC_WCHAR_T
297 #undef _WCHAR_T_
298 #undef _BSD_WCHAR_T_
299 #endif
300 #endif /* _ANSI_H_ */
301
302 #endif /* __sys_stdtypes_h */
303
304 /* A null pointer constant.  */
305
306 #if defined (_STDDEF_H) || defined (__need_NULL)
307 #undef NULL             /* in case <stdio.h> has defined it. */
308 #define NULL ((void *)0)
309 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
310 #undef  __need_NULL
311
312 #ifdef _STDDEF_H
313
314 /* Offset of member MEMBER in a struct of type TYPE.  */
315
316 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
317
318 #endif /* _STDDEF_H was defined this time */
319
320 #endif /* __STDDEF_H__ was not defined before */
321 #endif /* _ANSI_STDDEF_H was not defined before */
322 #endif /* _STDDEF_H_ was not defined before */
323 #endif /* _STDDEF_H was not defined before */