xref: /csrg-svn/sys/pmax/include/stdarg.h (revision 56674)
1 /*-
2  * Copyright (c) 1992 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)stdarg.h	7.1 (Berkeley) 11/04/92
8  */
9 
10 typedef char *va_list;
11 
12 #define	__va_promote(type) \
13 	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
14 
15 #define	va_start(ap, last) \
16 	(ap = ((char *)&(last) + __va_promote(last)))
17 
18 #ifdef KERNEL
19 #define	va_arg(ap, type) \
20 	((type *)(ap += sizeof(type)))[-1]
21 #else
22 #define	va_arg(ap, type) \
23 	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
24 		sizeof(type) > sizeof(int) ? \
25 		(-(int)(ap) & ~(sizeof(type) - 1)) + sizeof(type) : \
26 		(abort(), 0)))[-1]
27 #endif
28 
29 #define	va_end(ap)
30