xref: /original-bsd/sys/sparc/include/varargs.h (revision 89af8021)
1 /*
2  * Copyright (c) 1992 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * All advertising materials mentioning features or use of this software
10  * must display the following acknowledgement:
11  *	This product includes software developed by the University of
12  *	California, Lawrence Berkeley Laboratories.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)varargs.h	7.3 (Berkeley) 10/15/92
17  *
18  * from: $Header: varargs.h,v 1.5 92/10/16 04:16:09 torek Exp $
19  */
20 
21 #ifndef _MACHINE_VARARGS_H_
22 #define	_MACHINE_VARARGS_H_
23 
24 /* See <machine/stdarg.h> for comments. */
25 #if __GNUC__ == 1
26 #define __extension__
27 #endif
28 typedef char *va_list;
29 #define	va_dcl	int va_alist;
30 #define	va_start(ap) (__builtin_saveregs(), (ap) = (char *)&va_alist)
31 #define va_arg(ap, ty) \
32     (sizeof(ty) == 8 ? __extension__ ({ \
33 	union { ty __d; int __i[2]; } __u; \
34 	__u.__i[0] = ((int *)(ap))[0]; \
35 	__u.__i[1] = ((int *)(ap))[1]; \
36 	(ap) += 8; \
37 	__u.__d; }) : \
38     ((ty *)(ap += sizeof(ty)))[-1])
39 #define va_end(ap) /* empty */
40 
41 #endif /* !_MACHINE_VARARGS_H_ */
42