stdarg.h revision 162487
1215125Sed/*-
2215125Sed * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
3215125Sed *
4215125Sed * Redistribution and use in source and binary forms, with or without
5215125Sed * modification, are permitted provided that the following conditions
6215125Sed * are met:
7215125Sed * 1. Redistributions of source code must retain the above copyright
8215125Sed *    notice, this list of conditions and the following disclaimer.
9215129Sed * 2. Redistributions in binary form must reproduce the above copyright
10215125Sed *    notice, this list of conditions and the following disclaimer in the
11215125Sed *    documentation and/or other materials provided with the distribution.
12215125Sed * 3. Neither the name of the University nor the names of its contributors
13215125Sed *    may be used to endorse or promote products derived from this software
14215125Sed *    without specific prior written permission.
15215125Sed *
16215125Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17215125Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18215125Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19215125Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20215125Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21215125Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22215125Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23215125Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24215125Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25215125Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26215125Sed * SUCH DAMAGE.
27215125Sed *
28215125Sed * $FreeBSD: head/sys/amd64/include/stdarg.h 162487 2006-09-21 01:37:02Z kan $
29215125Sed */
30215125Sed
31215125Sed#ifndef _MACHINE_STDARG_H_
32215125Sed#define	_MACHINE_STDARG_H_
33215125Sed
34215125Sed#include <sys/cdefs.h>
35215125Sed#include <sys/_types.h>
36215125Sed
37215125Sed#ifndef _VA_LIST_DECLARED
38215125Sed#define	_VA_LIST_DECLARED
39215125Sedtypedef	__va_list	va_list;
40215125Sed#endif
41215125Sed
42215125Sed#ifdef __GNUCLIKE_BUILTIN_STDARG
43215125Sed
44222656Sed#define	va_start(ap, last) \
45222656Sed	__builtin_va_start((ap), (last))
46215125Sed
47215125Sed#define	va_arg(ap, type) \
48215125Sed	__builtin_va_arg((ap), type)
49215125Sed
50215125Sed#define	__va_copy(dest, src) \
51215125Sed	__builtin_va_copy((dest), (src))
52215125Sed
53215125Sed#if __ISO_C_VISIBLE >= 1999
54215125Sed#define	va_copy(dest, src) \
55215125Sed	__va_copy(dest, src)
56215125Sed#endif
57215125Sed
58215125Sed#define	va_end(ap) \
59215125Sed	__builtin_va_end(ap)
60215125Sed
61215125Sed#elif defined(lint)
62215125Sed/* Provide a fake implementation for lint's benefit */
63215125Sed#define	__va_size(type) \
64215125Sed	(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
65215125Sed#define	va_start(ap, last) \
66215125Sed	((ap) = (va_list)&(last) + __va_size(last))
67215125Sed#define	va_arg(ap, type) \
68215125Sed	(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
69215125Sed#define	va_end(ap)
70215125Sed
71215125Sed#else
72215125Sed#error this file needs to be ported to your compiler
73215125Sed#endif
74215125Sed
75215125Sed#endif /* !_MACHINE_STDARG_H_ */
76215125Sed