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