diff options
Diffstat (limited to 'sys/arch/vax/include')
-rw-r--r-- | sys/arch/vax/include/stdarg.h | 24 | ||||
-rw-r--r-- | sys/arch/vax/include/varargs.h | 27 |
2 files changed, 20 insertions, 31 deletions
diff --git a/sys/arch/vax/include/stdarg.h b/sys/arch/vax/include/stdarg.h index a6cb75347bb..41042c71d7d 100644 --- a/sys/arch/vax/include/stdarg.h +++ b/sys/arch/vax/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.5 1995/03/28 18:21:25 jtc Exp $ */ +/* $NetBSD: stdarg.h,v 1.8 1995/12/25 23:15:37 mycroft Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -42,21 +42,15 @@ typedef _BSD_VA_LIST_ va_list; -#define __va_promote(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) +#define __va_size(type) \ + (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ - (ap = ((char *)&(last) + __va_promote(last))) - -#ifdef _KERNEL -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type)))[-1] -#else -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type) < sizeof(int) ? \ - (abort(), 0) : sizeof(type)))[-1] -#endif - -#define va_end(ap) ((void) 0) + ((ap) = (va_list)&(last) + __va_size(last)) + +#define va_arg(ap, type) \ + (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) + +#define va_end(ap) ((void)0) #endif /* !_VAX_STDARG_H_ */ diff --git a/sys/arch/vax/include/varargs.h b/sys/arch/vax/include/varargs.h index ec53db3e9d1..b365369de7f 100644 --- a/sys/arch/vax/include/varargs.h +++ b/sys/arch/vax/include/varargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: varargs.h,v 1.5 1995/03/28 18:21:27 jtc Exp $ */ +/* $NetBSD: varargs.h,v 1.9 1995/12/26 01:16:35 mycroft Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -38,24 +38,19 @@ #ifndef _VAX_VARARGS_H_ #define _VAX_VARARGS_H_ -#include <machine/ansi.h> +#include <machine/stdarg.h> -typedef _BSD_VA_LIST_ va_list; - -#define va_dcl int va_alist; ... - -#define va_start(ap) \ - ap = (char *)&va_alist - -#ifdef _KERNEL -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type)))[-1] +#if __GNUC__ == 1 +#define __va_ellipsis #else -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type) < sizeof(int) ? \ - (abort(), 0) : sizeof(type)))[-1] +#define __va_ellipsis ... #endif -#define va_end(ap) ((void) 0) +#define va_alist __builtin_va_alist +#define va_dcl long __builtin_va_alist; __va_ellipsis + +#undef va_start +#define va_start(ap) \ + ((ap) = (va_list)&__builtin_va_alist) #endif /* !_VAX_VARARGS_H_ */ |