summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/stdarg.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-06-21 15:45:13 +0000
committerbde <bde@FreeBSD.org>1997-06-21 15:45:13 +0000
commitb4dcc8bb379d868c127f6a63a0f85a9581870957 (patch)
treec44ff61b3daf92ac2484d1ef71f05a3dba75677d /sys/i386/include/stdarg.h
parent28d72683d4088f916e924363f20ef1341eb6439d (diff)
downloadFreeBSD-src-b4dcc8bb379d868c127f6a63a0f85a9581870957.zip
FreeBSD-src-b4dcc8bb379d868c127f6a63a0f85a9581870957.tar.gz
Don't attempt to generate errors for unpromoted types in va_arg(),
since it is impossible to distinguish unpromoted types from small (struct) types. Renamed __va_promote() to __va_size() since it is related to sizes of args on the stack and not to promotion. PR: 3884 Submitted by: mostly by arnej@math.ntnu.no (Arne Henrik Juul) Obtained from: name of__va_size and some parentheses fixes from NetBSD
Diffstat (limited to 'sys/i386/include/stdarg.h')
-rw-r--r--sys/i386/include/stdarg.h22
1 files changed, 8 insertions, 14 deletions
diff --git a/sys/i386/include/stdarg.h b/sys/i386/include/stdarg.h
index cf84be3..1766283 100644
--- a/sys/i386/include/stdarg.h
+++ b/sys/i386/include/stdarg.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)stdarg.h 8.1 (Berkeley) 6/10/93
- * $Id$
+ * $Id: stdarg.h,v 1.8 1997/02/22 09:35:17 peter Exp $
*/
#ifndef _STDARG_H_
@@ -39,25 +39,19 @@
typedef char *va_list;
-#ifdef __GNUC__
-#define va_start(AP, LASTARG) \
- (AP = ((va_list) __builtin_next_arg (LASTARG)))
-#else
-#define __va_promote(type) \
+#define __va_size(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
+#ifdef __GNUC__
+#define va_start(ap, last) \
+ ((ap) = (va_list)__builtin_next_arg(last))
+#else
#define va_start(ap, last) \
- (ap = ((va_list)&(last) + __va_promote(last)))
+ ((ap) = (va_list)&(last) + __va_size(last))
#endif
-#ifdef KERNEL
#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type)))[-1]
-#else
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type) < sizeof(int) ? \
- (abort(), 0) : sizeof(type)))[-1]
-#endif
+ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
#define va_end(ap)
OpenPOWER on IntegriCloud