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