xref: /original-bsd/sys/sparc/include/stdarg.h (revision 17b51d1b)
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  *	@(#)stdarg.h	7.2 (Berkeley) 07/21/92
17  *
18  * from: $Header: stdarg.h,v 1.5 92/06/17 06:10:29 torek Exp $
19  */
20 
21 /*
22  * SPARC stdarg.h
23  */
24 
25 #ifndef _MACHINE_STDARG_H
26 #define _MACHINE_STDARG_H
27 
28 typedef char *va_list;
29 
30 /*
31  * va_start sets ap to point to the first variable argument.
32  * The `last fixed argument' parameter l is ignored (and should
33  * never have been included in the ANSI standard!).
34  *
35  * va_end cleans up after va_start.  There is nothing to do there.
36  */
37 #define va_start(ap, l)	(__builtin_saveregs(), \
38 			 ap = (char *)__builtin_next_arg())
39 #define va_end(ap)	/* empty */
40 
41 /*
42  * va_arg picks up the next argument of type `t'.  Appending an
43  * asterisk to t must produce a pointer to t (i.e., t may not be,
44  * e.g., `int (*)()').  In addition, t must not be any type which
45  * undergoes promotion to some other type (e.g., char): it must
46  * be the promoted type instead.
47  */
48 #define va_arg(ap, t)	(((t *)(ap += sizeof(t)))[-1])
49 
50 #endif /* _MACHINE_STDARG_H */
51