xref: /csrg-svn/sys/pmax/include/stdarg.h (revision 63217)
156674Sbostic /*-
2*63217Sbostic  * Copyright (c) 1992, 1993
3*63217Sbostic  *	The Regents of the University of California.  All rights reserved.
456674Sbostic  *
556674Sbostic  * %sccs.include.redist.c%
656674Sbostic  *
7*63217Sbostic  *	@(#)stdarg.h	8.1 (Berkeley) 06/10/93
856674Sbostic  */
956674Sbostic 
1057645Sbostic #ifndef _STDARG_H_
1157645Sbostic #define	_STDARG_H_
1257645Sbostic 
1356674Sbostic typedef char *va_list;
1456674Sbostic 
1556674Sbostic #define	__va_promote(type) \
1656674Sbostic 	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
1756674Sbostic 
1856674Sbostic #define	va_start(ap, last) \
1956674Sbostic 	(ap = ((char *)&(last) + __va_promote(last)))
2056674Sbostic 
2156674Sbostic #ifdef KERNEL
2256674Sbostic #define	va_arg(ap, type) \
2356674Sbostic 	((type *)(ap += sizeof(type)))[-1]
2456674Sbostic #else
2556674Sbostic #define	va_arg(ap, type) \
2656674Sbostic 	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
2756674Sbostic 		sizeof(type) > sizeof(int) ? \
2857008Sralph 		(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
2956674Sbostic 		(abort(), 0)))[-1]
3056674Sbostic #endif
3156674Sbostic 
3256674Sbostic #define	va_end(ap)
3357645Sbostic 
3457645Sbostic #endif /* !_STDARG_H_ */
35