home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / gvarargs.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  4KB  |  163 lines

  1. #ifndef __GNUC__
  2. /* Use the system's macros with the system's compiler.  */
  3. #include <varargs.h>
  4. #else
  5. /* Record that this is varargs.h; this turns off stdarg.h.  */
  6.  
  7. #ifndef _VARARGS_H
  8. #define _VARARGS_H
  9.  
  10. #ifdef __sparc__
  11. #include <va-sparc.h>
  12. #else
  13. #ifdef __spur__
  14. #include <va-spur.h>
  15. #else
  16. #ifdef __mips__
  17. #include <va-mips.h>
  18. #else
  19. #ifdef __i860__
  20. #include <va-i860.h>
  21. #else
  22. #ifdef __pyr__
  23. #include <va-pyr.h>
  24. #else
  25. #ifdef __m88k__
  26. #include <va-m88k.h>
  27. #else
  28. #if defined(__hppa__) || defined(hp800)
  29. #include <va-pa.h>
  30. #else
  31. #ifdef __i960__
  32. #include <va-i960.h>
  33. #else
  34. #ifdef __alpha__
  35. #include <va-alpha.h>
  36. #else
  37.  
  38. #ifdef __NeXT__
  39.  
  40. /* On Next, erase any vestiges of stdarg.h.  */
  41.  
  42. #ifdef _ANSI_STDARG_H_
  43. #define _VA_LIST_
  44. #endif
  45. #define _ANSI_STDARG_H_ 
  46.  
  47. #undef va_alist
  48. #undef va_dcl
  49. #undef va_list
  50. #undef va_start
  51. #undef va_end
  52. #undef __va_rounded_size
  53. #undef va_arg
  54. #endif  /* __NeXT__ */
  55.  
  56. /* In GCC version 2, we want an ellipsis at the end of the declaration
  57.    of the argument list.  GCC version 1 can't parse it.  */
  58.  
  59. #if __GNUC__ > 1
  60. #define __va_ellipsis ...
  61. #else
  62. #define __va_ellipsis
  63. #endif
  64.  
  65. /* These macros implement traditional (non-ANSI) varargs
  66.    for GNU C.  */
  67.  
  68. #define va_alist  __builtin_va_alist
  69. /* The ... causes current_function_varargs to be set in cc1.  */
  70. #define va_dcl    int __builtin_va_alist; __va_ellipsis
  71.  
  72. /* Define __gnuc_va_list, just as in gstdarg.h.  */
  73.  
  74. #ifndef __GNUC_VA_LIST
  75. #define __GNUC_VA_LIST
  76. #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
  77. typedef char *__gnuc_va_list;
  78. #else
  79. typedef void *__gnuc_va_list;
  80. #endif
  81. #endif
  82.  
  83. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  84.  
  85. #define va_end(AP)
  86.  
  87. #define __va_rounded_size(TYPE)  \
  88.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  89.  
  90. #if defined (__arm__) || defined (__i386__) || defined (__ns32000__) || defined (__vax__)
  91. /* This is for little-endian machines; small args are padded upward.  */
  92. #define va_arg(AP, TYPE)                        \
  93.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  94.   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  95. #else /* big-endian */
  96. /* This is for big-endian machines; small args are padded downward.  */
  97. #define va_arg(AP, TYPE)                        \
  98.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  99.   *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4        \
  100.                      ? sizeof (TYPE)        \
  101.                      : __va_rounded_size (TYPE))))))
  102. #endif /* big-endian */
  103.  
  104. #endif /* not alpha */
  105. #endif /* not i960 */
  106. #endif /* not hppa */
  107. #endif /* not m88k */
  108. #endif /* not pyr */
  109. #endif /* not i860 */
  110. #endif /* not mips */
  111. #endif /* not spur */
  112. #endif /* not sparc */
  113. #endif /* not _VARARGS_H */
  114.  
  115. /* Define va_list from __gnuc_va_list.  */
  116.  
  117. #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  118. #undef _VA_LIST
  119. #endif
  120.  
  121. #ifdef __SVR4_2__
  122.  
  123. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  124.    so we must avoid testing it and setting it here.  */
  125. #ifndef _VA_LIST_
  126. #define _VA_LIST_
  127. typedef __gnuc_va_list va_list;
  128. #endif /* _VA_LIST_ */
  129.  
  130. #else /* not __SVR4_2__ */
  131.  
  132. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  133.    But on BSD NET2 we must not test or define or undef it.
  134.    (Note that the comments in NET 2's ansi.h
  135.    are incorrect for _VA_LIST_--see stdio.h!)  */
  136. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____)
  137. /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  138. #ifndef _VA_LIST
  139. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__amigados__))
  140. #define _VA_LIST_
  141. #endif
  142. #define _VA_LIST
  143. typedef __gnuc_va_list va_list;
  144. #endif /* not _VA_LIST */
  145. #endif /* not _VA_LIST_ */
  146.  
  147. #endif /* not __SVR4_2__ */
  148.  
  149. /* The next BSD release (if there is one) wants this symbol to be
  150.    undefined instead of _VA_LIST_.  */
  151. #ifdef _BSD_VA_LIST
  152. #undef _BSD_VA_LIST
  153. #endif
  154.  
  155. #ifdef amigados
  156. # ifndef _VA_LIST
  157. #  define _VA_LIST
  158.    typedef __gnuc_va_list va_list;
  159. # endif
  160. #endif /* amigados */
  161.  
  162. #endif /* __GNUC__ */
  163.