home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / useful / lib / gcc-lib / amigados / 2.4.5 / include / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-24  |  6.4 KB  |  235 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4.  
  5. #ifdef amigados
  6. /* GNU libc has special support in this file, 4.3bsd-net2 libc deserves that
  7.    just as well. The system headers are ANSI compliant, the used compiler IS
  8.    gcc, so it's really ok to use the system header, no reason to hassle
  9.    with a jungle of ifdefs. Besides, amigados is only defined if compiling
  10.    with host=amigados, it doesn't apply if compiling with target=amigados
  11.    on a different host with possibly different system headers. Same thing
  12.    would apply to gstdarg.h and gvarargs.h, but those headers are more
  13.    easily fixable than this one and I'm sick of writing the same comment
  14.    there as well. MW */
  15. #include <stddef.h>
  16.  
  17. #else /* not amigados */
  18.  
  19. /* Any one of these symbols __need_* means that GNU libc
  20.    wants us just to define one data type.  So don't define
  21.    the symbols that indicate this file's entire job has been done.  */
  22. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  23.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  24. #define _STDDEF_H
  25. #define _STDDEF_H_
  26. /* snaroff@next.com says the NeXT needs this.  */
  27. #define _ANSI_STDDEF_H
  28. #endif
  29.  
  30. #ifndef __sys_stdtypes_h
  31. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  32.    There's no way to win with the other order!  Sun lossage.  */
  33.  
  34. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  35.    one less case to deal with in the following.  */
  36. #if defined (__BSD_NET2__) || defined (____386BSD____)
  37. #include <machine/ansi.h>
  38. #endif
  39.  
  40. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  41.     defined if the corresponding type is *not* defined.  */
  42. #ifdef _ANSI_H_
  43. #ifndef _SIZE_T_
  44. #define _SIZE_T
  45. #endif
  46. #ifndef _PTRDIFF_T_
  47. #define _PTRDIFF_T
  48. #endif
  49. #ifndef _WCHAR_T_
  50. #define _WCHAR_T
  51. #endif
  52. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  53. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  54. #undef _PTRDIFF_T_
  55. #endif
  56. #if defined (__need_size_t) || defined (_STDDEF_H_)
  57. #undef _SIZE_T_
  58. #endif
  59. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  60. #undef _WCHAR_T_
  61. #endif
  62. #endif /* _ANSI_H_ */
  63.  
  64. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  65.    Just ignore it.  */
  66. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  67. #undef _PTRDIFF_T_
  68. #endif
  69.  
  70. /* In case nobody has defined these types, but we aren't running under
  71.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  72.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  73.    parts of GCC is compiled by an older compiler, that actually
  74.    include gstddef.h, such as collect2.  */
  75.  
  76. /* Signed type of difference of two pointers.  */
  77.  
  78. /* Define this type if we are doing the whole job,
  79.    or if we want this type in particular.  */
  80. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  81. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  82. #ifndef _T_PTRDIFF_
  83. #ifndef _T_PTRDIFF
  84. #ifndef __PTRDIFF_T
  85. #ifndef _PTRDIFF_T_
  86. #ifndef ___int_ptrdiff_t_h
  87. #ifndef _GCC_PTRDIFF_T
  88. #define _PTRDIFF_T
  89. #define _T_PTRDIFF_
  90. #define _T_PTRDIFF
  91. #define __PTRDIFF_T
  92. #define _PTRDIFF_T_
  93. #define ___int_ptrdiff_t_h
  94. #define _GCC_PTRDIFF_T
  95. #ifndef __PTRDIFF_TYPE__
  96. #define __PTRDIFF_TYPE__ long int
  97. #endif
  98. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  99. #endif /* _GCC_PTRDIFF_T */
  100. #endif /* ___int_ptrdiff_t_h */
  101. #endif /* _PTRDIFF_T_ */
  102. #endif /* __PTRDIFF_T */
  103. #endif /* _T_PTRDIFF */
  104. #endif /* _T_PTRDIFF_ */
  105. #endif /* _PTRDIFF_T */
  106.  
  107. /* If this symbol has done its job, get rid of it.  */
  108. #undef    __need_ptrdiff_t
  109.  
  110. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  111.  
  112. /* Unsigned type of `sizeof' something.  */
  113.  
  114. /* Define this type if we are doing the whole job,
  115.    or if we want this type in particular.  */
  116. #if defined (_STDDEF_H) || defined (__need_size_t)
  117. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  118. #ifndef _SYS_SIZE_T_H
  119. #ifndef _T_SIZE_
  120. #ifndef _T_SIZE
  121. #ifndef __SIZE_T
  122. #ifndef _SIZE_T_
  123. #ifndef ___int_size_t_h
  124. #ifndef _GCC_SIZE_T
  125. #ifndef _SIZET_
  126. #define _SIZE_T
  127. #define _SYS_SIZE_T_H
  128. #define _T_SIZE_
  129. #define _T_SIZE
  130. #define __SIZE_T
  131. #define _SIZE_T_
  132. #define ___int_size_t_h
  133. #define _GCC_SIZE_T
  134. #define _SIZET_
  135. #ifndef __SIZE_TYPE__
  136. #define __SIZE_TYPE__ long unsigned int
  137. #endif
  138. #if !(defined (__GNUG__) && defined (size_t))
  139. typedef __SIZE_TYPE__ size_t;
  140. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  141. #endif /* _SIZET_ */
  142. #endif /* _GCC_SIZE_T */
  143. #endif /* ___int_size_t_h */
  144. #endif /* _SIZE_T_ */
  145. #endif /* __SIZE_T */
  146. #endif /* _T_SIZE */
  147. #endif /* _T_SIZE_ */
  148. #endif /* _SYS_SIZE_T_H */
  149. #endif /* _SIZE_T */
  150. #undef    __need_size_t
  151. #endif /* _STDDEF_H or __need_size_t.  */
  152.  
  153.  
  154. /* Wide character type.
  155.    Locale-writers should change this as necessary to
  156.    be big enough to hold unique values not between 0 and 127,
  157.    and not (wchar_t) -1, for each defined multibyte character.  */
  158.  
  159. /* Define this type if we are doing the whole job,
  160.    or if we want this type in particular.  */
  161. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  162. #ifndef _WCHAR_T
  163. #ifndef _T_WCHAR_
  164. #ifndef _T_WCHAR
  165. #ifndef __WCHAR_T
  166. #ifndef _WCHAR_T_
  167. #ifndef ___int_wchar_t_h
  168. #ifndef _GCC_WCHAR_T
  169. #define _WCHAR_T
  170. #define _T_WCHAR_
  171. #define _T_WCHAR
  172. #define __WCHAR_T
  173. #define _WCHAR_T_
  174. #define ___int_wchar_t_h
  175. #define _GCC_WCHAR_T
  176. #ifndef __WCHAR_TYPE__
  177. #define __WCHAR_TYPE__ int
  178. #endif
  179.  
  180.  
  181. #endif /* not amigados */
  182. #ifdef __GNUG__
  183. /* In C++, wchar_t is a distinct basic type,
  184.    and we can expect __wchar_t to be defined by cc1plus.  */
  185. typedef __wchar_t wchar_t;
  186. #else
  187. /* In C, cpp tells us which type to make an alias for.  */
  188. typedef __WCHAR_TYPE__ wchar_t;
  189. #endif
  190. #endif
  191. #endif
  192. #endif
  193. #endif
  194. #endif
  195. #endif
  196. #endif
  197. #undef    __need_wchar_t
  198. #endif /* _STDDEF_H or __need_wchar_t.  */
  199.  
  200. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  201.     are already defined.  */
  202. #ifdef _ANSI_H_
  203. #ifdef _GCC_PTRDIFF_T_
  204. #undef _PTRDIFF_T_
  205. #endif
  206. #ifdef _GCC_SIZE_T_
  207. #undef _SIZE_T_
  208. #endif
  209. #ifdef _GCC_WCHAR_T_
  210. #undef _WCHAR_T_
  211. #endif
  212. #endif /* _ANSI_H_ */
  213.  
  214. #endif /* __sys_stdtypes_h */
  215.  
  216. /* A null pointer constant.  */
  217.  
  218. #if defined (_STDDEF_H) || defined (__need_NULL)
  219. #undef NULL        /* in case <stdio.h> has defined it. */
  220. #define NULL ((void *)0)
  221. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  222. #undef    __need_NULL
  223.  
  224. #ifdef _STDDEF_H
  225.  
  226. /* Offset of member MEMBER in a struct of type TYPE.  */
  227.  
  228. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  229.  
  230. #endif /* _STDDEF_H was defined this time */
  231.  
  232. #endif /* _ANSI_STDDEF_H was not defined before */
  233. #endif /* _STDDEF_H_ was not defined before */
  234. #endif /* _STDDEF_H was not defined before */
  235.