Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
stddef.h
Go to the documentation of this file.
00001 
00002 /*
00003 
00004   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00005 
00006   This program is free software; you can redistribute it and/or modify it
00007   under the terms of version 2 of the GNU General Public License as
00008   published by the Free Software Foundation.
00009 
00010   This program is distributed in the hope that it would be useful, but
00011   WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00013 
00014   Further, this software is distributed without any warranty that it is
00015   free of the rightful claim of any third person regarding infringement 
00016   or the like.  Any license provided herein, whether implied or 
00017   otherwise, applies only to this software file.  Patent licenses, if 
00018   any, provided herein do not apply to combinations of this program with 
00019   other software, or any other product whatsoever.  
00020 
00021   You should have received a copy of the GNU General Public License along
00022   with this program; if not, write the Free Software Foundation, Inc., 59
00023   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
00037      && !defined(__STDDEF_H__)) \
00038     || defined(__need_wchar_t) || defined(__need_size_t) \
00039     || defined(__need_ptrdiff_t) || defined(__need_NULL) \
00040     || defined(__need_wint_t)
00041 
00042 /* Any one of these symbols __need_* means that GNU libc
00043    wants us just to define one data type.  So don't define
00044    the symbols that indicate this file's entire job has been done.  */
00045 #if (!defined(__need_wchar_t) && !defined(__need_size_t)        \
00046      && !defined(__need_ptrdiff_t) && !defined(__need_NULL)     \
00047      && !defined(__need_wint_t))
00048 #define _STDDEF_H
00049 #define _STDDEF_H_
00050 /* [email protected] says the NeXT needs this.  */
00051 #define _ANSI_STDDEF_H
00052 /* Irix 5.1 needs this.  */
00053 #define __STDDEF_H__
00054 #endif
00055 
00056 #ifndef __sys_stdtypes_h
00057 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
00058    There's no way to win with the other order!  Sun lossage.  */
00059 
00060 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
00061    one less case to deal with in the following.  */
00062 #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
00063 #include <machine/ansi.h>
00064 #endif
00065 
00066 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
00067    defined if the corresponding type is *not* defined.
00068    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
00069 #if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
00070 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
00071 #define _SIZE_T
00072 #endif
00073 #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
00074 #define _PTRDIFF_T
00075 #endif
00076 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
00077    instead of _WCHAR_T_. */
00078 #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
00079 #ifndef _BSD_WCHAR_T_
00080 #define _WCHAR_T
00081 #endif
00082 #endif
00083 /* Undef _FOO_T_ if we are supposed to define foo_t.  */
00084 #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
00085 #undef _PTRDIFF_T_
00086 #undef _BSD_PTRDIFF_T_
00087 #endif
00088 #if defined (__need_size_t) || defined (_STDDEF_H_)
00089 #undef _SIZE_T_
00090 #undef _BSD_SIZE_T_
00091 #endif
00092 #if defined (__need_wchar_t) || defined (_STDDEF_H_)
00093 #undef _WCHAR_T_
00094 #undef _BSD_WCHAR_T_
00095 #endif
00096 #endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
00097 
00098 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
00099    Just ignore it.  */
00100 #if defined (__sequent__) && defined (_PTRDIFF_T_)
00101 #undef _PTRDIFF_T_
00102 #endif
00103 
00104 /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
00105    _TYPE_size_t which will typedef size_t.  fixincludes patched the
00106    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
00107    not defined, and so that defining this macro defines _GCC_SIZE_T.
00108    If we find that the macros are still defined at this point, we must
00109    invoke them so that the type is defined as expected.  */
00110 #if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
00111 _TYPE_ptrdiff_t;
00112 #undef _TYPE_ptrdiff_t
00113 #endif
00114 #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
00115 _TYPE_size_t;
00116 #undef _TYPE_size_t
00117 #endif
00118 #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
00119 _TYPE_wchar_t;
00120 #undef _TYPE_wchar_t
00121 #endif
00122 
00123 /* In case nobody has defined these types, but we aren't running under
00124    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
00125    __WCHAR_TYPE__ have reasonable values.  This can happen if the
00126    parts of GCC is compiled by an older compiler, that actually
00127    include gstddef.h, such as collect2.  */
00128 
00129 /* Signed type of difference of two pointers.  */
00130 
00131 /* Define this type if we are doing the whole job,
00132    or if we want this type in particular.  */
00133 #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
00134 #ifndef _PTRDIFF_T      /* in case <sys/types.h> has defined it. */
00135 #ifndef _T_PTRDIFF_
00136 #ifndef _T_PTRDIFF
00137 #ifndef __PTRDIFF_T
00138 #ifndef _PTRDIFF_T_
00139 #ifndef _BSD_PTRDIFF_T_
00140 #ifndef ___int_ptrdiff_t_h
00141 #ifndef _GCC_PTRDIFF_T
00142 #define _PTRDIFF_T
00143 #define _T_PTRDIFF_
00144 #define _T_PTRDIFF
00145 #define __PTRDIFF_T
00146 #define _PTRDIFF_T_
00147 #define _BSD_PTRDIFF_T_
00148 #define ___int_ptrdiff_t_h
00149 #define _GCC_PTRDIFF_T
00150 #ifndef __PTRDIFF_TYPE__
00151 #define __PTRDIFF_TYPE__ long int
00152 #endif
00153 typedef __PTRDIFF_TYPE__ ptrdiff_t;
00154 #endif /* _GCC_PTRDIFF_T */
00155 #endif /* ___int_ptrdiff_t_h */
00156 #endif /* _BSD_PTRDIFF_T_ */
00157 #endif /* _PTRDIFF_T_ */
00158 #endif /* __PTRDIFF_T */
00159 #endif /* _T_PTRDIFF */
00160 #endif /* _T_PTRDIFF_ */
00161 #endif /* _PTRDIFF_T */
00162 
00163 /* If this symbol has done its job, get rid of it.  */
00164 #undef  __need_ptrdiff_t
00165 
00166 #endif /* _STDDEF_H or __need_ptrdiff_t.  */
00167 
00168 /* Unsigned type of `sizeof' something.  */
00169 
00170 /* Define this type if we are doing the whole job,
00171    or if we want this type in particular.  */
00172 #if defined (_STDDEF_H) || defined (__need_size_t)
00173 #ifndef __size_t__      /* BeOS */
00174 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
00175 #ifndef _SYS_SIZE_T_H
00176 #ifndef _T_SIZE_
00177 #ifndef _T_SIZE
00178 #ifndef __SIZE_T
00179 #ifndef _SIZE_T_
00180 #ifndef _BSD_SIZE_T_
00181 #ifndef _SIZE_T_DEFINED_
00182 #ifndef _SIZE_T_DEFINED
00183 #ifndef ___int_size_t_h
00184 #ifndef _GCC_SIZE_T
00185 #ifndef _SIZET_
00186 #ifndef __size_t
00187 #define __size_t__      /* BeOS */
00188 #define _SIZE_T
00189 #define _SYS_SIZE_T_H
00190 #define _T_SIZE_
00191 #define _T_SIZE
00192 #define __SIZE_T
00193 #define _SIZE_T_
00194 #define _BSD_SIZE_T_
00195 #define _SIZE_T_DEFINED_
00196 #define _SIZE_T_DEFINED
00197 #define ___int_size_t_h
00198 #define _GCC_SIZE_T
00199 #define _SIZET_
00200 #define __size_t
00201 #ifndef __SIZE_TYPE__
00202 #define __SIZE_TYPE__ long unsigned int
00203 #endif
00204 #if !(defined (__GNUG__) && defined (size_t))
00205 typedef __SIZE_TYPE__ size_t;
00206 #ifdef __BEOS__
00207 typedef long ssize_t;
00208 #endif /* __BEOS__ */
00209 #endif /* !(defined (__GNUG__) && defined (size_t)) */
00210 #endif /* __size_t */
00211 #endif /* _SIZET_ */
00212 #endif /* _GCC_SIZE_T */
00213 #endif /* ___int_size_t_h */
00214 #endif /* _SIZE_T_DEFINED */
00215 #endif /* _SIZE_T_DEFINED_ */
00216 #endif /* _BSD_SIZE_T_ */
00217 #endif /* _SIZE_T_ */
00218 #endif /* __SIZE_T */
00219 #endif /* _T_SIZE */
00220 #endif /* _T_SIZE_ */
00221 #endif /* _SYS_SIZE_T_H */
00222 #endif /* _SIZE_T */
00223 #endif /* __size_t__ */
00224 #undef  __need_size_t
00225 #endif /* _STDDEF_H or __need_size_t.  */
00226 
00227 
00228 /* Wide character type.
00229    Locale-writers should change this as necessary to
00230    be big enough to hold unique values not between 0 and 127,
00231    and not (wchar_t) -1, for each defined multibyte character.  */
00232 
00233 /* Define this type if we are doing the whole job,
00234    or if we want this type in particular.  */
00235 #if defined (_STDDEF_H) || defined (__need_wchar_t)
00236 #ifndef __wchar_t__     /* BeOS */
00237 #ifndef _WCHAR_T
00238 #ifndef _T_WCHAR_
00239 #ifndef _T_WCHAR
00240 #ifndef __WCHAR_T
00241 #ifndef _WCHAR_T_
00242 #ifndef _BSD_WCHAR_T_
00243 #ifndef _WCHAR_T_DEFINED_
00244 #ifndef _WCHAR_T_DEFINED
00245 #ifndef _WCHAR_T_H
00246 #ifndef ___int_wchar_t_h
00247 #ifndef __INT_WCHAR_T_H
00248 #ifndef _GCC_WCHAR_T
00249 #define __wchar_t__     /* BeOS */
00250 #define _WCHAR_T
00251 #define _T_WCHAR_
00252 #define _T_WCHAR
00253 #define __WCHAR_T
00254 #define _WCHAR_T_
00255 #define _BSD_WCHAR_T_
00256 #define _WCHAR_T_DEFINED_
00257 #define _WCHAR_T_DEFINED
00258 #define _WCHAR_T_H
00259 #define ___int_wchar_t_h
00260 #define __INT_WCHAR_T_H
00261 #define _GCC_WCHAR_T
00262 
00263 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
00264    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
00265    symbols in the _FOO_T_ family, stays defined even after its
00266    corresponding type is defined).  If we define wchar_t, then we
00267    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
00268    we undef _WCHAR_T_, then we must also define rune_t, since 
00269    headers like runetype.h assume that if machine/ansi.h is included,
00270    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
00271    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
00272    the same type." */
00273 #ifdef _BSD_WCHAR_T_
00274 #undef _BSD_WCHAR_T_
00275 #ifdef _BSD_RUNE_T_
00276 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
00277 typedef _BSD_RUNE_T_ rune_t;
00278 #endif
00279 #endif
00280 #endif
00281 
00282 #ifndef __WCHAR_TYPE__
00283 #ifdef __BEOS__
00284 #define __WCHAR_TYPE__ unsigned char
00285 #else
00286 #define __WCHAR_TYPE__ int
00287 #endif
00288 #endif
00289 #ifndef __cplusplus
00290 typedef __WCHAR_TYPE__ wchar_t;
00291 #endif
00292 #endif
00293 #endif
00294 #endif
00295 #endif
00296 #endif
00297 #endif
00298 #endif
00299 #endif
00300 #endif
00301 #endif
00302 #endif
00303 #endif
00304 #endif /* __wchar_t__ */
00305 #undef  __need_wchar_t
00306 #endif /* _STDDEF_H or __need_wchar_t.  */
00307 
00308 #if defined (_STDDEF_H) || defined (__need_wint_t)
00309 #ifndef _WINT_T
00310 #define _WINT_T
00311 
00312 #ifndef __WINT_TYPE__
00313 #define __WINT_TYPE__ unsigned int
00314 #endif
00315 typedef __WINT_TYPE__ wint_t;
00316 #endif
00317 #undef __need_wint_t
00318 #endif
00319 
00320 /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
00321     are already defined.  */
00322 /*  BSD/OS 3.1 requires the MACHINE_ANSI_H check here.  FreeBSD 2.x apparently
00323     does not, even though there is a check for MACHINE_ANSI_H above.  */
00324 #if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_))
00325 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
00326     are probably typos and should be removed before 2.8 is released.  */
00327 #ifdef _GCC_PTRDIFF_T_
00328 #undef _PTRDIFF_T_
00329 #undef _BSD_PTRDIFF_T_
00330 #endif
00331 #ifdef _GCC_SIZE_T_
00332 #undef _SIZE_T_
00333 #undef _BSD_SIZE_T_
00334 #endif
00335 #ifdef _GCC_WCHAR_T_
00336 #undef _WCHAR_T_
00337 #undef _BSD_WCHAR_T_
00338 #endif
00339 /*  The following ones are the real ones.  */
00340 #ifdef _GCC_PTRDIFF_T
00341 #undef _PTRDIFF_T_
00342 #undef _BSD_PTRDIFF_T_
00343 #endif
00344 #ifdef _GCC_SIZE_T
00345 #undef _SIZE_T_
00346 #undef _BSD_SIZE_T_
00347 #endif
00348 #ifdef _GCC_WCHAR_T
00349 #undef _WCHAR_T_
00350 #undef _BSD_WCHAR_T_
00351 #endif
00352 #endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */
00353 
00354 #endif /* __sys_stdtypes_h */
00355 
00356 /* A null pointer constant.  */
00357 
00358 #if defined (_STDDEF_H) || defined (__need_NULL)
00359 #undef NULL             /* in case <stdio.h> has defined it. */
00360 #ifdef __GNUG__
00361 #define NULL __null
00362 #else   /* G++ */
00363 #define NULL ((void *)0)
00364 #endif  /* G++ */
00365 #endif  /* NULL not defined and <stddef.h> or need NULL.  */
00366 #undef  __need_NULL
00367 
00368 #ifdef _STDDEF_H
00369 
00370 /* Offset of member MEMBER in a struct of type TYPE.  */
00371 #ifdef offsetof
00372 #undef offsetof
00373 #endif
00374 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00375 
00376 #endif /* _STDDEF_H was defined this time */
00377 
00378 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
00379           || __need_XXX was not defined before */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines