177957Sbenno/*- 296318Sobrien * Copyright (c) 2002 David E. O'Brien. All rights reserved. 377957Sbenno * Copyright (c) 2000 Tsubai Masanari. All rights reserved. 477957Sbenno * 577957Sbenno * Redistribution and use in source and binary forms, with or without 677957Sbenno * modification, are permitted provided that the following conditions 777957Sbenno * are met: 877957Sbenno * 1. Redistributions of source code must retain the above copyright 977957Sbenno * notice, this list of conditions and the following disclaimer. 1077957Sbenno * 2. Redistributions in binary form must reproduce the above copyright 1177957Sbenno * notice, this list of conditions and the following disclaimer in the 1277957Sbenno * documentation and/or other materials provided with the distribution. 1377957Sbenno * 3. The name of the author may not be used to endorse or promote products 1477957Sbenno * derived from this software without specific prior written permission. 1577957Sbenno * 1677957Sbenno * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1777957Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1877957Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1977957Sbenno * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2077957Sbenno * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2177957Sbenno * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2277957Sbenno * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2377957Sbenno * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2477957Sbenno * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2577957Sbenno * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2677957Sbenno 2777957Sbenno * $NetBSD: varargs.h,v 1.5 2000/02/27 17:50:22 tsubai Exp $ 2877957Sbenno * $FreeBSD: releng/10.3/sys/powerpc/include/varargs.h 143063 2005-03-02 21:33:29Z joerg $ 2977957Sbenno */ 3077957Sbenno 31119628Skan#ifndef _MACHINE_VARARGS_H_ 32119628Skan#define _MACHINE_VARARGS_H_ 3377957Sbenno 34143063Sjoerg#ifndef _SYS_CDEFS_H_ 35143063Sjoerg#error this file needs sys/cdefs.h as a prerequisite 36143063Sjoerg#endif 3796318Sobrien 38143063Sjoerg#if defined(__GNUCLIKE_BUILTIN_VARARGS) 39143063Sjoerg 40102227Smike#include <sys/_types.h> 4196318Sobrien 42104584Smike#ifndef _VA_LIST_DECLARED 43104584Smike#define _VA_LIST_DECLARED 44102227Smiketypedef __va_list va_list; 45104584Smike#endif 46104584Smike 4796318Sobrientypedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); 4896318Sobrien 4996318Sobrien#define va_alist __builtin_va_alist 5096318Sobrien#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... 5196318Sobrien#define va_start(ap) __builtin_varargs_start(ap) 5296318Sobrien#define va_arg(ap, type) __builtin_va_arg((ap), type) 5396318Sobrien#define va_end(ap) __builtin_va_end(ap) 5496318Sobrien 55143063Sjoerg#else /* ! __GNUCLIKE_BUILTIN_VARARGS */ 5696318Sobrien 5777957Sbenno#include <machine/stdarg.h> 5877957Sbenno 59143063Sjoerg#ifdef __GNUCLIKE_BUILTIN_VAALIST 6077957Sbenno#define va_alist __builtin_va_alist 6177957Sbenno#define va_dcl int __builtin_va_alist; ... 62143063Sjoerg#else 63143063Sjoerg#error this file needs to be ported to your compiler 64143063Sjoerg#endif 6577957Sbenno 6677957Sbenno#undef va_start 6777957Sbenno 6877957Sbenno#ifdef __lint__ 6977957Sbenno#define va_start(ap) ((ap) = *(va_list *)0) 7077957Sbenno#else 7177957Sbenno#define va_start(ap) \ 7277957Sbenno ((ap).__stack = __va_stack_args, \ 7377957Sbenno (ap).__base = __va_reg_args, \ 7477957Sbenno (ap).__gpr = __va_first_gpr, \ 7577957Sbenno (ap).__fpr = __va_first_fpr) 7677957Sbenno#endif 7777957Sbenno 78143063Sjoerg#endif /* __GNUCLIKE_BUILTIN_VARARGS */ 7996318Sobrien 80119628Skan#endif /* _MACHINE_VARARGS_H_ */ 81