home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / pgccgcc.zip / emx / include.new / varargs.h < prev   
C/C++ Source or Header  |  1998-04-28  |  2KB  |  71 lines

  1. /* Record that this is varargs.h; this turns off stdarg.h.  */
  2.  
  3. #ifndef _VARARGS_H
  4. #define _VARARGS_H
  5.  
  6. #if !defined (NULL)
  7. #if defined (__cplusplus)
  8. #define NULL 0
  9. #else
  10. #define NULL ((void *)0)
  11. #endif
  12. #endif
  13.  
  14. /* In GCC version 2, we want an ellipsis at the end of the declaration
  15.    of the argument list.  GCC version 1 can't parse it.  */
  16.  
  17. #if __GNUC__ > 1
  18. #define __va_ellipsis ...
  19. #else
  20. #define __va_ellipsis
  21. #endif
  22.  
  23. /* These macros implement traditional (non-ANSI) varargs
  24.    for GNU C.  */
  25.  
  26. #define va_alist  __builtin_va_alist
  27. /* The ... causes current_function_varargs to be set in cc1.  */
  28. #define va_dcl    int __builtin_va_alist; __va_ellipsis
  29.  
  30. /* Define __gnuc_va_list, just as in gstdarg.h.  */
  31.  
  32. #ifndef __GNUC_VA_LIST
  33.  
  34. #  define __GNUC_VA_LIST
  35.    typedef void *__gnuc_va_list;
  36.  
  37. #  ifndef _VA_LIST
  38. #    define _VA_LIST
  39.      typedef __gnuc_va_list va_list;
  40. #  endif
  41.  
  42. #endif
  43.  
  44. #define va_start(AP)    AP=(char *) &__builtin_va_alist
  45. #define va_end(AP)    ((void)0)
  46. #define __va_rounded_size(TYPE)  \
  47.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  48.  
  49. /* This is for little-endian machines; small args are padded upward.  */
  50. #define va_arg(AP, TYPE)                        \
  51.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  52.   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  53.  
  54. /* Copy __gnuc_va_list into another variable of this type.  */
  55. #define __va_copy(dest, src) (dest) = (src)
  56.  
  57. /* varargs.h (emx+gcc) */
  58.  
  59. #ifndef _VARARGS_H
  60. #define _VARARGS_H
  61.  
  62. #if !defined (NULL)
  63. #if defined (__cplusplus)
  64. #define NULL 0
  65. #else
  66. #define NULL ((void *)0)
  67. #endif
  68. #endif
  69.  
  70. #endif _VARARGS_H
  71.