Fix it to work correctly with weird structures.
This commit is contained in:
parent
5d3bd57538
commit
0ad6b56de9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stdarg.h,v 1.6 1994/10/26 08:24:43 cgd Exp $ */
|
||||
/* $NetBSD: stdarg.h,v 1.7 1994/12/29 19:43:52 phil 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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: varargs.h,v 1.5 1994/10/26 08:24:45 cgd Exp $ */
|
||||
/* $NetBSD: varargs.h,v 1.6 1994/12/29 19:43:54 phil 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)
|
||||
|
|
Loading…
Reference in New Issue