Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / palacios / include / palacios / vmm_stddef.h
1 /* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING.  If not, write to
17 the Free Software Foundation, 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.  */
19
20 /* As a special exception, if you include this header file into source
21    files compiled by GCC, this header file does not by itself cause
22    the resulting executable to be covered by the GNU General Public
23    License.  This exception does not however invalidate any other
24    reasons why the executable file might be covered by the GNU General
25    Public License.  */
26
27 /*
28  * ISO C Standard:  7.17  Common definitions  <stddef.h>
29  */
30 #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
31      && !defined(__STDDEF_H__)) \
32     || defined(__need_wchar_t) || defined(__need_size_t) \
33     || defined(__need_ptrdiff_t) || defined(__need_NULL) \
34     || defined(__need_wint_t)
35
36 /* Any one of these symbols __need_* means that GNU libc
37    wants us just to define one data type.  So don't define
38    the symbols that indicate this file's entire job has been done.  */
39 #if (!defined(__need_wchar_t) && !defined(__need_size_t)        \
40      && !defined(__need_ptrdiff_t) && !defined(__need_NULL)     \
41      && !defined(__need_wint_t))
42 #define _STDDEF_H
43 #define _STDDEF_H_
44 /* snaroff@next.com says the NeXT needs this.  */
45 #define _ANSI_STDDEF_H
46 /* Irix 5.1 needs this.  */
47 #define __STDDEF_H__
48 #endif
49
50 #ifndef __sys_stdtypes_h
51 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
52    There's no way to win with the other order!  Sun lossage.  */
53
54 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
55    one less case to deal with in the following.  */
56 #if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
57 #include <machine/ansi.h>
58 #endif
59 /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
60 #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
61 #include <sys/_types.h>
62 #endif
63
64 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
65    defined if the corresponding type is *not* defined.
66    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
67 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
68 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
69 #define _SIZE_T
70 #endif
71 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
72 #define _PTRDIFF_T
73 #endif
74 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
75    instead of _WCHAR_T_. */
76 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
77 #ifndef _BSD_WCHAR_T_
78 #define _WCHAR_T
79 #endif
80 #endif
81 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
82 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
83 #undef _PTRDIFF_T_
84 #undef _BSD_PTRDIFF_T_
85 #endif
86 #if defined (__need_size_t) || defined (_STDDEF_H_)
87 #undef _SIZE_T_
88 #undef _BSD_SIZE_T_
89 #endif
90 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
91 #undef _WCHAR_T_
92 #undef _BSD_WCHAR_T_
93 #endif
94 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
95
96 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
97    Just ignore it.  */
98 #if defined (__sequent__) && defined (_PTRDIFF_T_)
99 #undef _PTRDIFF_T_
100 #endif
101
102 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
103    _TYPE_size_t which will typedef size_t.  fixincludes patched the
104    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
105    not defined, and so that defining this macro defines _GCC_SIZE_T.
106    If we find that the macros are still defined at this point, we must
107    invoke them so that the type is defined as expected.  */
108 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
109 _TYPE_ptrdiff_t;
110 #undef _TYPE_ptrdiff_t
111 #endif
112 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
113 _TYPE_size_t;
114 #undef _TYPE_size_t
115 #endif
116 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
117 _TYPE_wchar_t;
118 #undef _TYPE_wchar_t
119 #endif
120
121 /* In case nobody has defined these types, but we aren't running under
122    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
123    __WCHAR_TYPE__ have reasonable values.  This can happen if the
124    parts of GCC is compiled by an older compiler, that actually
125    include gstddef.h, such as collect2.  */
126
127 /* Signed type of difference of two pointers.  */
128
129 /* Define this type if we are doing the whole job,
130    or if we want this type in particular.  */
131 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
132 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
133 #ifndef _T_PTRDIFF_
134 #ifndef _T_PTRDIFF
135 #ifndef __PTRDIFF_T
136 #ifndef _PTRDIFF_T_
137 #ifndef _BSD_PTRDIFF_T_
138 #ifndef ___int_ptrdiff_t_h
139 #ifndef _GCC_PTRDIFF_T
140 #define _PTRDIFF_T
141 #define _T_PTRDIFF_
142 #define _T_PTRDIFF
143 #define __PTRDIFF_T
144 #define _PTRDIFF_T_
145 #define _BSD_PTRDIFF_T_
146 #define ___int_ptrdiff_t_h
147 #define _GCC_PTRDIFF_T
148 #ifndef __PTRDIFF_TYPE__
149 #define __PTRDIFF_TYPE__ long int
150 #endif
151 typedef __PTRDIFF_TYPE__ ptrdiff_t;
152 #endif /* _GCC_PTRDIFF_T */
153 #endif /* ___int_ptrdiff_t_h */
154 #endif /* _BSD_PTRDIFF_T_ */
155 #endif /* _PTRDIFF_T_ */
156 #endif /* __PTRDIFF_T */
157 #endif /* _T_PTRDIFF */
158 #endif /* _T_PTRDIFF_ */
159 #endif /* _PTRDIFF_T */
160
161 /* If this symbol has done its job, get rid of it.  */
162 #undef  __need_ptrdiff_t
163
164 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
165
166 /* Unsigned type of `sizeof' something.  */
167
168 /* Define this type if we are doing the whole job,
169    or if we want this type in particular.  */
170 #if defined (_STDDEF_H) || defined (__need_size_t)
171 #ifndef __size_t__      /* BeOS */
172 #ifndef __SIZE_T__      /* Cray Unicos/Mk */
173 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
174 #ifndef _SYS_SIZE_T_H
175 #ifndef _T_SIZE_
176 #ifndef _T_SIZE
177 #ifndef __SIZE_T
178 #ifndef _SIZE_T_
179 #ifndef _BSD_SIZE_T_
180 #ifndef _SIZE_T_DEFINED_
181 #ifndef _SIZE_T_DEFINED
182 #ifndef _BSD_SIZE_T_DEFINED_    /* Darwin */
183 #ifndef _SIZE_T_DECLARED        /* FreeBSD 5 */
184 #ifndef ___int_size_t_h
185 #ifndef _GCC_SIZE_T
186 #ifndef _SIZET_
187 #ifndef __size_t
188 #define __size_t__      /* BeOS */
189 #define __SIZE_T__      /* Cray Unicos/Mk */
190 #define _SIZE_T
191 #define _SYS_SIZE_T_H
192 #define _T_SIZE_
193 #define _T_SIZE
194 #define __SIZE_T
195 #define _SIZE_T_
196 #define _BSD_SIZE_T_
197 #define _SIZE_T_DEFINED_
198 #define _SIZE_T_DEFINED
199 #define _BSD_SIZE_T_DEFINED_    /* Darwin */
200 #define _SIZE_T_DECLARED        /* FreeBSD 5 */
201 #define ___int_size_t_h
202 #define _GCC_SIZE_T
203 #define _SIZET_
204 #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
205 /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
206 #else
207 #define __size_t
208 #endif
209 #ifndef __SIZE_TYPE__
210 #define __SIZE_TYPE__ long unsigned int
211 #endif
212 #if !(defined (__GNUG__) && defined (size_t))
213 typedef __SIZE_TYPE__ size_t;
214 #ifdef __BEOS__
215 typedef long ssize_t;
216 #endif /* __BEOS__ */
217 #endif /* !(defined (__GNUG__) && defined (size_t)) */
218 #endif /* __size_t */
219 #endif /* _SIZET_ */
220 #endif /* _GCC_SIZE_T */
221 #endif /* ___int_size_t_h */
222 #endif /* _SIZE_T_DECLARED */
223 #endif /* _BSD_SIZE_T_DEFINED_ */
224 #endif /* _SIZE_T_DEFINED */
225 #endif /* _SIZE_T_DEFINED_ */
226 #endif /* _BSD_SIZE_T_ */
227 #endif /* _SIZE_T_ */
228 #endif /* __SIZE_T */
229 #endif /* _T_SIZE */
230 #endif /* _T_SIZE_ */
231 #endif /* _SYS_SIZE_T_H */
232 #endif /* _SIZE_T */
233 #endif /* __SIZE_T__ */
234 #endif /* __size_t__ */
235 #undef  __need_size_t
236 #endif /* _STDDEF_H or __need_size_t.  */
237
238
239 /* Wide character type.
240    Locale-writers should change this as necessary to
241    be big enough to hold unique values not between 0 and 127,
242    and not (wchar_t) -1, for each defined multibyte character.  */
243
244 /* Define this type if we are doing the whole job,
245    or if we want this type in particular.  */
246 #if defined (_STDDEF_H) || defined (__need_wchar_t)
247 #ifndef __wchar_t__     /* BeOS */
248 #ifndef __WCHAR_T__     /* Cray Unicos/Mk */
249 #ifndef _WCHAR_T
250 #ifndef _T_WCHAR_
251 #ifndef _T_WCHAR
252 #ifndef __WCHAR_T
253 #ifndef _WCHAR_T_
254 #ifndef _BSD_WCHAR_T_
255 #ifndef _BSD_WCHAR_T_DEFINED_    /* Darwin */
256 #ifndef _BSD_RUNE_T_DEFINED_    /* Darwin */
257 #ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
258 #ifndef _WCHAR_T_DEFINED_
259 #ifndef _WCHAR_T_DEFINED
260 #ifndef _WCHAR_T_H
261 #ifndef ___int_wchar_t_h
262 #ifndef __INT_WCHAR_T_H
263 #ifndef _GCC_WCHAR_T
264 #define __wchar_t__     /* BeOS */
265 #define __WCHAR_T__     /* Cray Unicos/Mk */
266 #define _WCHAR_T
267 #define _T_WCHAR_
268 #define _T_WCHAR
269 #define __WCHAR_T
270 #define _WCHAR_T_
271 #define _BSD_WCHAR_T_
272 #define _WCHAR_T_DEFINED_
273 #define _WCHAR_T_DEFINED
274 #define _WCHAR_T_H
275 #define ___int_wchar_t_h
276 #define __INT_WCHAR_T_H
277 #define _GCC_WCHAR_T
278 #define _WCHAR_T_DECLARED
279
280 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
281    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
282    symbols in the _FOO_T_ family, stays defined even after its
283    corresponding type is defined).  If we define wchar_t, then we
284    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
285    we undef _WCHAR_T_, then we must also define rune_t, since 
286    headers like runetype.h assume that if machine/ansi.h is included,
287    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
288    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
289    the same type." */
290 #ifdef _BSD_WCHAR_T_
291 #undef _BSD_WCHAR_T_
292 #ifdef _BSD_RUNE_T_
293 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
294 typedef _BSD_RUNE_T_ rune_t;
295 #define _BSD_WCHAR_T_DEFINED_
296 #define _BSD_RUNE_T_DEFINED_    /* Darwin */
297 #if defined (__FreeBSD__) && (__FreeBSD__ < 5)
298 /* Why is this file so hard to maintain properly?  In constrast to
299    the comment above regarding BSD/386 1.1, on FreeBSD for as long
300    as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
301    redundant typedefs will occur when stdlib.h is included after this file. */
302 #undef _BSD_RUNE_T_
303 #endif
304 #endif
305 #endif
306 #endif
307 /* FreeBSD 5 can't be handled well using "traditional" logic above
308    since it no longer defines _BSD_RUNE_T_ yet still desires to export
309    rune_t in some cases... */
310 #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
311 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
312 #if __BSD_VISIBLE
313 #ifndef _RUNE_T_DECLARED
314 typedef __rune_t        rune_t;
315 #define _RUNE_T_DECLARED
316 #endif
317 #endif
318 #endif
319 #endif
320
321 #ifndef __WCHAR_TYPE__
322 #define __WCHAR_TYPE__ int
323 #endif
324 #ifndef __cplusplus
325 typedef __WCHAR_TYPE__ wchar_t;
326 #endif
327 #endif
328 #endif
329 #endif
330 #endif
331 #endif
332 #endif
333 #endif /* _WCHAR_T_DECLARED */
334 #endif /* _BSD_RUNE_T_DEFINED_ */
335 #endif
336 #endif
337 #endif
338 #endif
339 #endif
340 #endif
341 #endif
342 #endif /* __WCHAR_T__ */
343 #endif /* __wchar_t__ */
344 #undef  __need_wchar_t
345 #endif /* _STDDEF_H or __need_wchar_t.  */
346
347 #if defined (__need_wint_t)
348 #ifndef _WINT_T
349 #define _WINT_T
350
351 #ifndef __WINT_TYPE__
352 #define __WINT_TYPE__ unsigned int
353 #endif
354 typedef __WINT_TYPE__ wint_t;
355 #endif
356 #undef __need_wint_t
357 #endif
358
359 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
360     are already defined.  */
361 /*  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.  */
362 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
363 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
364     are probably typos and should be removed before 2.8 is released.  */
365 #ifdef _GCC_PTRDIFF_T_
366 #undef _PTRDIFF_T_
367 #undef _BSD_PTRDIFF_T_
368 #endif
369 #ifdef _GCC_SIZE_T_
370 #undef _SIZE_T_
371 #undef _BSD_SIZE_T_
372 #endif
373 #ifdef _GCC_WCHAR_T_
374 #undef _WCHAR_T_
375 #undef _BSD_WCHAR_T_
376 #endif
377 /*  The following ones are the real ones.  */
378 #ifdef _GCC_PTRDIFF_T
379 #undef _PTRDIFF_T_
380 #undef _BSD_PTRDIFF_T_
381 #endif
382 #ifdef _GCC_SIZE_T
383 #undef _SIZE_T_
384 #undef _BSD_SIZE_T_
385 #endif
386 #ifdef _GCC_WCHAR_T
387 #undef _WCHAR_T_
388 #undef _BSD_WCHAR_T_
389 #endif
390 #endif /* _ANSI_H_ || _MACHINE_ANSI_H_ */
391
392 #endif /* __sys_stdtypes_h */
393
394 /* A null pointer constant.  */
395
396 #if defined (_STDDEF_H) || defined (__need_NULL)
397 #undef NULL             /* in case <stdio.h> has defined it. */
398 #ifdef __GNUG__
399 #define NULL __null
400 #else   /* G++ */
401 #ifndef __cplusplus
402 #define NULL ((void *)0)
403 #else   /* C++ */
404 #define NULL 0
405 #endif  /* C++ */
406 #endif  /* G++ */
407 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
408 #undef  __need_NULL
409
410 #ifdef _STDDEF_H
411
412 /* Offset of member MEMBER in a struct of type TYPE. */
413 #ifndef __cplusplus
414 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
415 #else
416 /* The cast to "char &" below avoids problems with user-defined
417    "operator &", which can appear in a POD type.  */
418 #define offsetof(TYPE, MEMBER)                                  \
419   (__offsetof__ (reinterpret_cast <size_t>                      \
420                  (&reinterpret_cast <const volatile char &>     \
421                   (static_cast<TYPE *> (0)->MEMBER))))
422 #endif /* C++ */
423 #endif /* _STDDEF_H was defined this time */
424
425 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
426           || __need_XXX was not defined before */