home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / include / gvarargs.h < prev    next >
C/C++ Source or Header  |  1996-12-11  |  2KB  |  81 lines

  1. #ifndef __GNUC__
  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.  
  29. #ifdef __NeXT__
  30.  
  31. /* On Next, erase any vestiges of stdarg.h.  */
  32.  
  33. #undef va_alist
  34. #undef va_dcl
  35. #undef va_list
  36. #undef va_start
  37. #undef va_end
  38. #undef __va_rounded_size
  39. #undef va_arg
  40. #endif  /* __NeXT__ */
  41.  
  42. /* In GCC version 2, we want an ellipsis at the end of the declaration
  43.    of the argument list.  GCC version 1 can't parse it.  */
  44.  
  45. #if __GNUC__ > 1
  46. #define __va_ellipsis ...
  47. #else
  48. #define __va_ellipsis
  49. #endif
  50.  
  51. /* These macros implement traditional (non-ANSI) varargs
  52.    for GNU C.  */
  53.  
  54. #define va_alist  __builtin_va_alist
  55. /* The ... causes current_function_varargs to be set in cc1.  */
  56. #define va_dcl    int __builtin_va_alist; __va_ellipsis
  57.  
  58. /* Make this a macro rather than a typedef, so we can undef any other defn.  */
  59. #define va_list __va___list
  60. typedef char * __va___list;
  61.  
  62. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  63.  
  64. #define va_end(AP)
  65.  
  66. #define __va_rounded_size(TYPE)  \
  67.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  68.  
  69. #define va_arg(AP, TYPE)                        \
  70.  (AP += __va_rounded_size (TYPE),                    \
  71.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  72.  
  73. #endif /* not m88k */
  74. #endif /* not pyr */
  75. #endif /* not i860 */
  76. #endif /* not mips */
  77. #endif /* not spur */
  78. #endif /* not sparc */
  79. #endif /* not _VARARGS_H */
  80. #endif /* __GNUC__ */
  81.