home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / cc / cc / gvarargs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-12  |  2.5 KB  |  111 lines

  1. #if !defined(__GNUC__) || defined(NeXT)
  2. /* Use the system's macros with the system's compiler.  */
  3. #include <varargs.h>
  4. #else
  5. /* Record that varargs.h is defined; 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. #ifdef __hp9000s800__
  29. #include "va-hp800.h"
  30. #else
  31. #ifdef __i960__
  32. #include "va-i960.h"
  33. #else
  34.  
  35. #ifdef __NeXT__
  36.  
  37. /* On Next, erase any vestiges of stdarg.h.  */
  38.  
  39. #undef va_alist
  40. #undef va_dcl
  41. #undef va_list
  42. #undef va_start
  43. #undef va_end
  44. #undef __va_rounded_size
  45. #undef va_arg
  46. #endif  /* __NeXT__ */
  47.  
  48. /* In GCC version 2, we want an ellipsis at the end of the declaration
  49.    of the argument list.  GCC version 1 can't parse it.  */
  50.  
  51. #if __GNUC__ > 1
  52. #define __va_ellipsis ...
  53. #else
  54. #define __va_ellipsis
  55. #endif
  56.  
  57. /* These macros implement traditional (non-ANSI) varargs
  58.    for GNU C.  */
  59.  
  60. #define va_alist  __builtin_va_alist
  61. /* The ... causes current_function_varargs to be set in cc1.  */
  62. #define va_dcl    int __builtin_va_alist; __va_ellipsis
  63.  
  64. #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  65. #undef _VA_LIST
  66. #endif
  67.  
  68. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  69. /* But in 4.3bsd-net2, _VA_LIST_ has another meaning.  So ignore it.  */
  70. #if !defined (_VA_LIST_) || defined (_ANSI_H)
  71. /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  72. #ifndef _VA_LIST
  73. #ifndef _VA_LIST_
  74. #define _VA_LIST_
  75. #endif
  76. #define _VA_LIST
  77. /* Make this a macro rather than a typedef, so we can undef any other defn.  */
  78. #define va_list __va___list
  79. typedef char * __va___list;
  80. #endif /* _VA_LIST */
  81. #endif /* !defined (_VA_LIST_) || defined (_ANSI_H) */
  82.  
  83. /*  In 4.3bsd-net2, it is said we must #undef this.
  84.     I hope this successfully identifies that system.
  85.     I don't know why this works--rms.  */
  86. #ifdef _ANSI_H
  87. #undef _VA_LIST_
  88. #endif
  89.  
  90. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  91.  
  92. #define va_end(AP)
  93.  
  94. #define __va_rounded_size(TYPE)  \
  95.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  96.  
  97. #define va_arg(AP, TYPE)                        \
  98.  (AP += __va_rounded_size (TYPE),                    \
  99.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  100.  
  101. #endif /* not i960 */
  102. #endif /* not hp800 */
  103. #endif /* not m88k */
  104. #endif /* not pyr */
  105. #endif /* not i860 */
  106. #endif /* not mips */
  107. #endif /* not spur */
  108. #endif /* not sparc */
  109. #endif /* not _VARARGS_H */
  110. #endif /* __GNUC__ */
  111.