summaryrefslogtreecommitdiff
path: root/sys/arch/pmax/include
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:48:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-30 08:48:24 +0000
commitda10fa74772694cff97087eb39c83a311ba6eadc (patch)
treec2f7eb8915196cb758b2aabeb7ed60b0df6ffcd8 /sys/arch/pmax/include
parentb9aee3c44417b6bdbb038f048472d3b1f05aaa8c (diff)
from netbsd: support more gcc versions
Diffstat (limited to 'sys/arch/pmax/include')
-rw-r--r--sys/arch/pmax/include/stdarg.h20
-rw-r--r--sys/arch/pmax/include/varargs.h29
2 files changed, 17 insertions, 32 deletions
diff --git a/sys/arch/pmax/include/stdarg.h b/sys/arch/pmax/include/stdarg.h
index 73f3b6e0a1a..c9a644c1ef8 100644
--- a/sys/arch/pmax/include/stdarg.h
+++ b/sys/arch/pmax/include/stdarg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: stdarg.h,v 1.7 1995/03/28 18:19:28 jtc Exp $ */
+/* $NetBSD: stdarg.h,v 1.10 1995/12/25 23:15:35 mycroft Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -42,23 +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)))
+ ((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 += sizeof(type) == sizeof(int) ? sizeof(type) : \
- sizeof(type) > sizeof(int) ? \
- (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
- (abort(), 0)))[-1]
-#endif
+ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
-#define va_end(ap) ((void) 0)
+#define va_end(ap) ((void)0)
#endif /* !_PMAX_STDARG_H_ */
diff --git a/sys/arch/pmax/include/varargs.h b/sys/arch/pmax/include/varargs.h
index 8cb900dc521..db59d3d5892 100644
--- a/sys/arch/pmax/include/varargs.h
+++ b/sys/arch/pmax/include/varargs.h
@@ -1,4 +1,4 @@
-/* $NetBSD: varargs.h,v 1.8 1995/03/28 18:19:30 jtc Exp $ */
+/* $NetBSD: varargs.h,v 1.12 1995/12/26 01:16:31 mycroft Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -43,26 +43,19 @@
#ifndef _PMAX_VARARGS_H_
#define _PMAX_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) ? sizeof(type) : \
- sizeof(type) > sizeof(int) ? \
- (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
- (abort(), 0)))[-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 /* !_PMAX_VARARGS_H_ */