From df10cbcda9e8f0cd433b3788cbae4f9d078c8471 Mon Sep 17 00:00:00 2001 From: bjh21 Date: Fri, 29 Dec 2000 19:30:34 +0000 Subject: [PATCH] Sync with arm32 (fixes warnings compiling /bin/sh and probably others). --- sys/arch/arm26/include/stdarg.h | 29 +++++++++++++++++++++-------- sys/arch/arm26/include/varargs.h | 31 +++++++++++++++---------------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/sys/arch/arm26/include/stdarg.h b/sys/arch/arm26/include/stdarg.h index b6449d8bcf90..54dd0116815f 100644 --- a/sys/arch/arm26/include/stdarg.h +++ b/sys/arch/arm26/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.1 2000/05/09 21:56:01 bjh21 Exp $ */ +/* $NetBSD: stdarg.h,v 1.2 2000/12/29 19:30:34 bjh21 Exp $ */ /* * Copyright (c) 1991, 1993 @@ -35,16 +35,22 @@ * from: @(#)stdarg.h 8.1 (Berkeley) 6/10/93 */ -#ifndef _STDARG_H_ -#define _STDARG_H_ +#ifndef _ARM32_STDARG_H_ +#define _ARM32_STDARG_H_ -typedef char *va_list; +#include +#include -#define __va_promote(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) +typedef _BSD_VA_LIST_ va_list; +#ifdef __lint__ +#define __builtin_next_arg(t) ((t) ? 0 : 0) +#endif + +#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)__builtin_next_arg(last)) #ifdef _KERNEL #define va_arg(ap, type) \ @@ -55,6 +61,13 @@ typedef char *va_list; (abort(), 0) : sizeof(type)))[-1] #endif +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy(dest, src) \ + ((dest) = (src)) +#endif + #define va_end(ap) -#endif /* !_STDARG_H_ */ +#endif /* !_ARM32_STDARG_H_ */ diff --git a/sys/arch/arm26/include/varargs.h b/sys/arch/arm26/include/varargs.h index 9fc0a8baab93..7f14201555a2 100644 --- a/sys/arch/arm26/include/varargs.h +++ b/sys/arch/arm26/include/varargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: varargs.h,v 1.1 2000/05/09 21:56:01 bjh21 Exp $ */ +/* $NetBSD: varargs.h,v 1.2 2000/12/29 19:30:35 bjh21 Exp $ */ /* * Copyright (c) 1990, 1993 @@ -40,25 +40,24 @@ * from: @(#)varargs.h 8.2 (Berkeley) 3/22/94 */ -#ifndef _MACHINE_VARARGS_H_ -#define _MACHINE_VARARGS_H_ +#ifndef _ARM32_VARARGS_H_ +#define _ARM32_VARARGS_H_ -typedef char *va_list; +#include -#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_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) + #define va_end(ap) -#endif /* !_MACHINE_VARARGS_H_ */ +#endif /* !_ARM32_VARARGS_H_ */