diff options
Diffstat (limited to 'sys/arch/m68k')
-rw-r--r-- | sys/arch/m68k/include/stdarg.h | 23 | ||||
-rw-r--r-- | sys/arch/m68k/include/varargs.h | 32 |
2 files changed, 20 insertions, 35 deletions
diff --git a/sys/arch/m68k/include/stdarg.h b/sys/arch/m68k/include/stdarg.h index b34dd9e4c7b..0ec130709b4 100644 --- a/sys/arch/m68k/include/stdarg.h +++ b/sys/arch/m68k/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.11 1995/09/07 01:20:15 jtc Exp $ */ +/* $NetBSD: stdarg.h,v 1.14 1995/12/25 23:15:33 mycroft Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -42,23 +42,18 @@ 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) + sizeof(last))) + ((ap) = (va_list)&(last) + __va_size(last)) -#ifdef _KERNEL #define va_arg(ap, type) \ - ((type *)(ap += sizeof(type)))[-1] -#else -#define va_arg(ap, type) \ - ((type *)(ap += __va_promote(type), \ - ap - (sizeof(type) < sizeof(int) && \ - sizeof(type) != __va_promote(type) ? \ - sizeof(type) : __va_promote(type))))[0] -#endif + (*(type *)((ap) += __va_size(type), \ + (ap) - (sizeof(type) < sizeof(long) && \ + sizeof(type) != __va_size(type) ? \ + sizeof(type) : __va_size(type)))) -#define va_end(ap) ((void) 0) +#define va_end(ap) ((void)0) #endif /* !_M68K_STDARG_H_ */ diff --git a/sys/arch/m68k/include/varargs.h b/sys/arch/m68k/include/varargs.h index d3a160453c0..925c1d21278 100644 --- a/sys/arch/m68k/include/varargs.h +++ b/sys/arch/m68k/include/varargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: varargs.h,v 1.10 1995/03/26 17:08:41 briggs Exp $ */ +/* $NetBSD: varargs.h,v 1.14 1995/12/26 01:16:28 mycroft Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -43,29 +43,19 @@ #ifndef _M68K_VARARGS_H_ #define _M68K_VARARGS_H_ -#include <machine/ansi.h> +#include <machine/stdarg.h> -typedef _BSD_VA_LIST_ va_list; - -#define va_dcl int va_alist; ... - -#define __va_promote(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#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 += __va_promote(type), \ - ap - (sizeof(type) < sizeof(int) && \ - sizeof(type) != __va_promote(type) ? \ - sizeof(type) : __va_promote(type))))[0] +#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 /* !_M68K_VARARGS_H_ */ |