1139825Simp/*-
296317Sobrien * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
386551Sjake * Copyright (c) 1992, 1993
486551Sjake *	The Regents of the University of California.  All rights reserved.
586551Sjake * (c) UNIX System Laboratories, Inc.
686551Sjake * All or some portions of this file are derived from material licensed
786551Sjake * to the University of California by American Telephone and Telegraph
886551Sjake * Co. or Unix System Laboratories, Inc. and are reproduced herein with
986551Sjake * the permission of UNIX System Laboratories, Inc.
1086551Sjake *
1186551Sjake * This software was developed by the Computer Systems Engineering group
1286551Sjake * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
1386551Sjake * contributed to Berkeley.
1486551Sjake *
1586551Sjake * All advertising materials mentioning features or use of this software
1686551Sjake * must display the following acknowledgement:
1786551Sjake *	This product includes software developed by the University of
1886551Sjake *	California, Lawrence Berkeley Laboratory.
1986551Sjake *
2086551Sjake * Redistribution and use in source and binary forms, with or without
2186551Sjake * modification, are permitted provided that the following conditions
2286551Sjake * are met:
2386551Sjake * 1. Redistributions of source code must retain the above copyright
2486551Sjake *    notice, this list of conditions and the following disclaimer.
2586551Sjake * 2. Redistributions in binary form must reproduce the above copyright
2686551Sjake *    notice, this list of conditions and the following disclaimer in the
2786551Sjake *    documentation and/or other materials provided with the distribution.
2886551Sjake * 4. Neither the name of the University nor the names of its contributors
2986551Sjake *    may be used to endorse or promote products derived from this software
3086551Sjake *    without specific prior written permission.
3186551Sjake *
3286551Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3386551Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3486551Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3586551Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3686551Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3786551Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3886551Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3986551Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4086551Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4186551Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4286551Sjake * SUCH DAMAGE.
4386551Sjake *
4496317Sobrien *	@(#)varargs.h	8.3 (Berkeley) 3/22/94
4586551Sjake * $FreeBSD$
4686551Sjake */
4786551Sjake
48119628Skan#ifndef _MACHINE_VARARGS_H_
49119628Skan#define	_MACHINE_VARARGS_H_
50119628Skan
51143063Sjoerg#ifndef _SYS_CDEFS_H_
52143063Sjoerg#error this file needs sys/cdefs.h as a prerequisite
53143063Sjoerg#endif
5496317Sobrien
55143063Sjoerg#ifdef __GNUCLIKE_BUILTIN_VARARGS
56143063Sjoerg
57102227Smike#include <sys/_types.h>
5896317Sobrien
59104584Smike#ifndef _VA_LIST_DECLARED
60104584Smike#define	_VA_LIST_DECLARED
61102227Smiketypedef	__va_list	va_list;
62104584Smike#endif
63104584Smike
6496317Sobrientypedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
6596317Sobrien
6696317Sobrien#define	va_alist		__builtin_va_alist
6796317Sobrien#define	va_dcl			__builtin_va_alist_t __builtin_va_alist; ...
6896317Sobrien#define	va_start(ap)		__builtin_varargs_start(ap)
6996317Sobrien#define	va_arg(ap, type)	__builtin_va_arg((ap), type)
7096317Sobrien#define	va_end(ap)		__builtin_va_end(ap)
7196317Sobrien
72143063Sjoerg#else	/* !__GNUCLIKE_BUILTIN_VARARGS */
7396317Sobrien
7486551Sjake#include <machine/stdarg.h>
7586551Sjake
7686551Sjake#define	__va_ellipsis	...
7786551Sjake
7886551Sjake#define	va_alist	__builtin_va_alist
7986551Sjake#define	va_dcl		long __builtin_va_alist; __va_ellipsis
8086551Sjake
8186551Sjake#undef va_start
8286551Sjake#define	va_start(ap) \
8386551Sjake	((ap) = (va_list)__builtin_saveregs())
8486551Sjake
85143063Sjoerg#endif /* __GNUCLIKE_BUILTIN_VARARGS */
8696317Sobrien
8786556Sjake#endif /* !_MACHINE_VARARGS_H_ */
88