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__ /* BeOS */ 139 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */ 140 #ifndef _SYS_SIZE_T_H 141 #ifndef _T_SIZE_ 142 #ifndef _T_SIZE 143 #ifndef __SIZE_T 144 #ifndef _SIZE_T_ 145 #ifndef _BSD_SIZE_T_ 146 #ifndef _SIZE_T_DEFINED_ 147 #ifndef _SIZE_T_DEFINED 148 #ifndef ___int_size_t_h 149 #ifndef _GCC_SIZE_T 150 #ifndef _SIZET_ 151 #ifndef __size_t 152 #define __size_t__ /* BeOS */ 153 #define _SIZE_T 154 #define _SYS_SIZE_T_H 155 #define _T_SIZE_ 156 #define _T_SIZE 157 #define __SIZE_T 158 #define _SIZE_T_ 159 #define _BSD_SIZE_T_ 160 #define _SIZE_T_DEFINED_ 161 #define _SIZE_T_DEFINED 162 #define ___int_size_t_h 163 #define _GCC_SIZE_T 164 #define _SIZET_ 165 #define __size_t 166 #ifndef __SIZE_TYPE__ 167 #define __SIZE_TYPE__ long unsigned int 168 #endif 169 #if !(defined (__GNUG__) && defined (size_t)) 170 typedef __SIZE_TYPE__ size_t; 171 #if defined(__BEOS__) || defined(__HAIKU__) 172 typedef long ssize_t; 173 #endif /* __BEOS__ || __HAIKU__ */ 174 #endif /* !(defined (__GNUG__) && defined (size_t)) */ 175 #endif /* __size_t */ 176 #endif /* _SIZET_ */ 177 #endif /* _GCC_SIZE_T */ 178 #endif /* ___int_size_t_h */ 179 #endif /* _SIZE_T_DEFINED */ 180 #endif /* _SIZE_T_DEFINED_ */ 181 #endif /* _BSD_SIZE_T_ */ 182 #endif /* _SIZE_T_ */ 183 #endif /* __SIZE_T */ 184 #endif /* _T_SIZE */ 185 #endif /* _T_SIZE_ */ 186 #endif /* _SYS_SIZE_T_H */ 187 #endif /* _SIZE_T */ 188 #endif /* __size_t__ */ 189 #undef __need_size_t 190 #endif /* _STDDEF_H or __need_size_t. */ 191 192 193 /* Wide character type. 194 Locale-writers should change this as necessary to 195 be big enough to hold unique values not between 0 and 127, 196 and not (wchar_t) -1, for each defined multibyte character. */ 197 198 /* Define this type if we are doing the whole job, 199 or if we want this type in particular. */ 200 #if defined (_STDDEF_H) || defined (__need_wchar_t) 201 #ifndef __wchar_t__ /* BeOS */ 202 #ifndef _WCHAR_T 203 #ifndef _T_WCHAR_ 204 #ifndef _T_WCHAR 205 #ifndef __WCHAR_T 206 #ifndef _WCHAR_T_ 207 #ifndef _BSD_WCHAR_T_ 208 #ifndef _WCHAR_T_DEFINED_ 209 #ifndef _WCHAR_T_DEFINED 210 #ifndef _WCHAR_T_H 211 #ifndef ___int_wchar_t_h 212 #ifndef __INT_WCHAR_T_H 213 #ifndef _GCC_WCHAR_T 214 #define __wchar_t__ /* BeOS */ 215 #define _WCHAR_T 216 #define _T_WCHAR_ 217 #define _T_WCHAR 218 #define __WCHAR_T 219 #define _WCHAR_T_ 220 #define _BSD_WCHAR_T_ 221 #define _WCHAR_T_DEFINED_ 222 #define _WCHAR_T_DEFINED 223 #define _WCHAR_T_H 224 #define ___int_wchar_t_h 225 #define __INT_WCHAR_T_H 226 #define _GCC_WCHAR_T 227 228 /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ 229 instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other 230 symbols in the _FOO_T_ family, stays defined even after its 231 corresponding type is defined). If we define wchar_t, then we 232 must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if 233 we undef _WCHAR_T_, then we must also define rune_t, since 234 headers like runetype.h assume that if machine/ansi.h is included, 235 and _BSD_WCHAR_T_ is not defined, then rune_t is available. 236 machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of 237 the same type." */ 238 #ifdef _BSD_WCHAR_T_ 239 #undef _BSD_WCHAR_T_ 240 #ifdef _BSD_RUNE_T_ 241 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) 242 typedef _BSD_RUNE_T_ rune_t; 243 #endif 244 #endif 245 #endif 246 247 #ifndef __WCHAR_TYPE__ 248 #define __WCHAR_TYPE__ int 249 #endif 250 #ifndef __cplusplus 251 typedef __WCHAR_TYPE__ wchar_t; 252 #endif 253 #endif 254 #endif 255 #endif 256 #endif 257 #endif 258 #endif 259 #endif 260 #endif 261 #endif 262 #endif 263 #endif 264 #endif 265 #endif /* __wchar_t__ */ 266 #undef __need_wchar_t 267 #endif /* _STDDEF_H or __need_wchar_t. */ 268 269 #if defined (_STDDEF_H) || defined (__need_wint_t) 270 #ifndef _WINT_T 271 #define _WINT_T 272 273 #ifndef __WINT_TYPE__ 274 #define __WINT_TYPE__ unsigned int 275 #endif 276 typedef __WINT_TYPE__ wint_t; 277 #endif 278 #undef __need_wint_t 279 #endif 280 281 /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. 282 are already defined. */ 283 /* BSD/OS 3.1 requires the MACHINE_ANSI_H check here. FreeBSD 2.x apparently 284 does not, even though there is a check for MACHINE_ANSI_H above. */ 285 #if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_)) 286 /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ 287 are probably typos and should be removed before 2.8 is released. */ 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 /* The following ones are the real ones. */ 301 #ifdef _GCC_PTRDIFF_T 302 #undef _PTRDIFF_T_ 303 #undef _BSD_PTRDIFF_T_ 304 #endif 305 #ifdef _GCC_SIZE_T 306 #undef _SIZE_T_ 307 #undef _BSD_SIZE_T_ 308 #endif 309 #ifdef _GCC_WCHAR_T 310 #undef _WCHAR_T_ 311 #undef _BSD_WCHAR_T_ 312 #endif 313 #endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */ 314 315 #endif /* __sys_stdtypes_h */ 316 317 /* A null pointer constant. */ 318 319 #if defined (_STDDEF_H) || defined (__need_NULL) 320 #undef NULL /* in case <stdio.h> has defined it. */ 321 #ifdef __GNUG__ 322 #define NULL __null 323 #else /* G++ */ 324 #define NULL ((void *)0) 325 #endif /* G++ */ 326 #endif /* NULL not defined and <stddef.h> or need NULL. */ 327 #undef __need_NULL 328 329 #ifdef _STDDEF_H 330 331 /* Offset of member MEMBER in a struct of type TYPE. */ 332 333 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 334 335 #endif /* _STDDEF_H was defined this time */ 336 337 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ 338 || __need_XXX was not defined before */ 339