varargs.h revision 23184
11543Srgrimes/*- 21543Srgrimes * Copyright (c) 1990, 1993 31543Srgrimes * The Regents of the University of California. All rights reserved. 41543Srgrimes * (c) UNIX System Laboratories, Inc. 51543Srgrimes * All or some portions of this file are derived from material licensed 61543Srgrimes * to the University of California by American Telephone and Telegraph 71543Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 81543Srgrimes * the permission of UNIX System Laboratories, Inc. 91543Srgrimes * 101543Srgrimes * Redistribution and use in source and binary forms, with or without 111543Srgrimes * modification, are permitted provided that the following conditions 121543Srgrimes * are met: 131543Srgrimes * 1. Redistributions of source code must retain the above copyright 141543Srgrimes * notice, this list of conditions and the following disclaimer. 151543Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161543Srgrimes * notice, this list of conditions and the following disclaimer in the 171543Srgrimes * documentation and/or other materials provided with the distribution. 181543Srgrimes * 3. All advertising materials mentioning features or use of this software 191543Srgrimes * must display the following acknowledgement: 201543Srgrimes * This product includes software developed by the University of 211543Srgrimes * California, Berkeley and its contributors. 221543Srgrimes * 4. Neither the name of the University nor the names of its contributors 231543Srgrimes * may be used to endorse or promote products derived from this software 241543Srgrimes * without specific prior written permission. 251543Srgrimes * 261543Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271543Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281543Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291543Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301543Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311543Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321543Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331543Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341543Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351543Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361543Srgrimes * SUCH DAMAGE. 371543Srgrimes * 381543Srgrimes * @(#)varargs.h 8.2 (Berkeley) 3/22/94 3923184Sbde * $Id: varargs.h,v 1.5 1997/02/22 09:35:22 peter Exp $ 401543Srgrimes */ 411543Srgrimes 421543Srgrimes#ifndef _VARARGS_H_ 431543Srgrimes#define _VARARGS_H_ 441543Srgrimes 451543Srgrimestypedef char *va_list; 461543Srgrimes 4722415Sphk#ifdef __GNUC__ 4823184Sbde#define va_alist __builtin_va_alist 4923184Sbde#endif 5023184Sbde#if __GNUC__ > 1 5122415Sphk#define va_dcl int va_alist; ... 5223184Sbde#else 5322415Sphk#define va_dcl int va_alist; 5422415Sphk#endif 551543Srgrimes 561543Srgrimes#define va_start(ap) \ 571543Srgrimes ap = (char *)&va_alist 581543Srgrimes 591543Srgrimes#ifdef KERNEL 601543Srgrimes#define va_arg(ap, type) \ 611543Srgrimes ((type *)(ap += sizeof(type)))[-1] 621543Srgrimes#else 631543Srgrimes#define va_arg(ap, type) \ 641543Srgrimes ((type *)(ap += sizeof(type) < sizeof(int) ? \ 651543Srgrimes (abort(), 0) : sizeof(type)))[-1] 661543Srgrimes#endif 671543Srgrimes 681543Srgrimes#define va_end(ap) 691543Srgrimes 701543Srgrimes#endif /* !_VARARGS_H_ */ 71