varargs.h revision 139825
138061Smsmith/*- 255939Snsouch * Copyright (c) 2002 David E. O'Brien. All rights reserved. 370608Snsouch * Copyright (c) 1992, 1993 438061Smsmith * The Regents of the University of California. All rights reserved. 538061Smsmith * (c) UNIX System Laboratories, Inc. 638061Smsmith * All or some portions of this file are derived from material licensed 738061Smsmith * to the University of California by American Telephone and Telegraph 838061Smsmith * Co. or Unix System Laboratories, Inc. and are reproduced herein with 938061Smsmith * the permission of UNIX System Laboratories, Inc. 1038061Smsmith * 1138061Smsmith * This software was developed by the Computer Systems Engineering group 1238061Smsmith * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 1338061Smsmith * contributed to Berkeley. 1438061Smsmith * 1538061Smsmith * All advertising materials mentioning features or use of this software 1638061Smsmith * must display the following acknowledgement: 1738061Smsmith * This product includes software developed by the University of 1838061Smsmith * California, Lawrence Berkeley Laboratory. 1938061Smsmith * 2038061Smsmith * Redistribution and use in source and binary forms, with or without 2138061Smsmith * modification, are permitted provided that the following conditions 2238061Smsmith * are met: 2338061Smsmith * 1. Redistributions of source code must retain the above copyright 2438061Smsmith * notice, this list of conditions and the following disclaimer. 2538061Smsmith * 2. Redistributions in binary form must reproduce the above copyright 2638061Smsmith * notice, this list of conditions and the following disclaimer in the 2738061Smsmith * documentation and/or other materials provided with the distribution. 2838061Smsmith * 3. All advertising materials mentioning features or use of this software 2938061Smsmith * must display the following acknowledgement: 30119418Sobrien * This product includes software developed by the University of 31119418Sobrien * California, Berkeley and its contributors. 32119418Sobrien * 4. Neither the name of the University nor the names of its contributors 3355205Speter * may be used to endorse or promote products derived from this software 3438061Smsmith * without specific prior written permission. 3538061Smsmith * 3655939Snsouch * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 3755939Snsouch * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3838061Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3938061Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 4038061Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4155205Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4238061Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4342475Snsouch * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4442475Snsouch * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 4555939Snsouch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 4638061Smsmith * SUCH DAMAGE. 4738061Smsmith * 4838061Smsmith * @(#)varargs.h 8.3 (Berkeley) 3/22/94 4938061Smsmith * $FreeBSD: head/sys/sparc64/include/varargs.h 139825 2005-01-07 02:29:27Z imp $ 5055939Snsouch */ 5155939Snsouch 5238061Smsmith#ifndef _MACHINE_VARARGS_H_ 5338061Smsmith#define _MACHINE_VARARGS_H_ 5438061Smsmith 5538061Smsmith#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) 5638061Smsmith 5738061Smsmith#include <sys/_types.h> 5838061Smsmith 5938061Smsmith#ifndef _VA_LIST_DECLARED 6038061Smsmith#define _VA_LIST_DECLARED 6138061Smsmithtypedef __va_list va_list; 6238061Smsmith#endif 6338061Smsmith 6438061Smsmithtypedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); 6538061Smsmith 6638061Smsmith#define va_alist __builtin_va_alist 6738061Smsmith#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... 6838061Smsmith#define va_start(ap) __builtin_varargs_start(ap) 6938061Smsmith#define va_arg(ap, type) __builtin_va_arg((ap), type) 7038061Smsmith#define va_end(ap) __builtin_va_end(ap) 7138061Smsmith 7238061Smsmith#else /* ! __GNUC__ post GCC 2.95 */ 7338061Smsmith 7438061Smsmith#include <machine/stdarg.h> 7538061Smsmith 7638061Smsmith#if __GNUC__ == 1 7738061Smsmith#define __va_ellipsis 7838061Smsmith#else 7938061Smsmith#define __va_ellipsis ... 8038061Smsmith#endif 8138061Smsmith 8238061Smsmith#define va_alist __builtin_va_alist 8338061Smsmith#define va_dcl long __builtin_va_alist; __va_ellipsis 8439134Snsouch 8539134Snsouch#undef va_start 8638061Smsmith#define va_start(ap) \ 8738061Smsmith ((ap) = (va_list)__builtin_saveregs()) 8838061Smsmith 8938061Smsmith#endif /* __GNUC__ post GCC 2.95 */ 9038061Smsmith 9138061Smsmith#endif /* !_MACHINE_VARARGS_H_ */ 9238061Smsmith