home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.5.8-src.lha / src / amiga / gcc-2.5.8 / gstddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-22  |  7.1 KB  |  273 lines

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