Annotation of sys/sys/varargs.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: varargs.h,v 1.2 2004/01/03 14:55:34 espie Exp $ */
! 2: /*
! 3: * Copyright (c) 2003, 2004 Marc espie <espie@openbsd.org>
! 4: *
! 5: * Permission to use, copy, modify, and distribute this software for any
! 6: * purpose with or without fee is hereby granted, provided that the above
! 7: * copyright notice and this permission notice appear in all copies.
! 8: *
! 9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
! 10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
! 12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
! 14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
! 15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 16: */
! 17:
! 18: #ifndef _VARARGS_H_
! 19: #define _VARARGS_H_
! 20:
! 21: #if defined(__GNUC__) && __GNUC__ >= 3
! 22: /* These macros implement traditional (non-ANSI) varargs
! 23: for GNU C. */
! 24:
! 25: #define va_alist __builtin_va_alist
! 26:
! 27: #define __va_ellipsis ...
! 28:
! 29: /* ??? We don't process attributes correctly in K&R argument context. */
! 30: typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
! 31:
! 32: /* ??? It would be nice to get rid of the ellipsis here. It causes
! 33: current_function_varargs to be set in cc1. */
! 34: #define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
! 35:
! 36: /* Define __gnuc_va_list, just as in stdarg.h. */
! 37:
! 38: #ifndef __GNUC_VA_LIST
! 39: #define __GNUC_VA_LIST
! 40: typedef __builtin_va_list __gnuc_va_list;
! 41: #endif
! 42:
! 43: #define va_start(v) __builtin_varargs_start((v))
! 44: #define va_end __builtin_va_end
! 45: #define va_arg __builtin_va_arg
! 46: #define __va_copy(d,s) __builtin_va_copy((d),(s))
! 47:
! 48: /* Define va_list from __gnuc_va_list. */
! 49:
! 50: typedef __gnuc_va_list va_list;
! 51:
! 52: #else
! 53: #include <machine/varargs.h>
! 54: #endif
! 55:
! 56: #endif /* _VARARGS_H_ */
CVSweb