do the right thing with strange-sized varargs objects.
This commit is contained in:
parent
722183f7c6
commit
7b8535b554
|
@ -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
|
* Copyright (c) 1991, 1993
|
||||||
|
@ -53,8 +53,7 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
((type *)(ap += sizeof(type)))[-1]
|
((type *)(ap += sizeof(type)))[-1]
|
||||||
#else
|
#else
|
||||||
#define va_arg(ap, type) \
|
#define va_arg(ap, type) \
|
||||||
((type *)(ap += sizeof(type) < sizeof(int) ? \
|
((type *)(ap += __va_promote(type), ap - __va_promote(type)))[0]
|
||||||
(abort(), 0) : sizeof(type)))[-1]
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define va_end(ap)
|
#define va_end(ap)
|
||||||
|
|
|
@ -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
|
* Copyright (c) 1990, 1993
|
||||||
|
@ -49,6 +49,9 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
|
|
||||||
#define va_dcl int va_alist;
|
#define va_dcl int va_alist;
|
||||||
|
|
||||||
|
#define __va_promote(type) \
|
||||||
|
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
|
||||||
|
|
||||||
#define va_start(ap) \
|
#define va_start(ap) \
|
||||||
ap = (char *)&va_alist
|
ap = (char *)&va_alist
|
||||||
|
|
||||||
|
@ -57,8 +60,7 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
((type *)(ap += sizeof(type)))[-1]
|
((type *)(ap += sizeof(type)))[-1]
|
||||||
#else
|
#else
|
||||||
#define va_arg(ap, type) \
|
#define va_arg(ap, type) \
|
||||||
((type *)(ap += sizeof(type) < sizeof(int) ? \
|
((type *)(ap += __va_promote(type), ap - __va_promote(type)))[0]
|
||||||
(abort(), 0) : sizeof(type)))[-1]
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define va_end(ap)
|
#define va_end(ap)
|
||||||
|
|
|
@ -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
|
* Copyright (c) 1991, 1993
|
||||||
|
@ -53,8 +53,10 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
((type *)(ap += sizeof(type)))[-1]
|
((type *)(ap += sizeof(type)))[-1]
|
||||||
#else
|
#else
|
||||||
#define va_arg(ap, type) \
|
#define va_arg(ap, type) \
|
||||||
((type *)(ap += sizeof(type) < sizeof(int) ? \
|
((type *)(ap += __va_promote(type), \
|
||||||
(abort(), 0) : sizeof(type)))[-1]
|
ap - (sizeof(type) < sizeof(int) && \
|
||||||
|
sizeof(type) != __va_promote(type) ? \
|
||||||
|
sizeof(type) : __va_promote(type))))[0]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define va_end(ap)
|
#define va_end(ap)
|
||||||
|
|
|
@ -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
|
* Copyright (c) 1990, 1993
|
||||||
|
@ -49,6 +49,9 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
|
|
||||||
#define va_dcl int va_alist;
|
#define va_dcl int va_alist;
|
||||||
|
|
||||||
|
#define __va_promote(type) \
|
||||||
|
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
|
||||||
|
|
||||||
#define va_start(ap) \
|
#define va_start(ap) \
|
||||||
ap = (char *)&va_alist
|
ap = (char *)&va_alist
|
||||||
|
|
||||||
|
@ -57,8 +60,10 @@ typedef _BSD_VA_LIST_ va_list;
|
||||||
((type *)(ap += sizeof(type)))[-1]
|
((type *)(ap += sizeof(type)))[-1]
|
||||||
#else
|
#else
|
||||||
#define va_arg(ap, type) \
|
#define va_arg(ap, type) \
|
||||||
((type *)(ap += sizeof(type) < sizeof(int) ? \
|
((type *)(ap += __va_promote(type), \
|
||||||
(abort(), 0) : sizeof(type)))[-1]
|
ap - (sizeof(type) < sizeof(int) && \
|
||||||
|
sizeof(type) != __va_promote(type) ? \
|
||||||
|
sizeof(type) : __va_promote(type))))[0]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define va_end(ap)
|
#define va_end(ap)
|
||||||
|
|
Loading…
Reference in New Issue