2 * Copyright (c) 2002 David E. O'Brien. All rights reserved.
3 * Copyright (c) 2000 Tsubai Masanari. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * $NetBSD: varargs.h,v 1.5 2000/02/27 17:50:22 tsubai Exp $
31 #ifndef _MACHINE_VARARGS_H_
32 #define _MACHINE_VARARGS_H_
35 #error this file needs sys/cdefs.h as a prerequisite
38 #if defined(__GNUCLIKE_BUILTIN_VARARGS)
40 #include <sys/_types.h>
42 #ifndef _VA_LIST_DECLARED
43 #define _VA_LIST_DECLARED
44 typedef __va_list va_list;
47 typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
49 #define va_alist __builtin_va_alist
50 #define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
51 #define va_start(ap) __builtin_varargs_start(ap)
52 #define va_arg(ap, type) __builtin_va_arg((ap), type)
53 #define va_end(ap) __builtin_va_end(ap)
55 #else /* ! __GNUCLIKE_BUILTIN_VARARGS */
57 #include <machine/stdarg.h>
59 #ifdef __GNUCLIKE_BUILTIN_VAALIST
60 #define va_alist __builtin_va_alist
61 #define va_dcl int __builtin_va_alist; ...
63 #error this file needs to be ported to your compiler
69 #define va_start(ap) ((ap) = *(va_list *)0)
71 #define va_start(ap) \
72 ((ap).__stack = __va_stack_args, \
73 (ap).__base = __va_reg_args, \
74 (ap).__gpr = __va_first_gpr, \
75 (ap).__fpr = __va_first_fpr)
78 #endif /* __GNUCLIKE_BUILTIN_VARARGS */
80 #endif /* _MACHINE_VARARGS_H_ */