From 82464e46d67d0ecd281d5eebfdea43bcbd798ddb Mon Sep 17 00:00:00 2001 From: kleink Date: Thu, 3 Feb 2000 16:16:06 +0000 Subject: [PATCH] Add a C99-style va_copy macro. --- sys/arch/alpha/include/stdarg.h | 10 +++++++++- sys/arch/arm32/include/stdarg.h | 10 +++++++++- sys/arch/i386/include/stdarg.h | 10 +++++++++- sys/arch/m68k/include/stdarg.h | 10 +++++++++- sys/arch/mips/include/stdarg.h | 10 +++++++++- sys/arch/pc532/include/stdarg.h | 10 +++++++++- sys/arch/powerpc/include/stdarg.h | 9 ++++++++- sys/arch/powerpc/include/va-ppc.h | 5 ++++- sys/arch/powerpc/include/varargs.h | 9 ++++++++- sys/arch/sh3/include/stdarg.h | 9 ++++++++- sys/arch/sh3/include/varargs.h | 9 ++++++++- sys/arch/sparc/include/stdarg.h | 10 +++++++++- sys/arch/sparc64/include/stdarg.h | 10 +++++++++- sys/arch/vax/include/stdarg.h | 10 +++++++++- 14 files changed, 117 insertions(+), 14 deletions(-) diff --git a/sys/arch/alpha/include/stdarg.h b/sys/arch/alpha/include/stdarg.h index d865735e9398..b9a5c64316c5 100644 --- a/sys/arch/alpha/include/stdarg.h +++ b/sys/arch/alpha/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.9 1999/05/03 16:30:31 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.10 2000/02/03 16:16:06 kleink Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -39,6 +39,7 @@ #define _ALPHA_STDARG_H_ #include +#include #ifdef __lint__ #define __builtin_saveregs() (0) @@ -63,6 +64,13 @@ typedef _BSD_VA_LIST_ va_list; (*(type *)((ap).__offset += __va_size(type), \ (ap).__base + (ap).__offset + __va_arg_offset(ap, type))) +#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 /* !_ALPHA_STDARG_H_ */ diff --git a/sys/arch/arm32/include/stdarg.h b/sys/arch/arm32/include/stdarg.h index a68b537e9283..6749a79cec41 100644 --- a/sys/arch/arm32/include/stdarg.h +++ b/sys/arch/arm32/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.7 1999/05/07 00:28:22 thorpej Exp $ */ +/* $NetBSD: stdarg.h,v 1.8 2000/02/03 16:16:06 kleink Exp $ */ /* * Copyright (c) 1991, 1993 @@ -39,6 +39,7 @@ #define _ARM32_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; #ifdef __lint__ @@ -60,6 +61,13 @@ typedef _BSD_VA_LIST_ 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 /* !_ARM32_STDARG_H_ */ diff --git a/sys/arch/i386/include/stdarg.h b/sys/arch/i386/include/stdarg.h index 8a34050d4a89..485444680bb7 100644 --- a/sys/arch/i386/include/stdarg.h +++ b/sys/arch/i386/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.16 1999/05/03 16:30:32 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.17 2000/02/03 16:16:07 kleink Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -39,6 +39,7 @@ #define _I386_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -55,6 +56,13 @@ typedef _BSD_VA_LIST_ va_list; #define va_arg(ap, type) \ (*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type))) +#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 /* !_I386_STDARG_H_ */ diff --git a/sys/arch/m68k/include/stdarg.h b/sys/arch/m68k/include/stdarg.h index 628e8905731c..3915cde5547e 100644 --- a/sys/arch/m68k/include/stdarg.h +++ b/sys/arch/m68k/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.18 1999/05/04 13:57:20 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.19 2000/02/03 16:16:07 kleink Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -39,6 +39,7 @@ #define _M68K_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -58,6 +59,13 @@ typedef _BSD_VA_LIST_ va_list; sizeof(type) != __va_size(type) ? \ sizeof(type) : __va_size(type)))) +#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 /* !_M68K_STDARG_H_ */ diff --git a/sys/arch/mips/include/stdarg.h b/sys/arch/mips/include/stdarg.h index 7181e85bc7bc..246e3d9223f5 100644 --- a/sys/arch/mips/include/stdarg.h +++ b/sys/arch/mips/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.17 1999/06/08 00:46:38 nisimura Exp $ */ +/* $NetBSD: stdarg.h,v 1.18 2000/02/03 16:16:07 kleink Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -39,6 +39,7 @@ #define _MIPS_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -64,6 +65,13 @@ typedef _BSD_VA_LIST_ va_list; ))[-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 /* !_MIPS_STDARG_H_ */ diff --git a/sys/arch/pc532/include/stdarg.h b/sys/arch/pc532/include/stdarg.h index 2a715f257cc0..de919d7f5646 100644 --- a/sys/arch/pc532/include/stdarg.h +++ b/sys/arch/pc532/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.15 1999/05/03 16:30:34 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.16 2000/02/03 16:16:08 kleink Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -39,6 +39,7 @@ #define _PC532_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -55,6 +56,13 @@ typedef _BSD_VA_LIST_ va_list; #define va_arg(ap, type) \ (*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type))) +#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 /* !_PC532_STDARG_H_ */ diff --git a/sys/arch/powerpc/include/stdarg.h b/sys/arch/powerpc/include/stdarg.h index b7883c78585d..87b116c5695a 100644 --- a/sys/arch/powerpc/include/stdarg.h +++ b/sys/arch/powerpc/include/stdarg.h @@ -1,9 +1,10 @@ -/* $NetBSD: stdarg.h,v 1.3 1998/12/02 14:23:03 tsubai Exp $ */ +/* $NetBSD: stdarg.h,v 1.4 2000/02/03 16:16:08 kleink Exp $ */ #ifndef _PPC_STDARG_H_ #define _PPC_STDARG_H_ #include +#include #ifndef _STDARG_H #define _STDARG_H @@ -12,4 +13,10 @@ typedef __gnuc_va_list va_list; +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy __va_copy +#endif + #endif /* ! _PPC_STDARG_H_ */ diff --git a/sys/arch/powerpc/include/va-ppc.h b/sys/arch/powerpc/include/va-ppc.h index 61ecb629d697..c4387eea9431 100644 --- a/sys/arch/powerpc/include/va-ppc.h +++ b/sys/arch/powerpc/include/va-ppc.h @@ -1,4 +1,4 @@ -/* $NetBSD: va-ppc.h,v 1.4 1998/12/02 14:23:03 tsubai Exp $ */ +/* $NetBSD: va-ppc.h,v 1.5 2000/02/03 16:16:09 kleink Exp $ */ /* GNU C varargs support for the PowerPC with V.4 calling sequence */ @@ -152,6 +152,9 @@ __extension__ ({ \ __ptr; \ }))) +#define __va_copy(dest, src) \ + (*(dest) = *(src)) + #define va_end(AP) ((void)0) #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/sys/arch/powerpc/include/varargs.h b/sys/arch/powerpc/include/varargs.h index 24f37a60ad08..b77bd98432a1 100644 --- a/sys/arch/powerpc/include/varargs.h +++ b/sys/arch/powerpc/include/varargs.h @@ -1,9 +1,10 @@ -/* $NetBSD: varargs.h,v 1.3 1998/12/02 14:23:03 tsubai Exp $ */ +/* $NetBSD: varargs.h,v 1.4 2000/02/03 16:16:09 kleink Exp $ */ #ifndef _PPC_VARARGS_H_ #define _PPC_VARARGS_H_ #include +#include #ifndef _VARARGS_H #define _VARARGS_H @@ -14,4 +15,10 @@ typedef __gnuc_va_list va_list; #undef _BSD_VA_LIST +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy __va_copy +#endif + #endif /* ! _PPC_VARARGS_H_ */ diff --git a/sys/arch/sh3/include/stdarg.h b/sys/arch/sh3/include/stdarg.h index 56ce760e0a91..81bb28105595 100644 --- a/sys/arch/sh3/include/stdarg.h +++ b/sys/arch/sh3/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.2 1999/09/16 12:48:06 msaitoh Exp $ */ +/* $NetBSD: stdarg.h,v 1.3 2000/02/03 16:16:10 kleink Exp $ */ #ifndef _SH3_STDARG_H_ #define _SH3_STDARG_H_ @@ -6,7 +6,14 @@ #define _STDARG_H #include "sh3/va-sh.h" +#include typedef __gnuc_va_list va_list; +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy __va_copy +#endif + #endif /* _SH3_STDARG_H_ */ diff --git a/sys/arch/sh3/include/varargs.h b/sys/arch/sh3/include/varargs.h index c8da13c8d0ca..619b3f2e6392 100644 --- a/sys/arch/sh3/include/varargs.h +++ b/sys/arch/sh3/include/varargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: varargs.h,v 1.2 1999/09/16 12:48:06 msaitoh Exp $ */ +/* $NetBSD: varargs.h,v 1.3 2000/02/03 16:16:10 kleink Exp $ */ #ifndef _SH3_VARARGS_H_ #define _SH3_VARARGS_H_ @@ -6,7 +6,14 @@ #define _VARARGS_H #include "sh3/va-sh.h" +#include typedef __gnuc_va_list va_list; +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy __va_copy +#endif + #endif /* _SH3_VARARGS_H_ */ diff --git a/sys/arch/sparc/include/stdarg.h b/sys/arch/sparc/include/stdarg.h index feb28c9f40c0..287583b27307 100644 --- a/sys/arch/sparc/include/stdarg.h +++ b/sys/arch/sparc/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.15 1999/05/04 13:36:10 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.16 2000/02/03 16:16:10 kleink Exp $ */ /* * Copyright (c) 1992, 1993 @@ -48,6 +48,7 @@ #define _SPARC_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -106,6 +107,13 @@ typedef _BSD_VA_LIST_ va_list; __va_8byte(ap, type) : __va_arg(ap, type)) #endif /* __lint__ */ +#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 /* !_SPARC_STDARG_H_ */ diff --git a/sys/arch/sparc64/include/stdarg.h b/sys/arch/sparc64/include/stdarg.h index e8c3dcb38d31..259f45bd4bec 100644 --- a/sys/arch/sparc64/include/stdarg.h +++ b/sys/arch/sparc64/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.8 1999/05/04 13:36:44 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.9 2000/02/03 16:16:10 kleink Exp $ */ /* * Copyright (c) 1992, 1993 @@ -48,6 +48,7 @@ #define _SPARC64_STDARG_H_ #include +#include #ifdef __lint__ #define __builtin_saveregs(t) (0) @@ -60,6 +61,13 @@ typedef _BSD_VA_LIST_ va_list; #define va_start(ap, last) \ (__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs()) +#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) #ifdef __arch64__ diff --git a/sys/arch/vax/include/stdarg.h b/sys/arch/vax/include/stdarg.h index 963f086df085..1a5e7c293f77 100644 --- a/sys/arch/vax/include/stdarg.h +++ b/sys/arch/vax/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.11 1999/05/03 16:30:34 christos Exp $ */ +/* $NetBSD: stdarg.h,v 1.12 2000/02/03 16:16:11 kleink Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -39,6 +39,7 @@ #define _VAX_STDARG_H_ #include +#include typedef _BSD_VA_LIST_ va_list; @@ -55,6 +56,13 @@ typedef _BSD_VA_LIST_ va_list; #define va_arg(ap, type) \ (*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type))) +#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 /* !_VAX_STDARG_H_ */