varargs.h revision 22415
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 3921673Sjkh * $FreeBSD: head/sys/i386/include/varargs.h 22415 1997-02-07 20:22:15Z phk $ 401543Srgrimes */ 411543Srgrimes 421543Srgrimes#ifndef _VARARGS_H_ 431543Srgrimes#define _VARARGS_H_ 441543Srgrimes 451543Srgrimestypedef char *va_list; 461543Srgrimes 4722415Sphk#ifdef __GNUC__ 4822415Sphk#define va_alist __builtin_va_alist 4922415Sphk#define va_dcl int va_alist; ... 5022415Sphk#else /* !__GNUC__ */ 5122415Sphk#define va_dcl int va_alist; 5222415Sphk#endif 531543Srgrimes 541543Srgrimes#define va_start(ap) \ 551543Srgrimes ap = (char *)&va_alist 561543Srgrimes 571543Srgrimes#ifdef KERNEL 581543Srgrimes#define va_arg(ap, type) \ 591543Srgrimes ((type *)(ap += sizeof(type)))[-1] 601543Srgrimes#else 611543Srgrimes#define va_arg(ap, type) \ 621543Srgrimes ((type *)(ap += sizeof(type) < sizeof(int) ? \ 631543Srgrimes (abort(), 0) : sizeof(type)))[-1] 641543Srgrimes#endif 651543Srgrimes 661543Srgrimes#define va_end(ap) 671543Srgrimes 681543Srgrimes#endif /* !_VARARGS_H_ */ 69