summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/include
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-08-01 07:44:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-08-01 07:44:06 +0000
commitec8c6ca87d6e90971fec6177674b50030e69885d (patch)
treee7b38fae8ff3ad47c439445dd3c0dec73b517bd5 /sys/arch/mvme88k/include
parentcf807bd1668ea8e083b24e3e516fb0d56996eb40 (diff)
Even better varargs code, inspired by and more closer to the powerpc code,
necessary for proper gcc 2.95 operation.
Diffstat (limited to 'sys/arch/mvme88k/include')
-rw-r--r--sys/arch/mvme88k/include/ansi.h12
-rw-r--r--sys/arch/mvme88k/include/va-m88k.h28
2 files changed, 22 insertions, 18 deletions
diff --git a/sys/arch/mvme88k/include/ansi.h b/sys/arch/mvme88k/include/ansi.h
index 41f9a0ca7bd..39aedc8cde0 100644
--- a/sys/arch/mvme88k/include/ansi.h
+++ b/sys/arch/mvme88k/include/ansi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ansi.h,v 1.14 2003/06/02 23:27:52 millert Exp $ */
+/* $OpenBSD: ansi.h,v 1.15 2003/08/01 07:44:05 miod Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -47,12 +47,10 @@
#define _BSD_SIZE_T_ unsigned int /* sizeof() */
#define _BSD_SSIZE_T_ int /* byte count or error */
#define _BSD_TIME_T_ int /* time() */
-#define _BSD_CLOCKID_T_ int
-#define _BSD_TIMER_T_ int
-
-#include <machine/va-m88k.h>
-
-#define _BSD_VA_LIST_ __va_list
+struct __va_list_tag;
+#define _BSD_VA_LIST_ struct __va_list_tag * /* va_list */
+#define _BSD_CLOCKID_T_ int
+#define _BSD_TIMER_T_ int
/*
* Runes (wchar_t) is declared to be an ``int'' instead of the more natural
diff --git a/sys/arch/mvme88k/include/va-m88k.h b/sys/arch/mvme88k/include/va-m88k.h
index e6e6f8eba3e..ae200541309 100644
--- a/sys/arch/mvme88k/include/va-m88k.h
+++ b/sys/arch/mvme88k/include/va-m88k.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: va-m88k.h,v 1.9 2003/01/04 00:13:52 miod Exp $ */
+/* $OpenBSD: va-m88k.h,v 1.10 2003/08/01 07:44:05 miod Exp $ */
/* This file has local changes by MOTOROLA
Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific)
@@ -13,13 +13,11 @@ Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific)
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
-typedef struct {
+typedef struct __va_list_tag {
int __va_arg; /* argument number */
int *__va_stk; /* start of args passed on stack */
int *__va_reg; /* start of args passed in regs */
-} __va_list;
-
-typedef __va_list __gnuc_va_list;
+} __va_list[1], __gnuc_va_list[1];
#endif /* not __GNUC_VA_LIST */
@@ -28,7 +26,10 @@ typedef __va_list __gnuc_va_list;
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define __va_start_common(AP,FAKE) \
- (AP) = *(__gnuc_va_list *)__builtin_saveregs()
+__extension__ ({ \
+ (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \
+ __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list)); \
+ })
#ifdef _STDARG_H /* stdarg.h support */
@@ -54,18 +55,23 @@ typedef __va_list __gnuc_va_list;
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(AP,TYPE) \
- ( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(*(TYPE *)0) >> 3)) - 1) \
+ ( (AP)->__va_arg = (((AP)->__va_arg + (1 << (__alignof__(*(TYPE *)0) >> 3)) - 1) \
& ~((1 << (__alignof__(*(TYPE *)0) >> 3)) - 1)) \
+ __va_size(TYPE), \
*((TYPE *) (void *) ((__va_reg_p(TYPE) \
- && (AP).__va_arg < 8 + __va_size(TYPE) \
- ? (AP).__va_reg : (AP).__va_stk) \
- + ((AP).__va_arg - __va_size(TYPE)))))
+ && (AP)->__va_arg < 8 + __va_size(TYPE) \
+ ? (AP)->__va_reg : (AP)->__va_stk) \
+ + ((AP)->__va_arg - __va_size(TYPE)))))
#define va_end(AP)
/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
+#define __va_copy(dest, src) \
+__extension__ ({ \
+ (dest) = \
+ (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \
+ *(dest) = *(src);\
+ })
#if !defined(_ANSI_SOURCE) && \
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \