varargs.h (119628) | varargs.h (143063) |
---|---|
1/*- 2 * Copyright (c) 2002 David E. O'Brien. All rights reserved. 3 * Copyright (c) 2000 Tsubai Masanari. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 27 * $NetBSD: varargs.h,v 1.5 2000/02/27 17:50:22 tsubai Exp $ | 1/*- 2 * Copyright (c) 2002 David E. O'Brien. All rights reserved. 3 * Copyright (c) 2000 Tsubai Masanari. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 27 * $NetBSD: varargs.h,v 1.5 2000/02/27 17:50:22 tsubai Exp $ |
28 * $FreeBSD: head/sys/powerpc/include/varargs.h 119628 2003-09-01 03:01:45Z kan $ | 28 * $FreeBSD: head/sys/powerpc/include/varargs.h 143063 2005-03-02 21:33:29Z joerg $ |
29 */ 30 31#ifndef _MACHINE_VARARGS_H_ 32#define _MACHINE_VARARGS_H_ 33 | 29 */ 30 31#ifndef _MACHINE_VARARGS_H_ 32#define _MACHINE_VARARGS_H_ 33 |
34#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) | 34#ifndef _SYS_CDEFS_H_ 35#error this file needs sys/cdefs.h as a prerequisite 36#endif |
35 | 37 |
38#if defined(__GNUCLIKE_BUILTIN_VARARGS) 39 |
|
36#include <sys/_types.h> 37 38#ifndef _VA_LIST_DECLARED 39#define _VA_LIST_DECLARED 40typedef __va_list va_list; 41#endif 42 43typedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); 44 45#define va_alist __builtin_va_alist 46#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... 47#define va_start(ap) __builtin_varargs_start(ap) 48#define va_arg(ap, type) __builtin_va_arg((ap), type) 49#define va_end(ap) __builtin_va_end(ap) 50 | 40#include <sys/_types.h> 41 42#ifndef _VA_LIST_DECLARED 43#define _VA_LIST_DECLARED 44typedef __va_list va_list; 45#endif 46 47typedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); 48 49#define va_alist __builtin_va_alist 50#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... 51#define va_start(ap) __builtin_varargs_start(ap) 52#define va_arg(ap, type) __builtin_va_arg((ap), type) 53#define va_end(ap) __builtin_va_end(ap) 54 |
51#else /* ! __GNUC__ post GCC 2.95 */ | 55#else /* ! __GNUCLIKE_BUILTIN_VARARGS */ |
52 53#include <machine/stdarg.h> 54 | 56 57#include <machine/stdarg.h> 58 |
59#ifdef __GNUCLIKE_BUILTIN_VAALIST |
|
55#define va_alist __builtin_va_alist 56#define va_dcl int __builtin_va_alist; ... | 60#define va_alist __builtin_va_alist 61#define va_dcl int __builtin_va_alist; ... |
62#else 63#error this file needs to be ported to your compiler 64#endif |
|
57 58#undef va_start 59 60#ifdef __lint__ 61#define va_start(ap) ((ap) = *(va_list *)0) 62#else 63#define va_start(ap) \ 64 ((ap).__stack = __va_stack_args, \ 65 (ap).__base = __va_reg_args, \ 66 (ap).__gpr = __va_first_gpr, \ 67 (ap).__fpr = __va_first_fpr) 68#endif 69 | 65 66#undef va_start 67 68#ifdef __lint__ 69#define va_start(ap) ((ap) = *(va_list *)0) 70#else 71#define va_start(ap) \ 72 ((ap).__stack = __va_stack_args, \ 73 (ap).__base = __va_reg_args, \ 74 (ap).__gpr = __va_first_gpr, \ 75 (ap).__fpr = __va_first_fpr) 76#endif 77 |
70#endif /* __GNUC__ post GCC 2.95 */ | 78#endif /* __GNUCLIKE_BUILTIN_VARARGS */ |
71 72#endif /* _MACHINE_VARARGS_H_ */ | 79 80#endif /* _MACHINE_VARARGS_H_ */ |