diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-03-23 23:27:14 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-03-23 23:27:14 +0000 |
commit | 8ed35d772336aab528f6f3f6c9a49b336df36da2 (patch) | |
tree | d6cbeb67c54fd582c3f8417e7444fd525f4b652f /sys | |
parent | ffee67676321d3ec3aa0244450c65612b6ff4db1 (diff) |
mvme88k varargs cleanup 2/2
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme88k/include/ansi.h | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/stdarg.h | 55 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/va-m88k.h | 42 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/varargs.h | 7 |
4 files changed, 34 insertions, 80 deletions
diff --git a/sys/arch/mvme88k/include/ansi.h b/sys/arch/mvme88k/include/ansi.h index f5371e77b29..e51dfa3a739 100644 --- a/sys/arch/mvme88k/include/ansi.h +++ b/sys/arch/mvme88k/include/ansi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ansi.h,v 1.12 2002/03/14 03:15:57 millert Exp $ */ +/* $OpenBSD: ansi.h,v 1.13 2002/03/23 23:27:13 miod Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -54,13 +54,9 @@ #define _BSD_CLOCKID_T_ int #define _BSD_TIMER_T_ int -#if 0 -#define _BSD_VA_LIST_ char * /* va_list */ -#endif +#include <machine/va-m88k.h> -#include "va-m88k.h" - -#define _BSD_VA_LIST_ __gnuc_va_list +#define _BSD_VA_LIST_ __va_list /* * Runes (wchar_t) is declared to be an ``int'' instead of the more natural diff --git a/sys/arch/mvme88k/include/stdarg.h b/sys/arch/mvme88k/include/stdarg.h index 2ee76471685..f129ede794b 100644 --- a/sys/arch/mvme88k/include/stdarg.h +++ b/sys/arch/mvme88k/include/stdarg.h @@ -1,51 +1,16 @@ -/* $OpenBSD: stdarg.h,v 1.5 2001/08/26 14:31:07 miod Exp $ */ +/* $OpenBSD: stdarg.h,v 1.6 2002/03/23 23:27:13 miod Exp $ */ -/* This file has local changes by MOTOROLA -Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) - * (gstdarg.h, gvarargs.h) C-Front requires all builtins to - be defined. This is to insert these definitions if - __cplusplus is defined but not using the G++ compiler. - */ -/* stdarg.h for GNU. - Note that the type used in va_arg is supposed to match the - actual type **after default promotions**. - Thus, va_arg (..., short) is not valid. */ +#ifndef _M88K_STDARGS_H_ +#define _M88K_STDARGS_H_ -#ifndef _STDARG_H -#ifndef _ANSI_STDARG_H_ -#ifndef __need___va_list -#define _STDARG_H -#define _ANSI_STDARG_H_ -#endif /* not __need___va_list */ -#undef __need___va_list +#include <machine/ansi.h> -#ifndef __GNUC__ -/* Use the system's macros with the system's compiler. - This is relevant only when building GCC with some other compiler. */ -#include <stdarg.h> -#else -#include <machine/va-m88k.h> - -#ifdef _STDARG_H -/* Define va_list, if desired, from __gnuc_va_list. */ -/* We deliberately do not define va_list when called from - stdio.h, because ANSI C says that stdio.h is not supposed to define - va_list. stdio.h needs to have access to that data type, - but must not use that name. It should use the name __gnuc_va_list, - which is safe because it is reserved for the implementation. */ +#ifndef _STDARG_H +#define _STDARG_H +#endif -#ifdef _BSD_VA_LIST_ -#undef _BSD_VA_LIST_ -#define _BSD_VA_LIST_ __gnuc_va_list -#endif /* _BSD_VA_LIST_ */ - -#if !defined (_VA_LIST_) -#define _VA_LIST_ -typedef __gnuc_va_list va_list; -#endif /* not _VA_LIST_ */ +#include <machine/va-m88k.h> -#endif /* _STDARG_H */ +typedef _BSD_VA_LIST_ va_list; -#endif /* __GNUC__ */ -#endif /* not _ANSI_STDARG_H_ */ -#endif /* not _STDARG_H */ +#endif /* _M88K_STDARGS_H_ */ diff --git a/sys/arch/mvme88k/include/va-m88k.h b/sys/arch/mvme88k/include/va-m88k.h index 8033d9ebcf8..de3dd103b70 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.5 2001/08/26 14:31:07 miod Exp $ */ +/* $OpenBSD: va-m88k.h,v 1.6 2002/03/23 23:27:13 miod Exp $ */ /* This file has local changes by MOTOROLA Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) @@ -13,44 +13,38 @@ Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST -typedef struct -{ - int __va_arg; /* argument number */ - int *__va_stk; /* start of args passed on stack */ - int *__va_reg; /* start of args passed in regs */ -} __gnuc_va_list; +typedef struct { + 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; + #endif /* not __GNUC_VA_LIST */ /* If this is for internal libc use, don't define anything but __gnuc_va_list. */ #if defined (_STDARG_H) || defined (_VARARGS_H) +#define __va_start_common(AP,FAKE) \ + (AP) = *(__gnuc_va_list *)__builtin_saveregs(); + #ifdef _STDARG_H /* stdarg.h support */ -#define va_start(AP,LASTARG) ((AP) = *(__gnuc_va_list *)__builtin_saveregs()) +/* Calling __builtin_next_arg gives the proper error message if LASTARG is + not indeed the last argument. */ +#define va_start(AP,LASTARG) \ + (__builtin_next_arg (LASTARG), __va_start_common(AP, 0)) #else /* varargs.h support */ -#define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs()) +#define va_start(AP) __va_start_common (AP, 1) #define va_alist __va_1st_arg -#define va_dcl register int va_alist; +#define va_dcl register int va_alist; ... #endif /* _STDARG_H */ -/* Avoid trouble between this file and _int_varargs.h under DG/UX. This file - can be included by <stdio.h> and others and provides definitions of - __va_size and __va_reg_p and a va_list typedef. Avoid defining va_list - again with _VA_LIST. */ -#ifdef __INT_VARARGS_H -#undef __va_size -#undef __va_reg_p -#define __gnuc_va_list va_list -#define _VA_LIST -#else -/* Similarly, if this gets included first, do nothing in _int_varargs.h. */ -#define __INT_VARARGS_H -#endif - #define __va_reg_p(TYPE) \ (__builtin_classify_type(*(TYPE *)0) < 12 \ ? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(*(TYPE *)0) == 4) diff --git a/sys/arch/mvme88k/include/varargs.h b/sys/arch/mvme88k/include/varargs.h index 56807b9c165..6252ba0560d 100644 --- a/sys/arch/mvme88k/include/varargs.h +++ b/sys/arch/mvme88k/include/varargs.h @@ -1,14 +1,13 @@ -/* $OpenBSD: varargs.h,v 1.6 2002/03/23 10:40:27 miod Exp $ */ +/* $OpenBSD: varargs.h,v 1.7 2002/03/23 23:27:13 miod Exp $ */ #ifndef _M88K_VARARGS_H_ #define _M88K_VARARGS_H_ #define _VARARGS_H +#include <machine/ansi.h> #include <machine/va-m88k.h> -/* Define va_list from __gnuc_va_list. */ -typedef __gnuc_va_list va_list; -typedef _BSD_VA_LIST_ __gnuc_va_list; +typedef _BSD_VA_LIST_ va_list; #endif /* _M88K_VARARGS_H_ */ |