1292407Sbr/*-
2292407Sbr * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
3292407Sbr * Copyright (c) 1991, 1993
4292407Sbr *	The Regents of the University of California.  All rights reserved.
5292407Sbr *
6292407Sbr * Redistribution and use in source and binary forms, with or without
7292407Sbr * modification, are permitted provided that the following conditions
8292407Sbr * are met:
9292407Sbr * 1. Redistributions of source code must retain the above copyright
10292407Sbr *    notice, this list of conditions and the following disclaimer.
11292407Sbr * 2. Redistributions in binary form must reproduce the above copyright
12292407Sbr *    notice, this list of conditions and the following disclaimer in the
13292407Sbr *    documentation and/or other materials provided with the distribution.
14292407Sbr * 3. Neither the name of the University nor the names of its contributors
15292407Sbr *    may be used to endorse or promote products derived from this software
16292407Sbr *    without specific prior written permission.
17292407Sbr *
18292407Sbr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19292407Sbr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20292407Sbr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21292407Sbr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22292407Sbr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23292407Sbr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24292407Sbr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25292407Sbr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26292407Sbr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27292407Sbr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28292407Sbr * SUCH DAMAGE.
29292407Sbr *
30292407Sbr *	@(#)stdarg.h	8.1 (Berkeley) 6/10/93
31292407Sbr * $FreeBSD$
32292407Sbr */
33292407Sbr
34292407Sbr#ifndef _MACHINE_STDARG_H_
35292407Sbr#define	_MACHINE_STDARG_H_
36292407Sbr
37292407Sbr#include <sys/cdefs.h>
38292407Sbr#include <sys/_types.h>
39292407Sbr
40292407Sbr#ifndef _VA_LIST_DECLARED
41292407Sbr#define	_VA_LIST_DECLARED
42292407Sbrtypedef	__va_list	va_list;
43292407Sbr#endif
44292407Sbr
45292407Sbr#ifdef __GNUCLIKE_BUILTIN_STDARG
46292407Sbr
47292407Sbr#define	va_start(ap, last) \
48292407Sbr	__builtin_va_start((ap), (last))
49292407Sbr
50292407Sbr#define	va_arg(ap, type) \
51292407Sbr	__builtin_va_arg((ap), type)
52292407Sbr
53292407Sbr#if __ISO_C_VISIBLE >= 1999
54292407Sbr#define	va_copy(dest, src) \
55292407Sbr	__builtin_va_copy((dest), (src))
56292407Sbr#endif
57292407Sbr
58292407Sbr#define	va_end(ap) \
59292407Sbr	__builtin_va_end(ap)
60292407Sbr
61292407Sbr#elif defined(lint)
62292407Sbr/* Provide a fake implementation for lint's benefit */
63292407Sbr#define	__va_size(type) \
64292407Sbr	(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
65292407Sbr#define	va_start(ap, last) \
66292407Sbr	((ap) = (va_list)&(last) + __va_size(last))
67292407Sbr#define va_copy(dst, src) \
68292407Sbr	((dst) = (src))
69292407Sbr#define	va_arg(ap, type) \
70292407Sbr	(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
71292407Sbr#define	va_end(ap)
72292407Sbr
73292407Sbr#else	/* !__GNUCLIKE_BUILTIN_STDARG */
74292407Sbr
75292407Sbr#error no support for your compiler
76292407Sbr
77292407Sbr#endif /* __GNUCLIKE_BUILTIN_STDARG */
78292407Sbr
79292407Sbr#endif /* !_MACHINE_STDARG_H_ */
80