xref: /original-bsd/sys/pmax/include/stdarg.h (revision 812242a7)
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.3 (Berkeley) 01/21/93
8  */
9 
10 #ifndef _STDARG_H_
11 #define	_STDARG_H_
12 
13 typedef char *va_list;
14 
15 #define	__va_promote(type) \
16 	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
17 
18 #define	va_start(ap, last) \
19 	(ap = ((char *)&(last) + __va_promote(last)))
20 
21 #ifdef KERNEL
22 #define	va_arg(ap, type) \
23 	((type *)(ap += sizeof(type)))[-1]
24 #else
25 #define	va_arg(ap, type) \
26 	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
27 		sizeof(type) > sizeof(int) ? \
28 		(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
29 		(abort(), 0)))[-1]
30 #endif
31 
32 #define	va_end(ap)
33 
34 #endif /* !_STDARG_H_ */
35