do the right thing with strange-sized varargs objects.

This commit is contained in:
cgd 1994-12-28 22:45:42 +00:00
parent 722183f7c6
commit 7b8535b554
4 changed files with 20 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: stdarg.h,v 1.6 1994/10/27 04:16:28 cgd Exp $ */
/* $NetBSD: stdarg.h,v 1.7 1994/12/28 22:45:42 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -53,8 +53,7 @@ typedef _BSD_VA_LIST_ va_list;
((type *)(ap += sizeof(type)))[-1]
#else
#define va_arg(ap, type) \
((type *)(ap += sizeof(type) < sizeof(int) ? \
(abort(), 0) : sizeof(type)))[-1]
((type *)(ap += __va_promote(type), ap - __va_promote(type)))[0]
#endif
#define va_end(ap)

View File

@ -1,4 +1,4 @@
/* $NetBSD: varargs.h,v 1.7 1994/10/27 04:16:33 cgd Exp $ */
/* $NetBSD: varargs.h,v 1.8 1994/12/28 22:45:43 cgd Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -49,6 +49,9 @@ typedef _BSD_VA_LIST_ va_list;
#define va_dcl int va_alist;
#define __va_promote(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#define va_start(ap) \
ap = (char *)&va_alist
@ -57,8 +60,7 @@ typedef _BSD_VA_LIST_ va_list;
((type *)(ap += sizeof(type)))[-1]
#else
#define va_arg(ap, type) \
((type *)(ap += sizeof(type) < sizeof(int) ? \
(abort(), 0) : sizeof(type)))[-1]
((type *)(ap += __va_promote(type), ap - __va_promote(type)))[0]
#endif
#define va_end(ap)

View File

@ -1,4 +1,4 @@
/* $NetBSD: stdarg.h,v 1.7 1994/10/26 07:50:55 cgd Exp $ */
/* $NetBSD: stdarg.h,v 1.8 1994/12/28 22:45:46 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -53,8 +53,10 @@ typedef _BSD_VA_LIST_ va_list;
((type *)(ap += sizeof(type)))[-1]
#else
#define va_arg(ap, type) \
((type *)(ap += sizeof(type) < sizeof(int) ? \
(abort(), 0) : sizeof(type)))[-1]
((type *)(ap += __va_promote(type), \
ap - (sizeof(type) < sizeof(int) && \
sizeof(type) != __va_promote(type) ? \
sizeof(type) : __va_promote(type))))[0]
#endif
#define va_end(ap)

View File

@ -1,4 +1,4 @@
/* $NetBSD: varargs.h,v 1.7 1994/10/26 07:50:58 cgd Exp $ */
/* $NetBSD: varargs.h,v 1.8 1994/12/28 22:45:47 cgd Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -49,6 +49,9 @@ typedef _BSD_VA_LIST_ va_list;
#define va_dcl int va_alist;
#define __va_promote(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#define va_start(ap) \
ap = (char *)&va_alist
@ -57,8 +60,10 @@ typedef _BSD_VA_LIST_ va_list;
((type *)(ap += sizeof(type)))[-1]
#else
#define va_arg(ap, type) \
((type *)(ap += sizeof(type) < sizeof(int) ? \
(abort(), 0) : sizeof(type)))[-1]
((type *)(ap += __va_promote(type), \
ap - (sizeof(type) < sizeof(int) && \
sizeof(type) != __va_promote(type) ? \
sizeof(type) : __va_promote(type))))[0]
#endif
#define va_end(ap)