Gcc 3.1 varargs support.

This commit is contained in:
David E. O'Brien 2002-05-10 02:12:04 +00:00
parent fc336fdfbb
commit c7e401fbc3
5 changed files with 56 additions and 16 deletions

View File

@ -1,7 +1,5 @@
/* $FreeBSD$ */
/* From: NetBSD: stdarg.h,v 1.7 1997/04/06 08:47:44 cgd Exp */
/*-
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@ -34,6 +32,7 @@
* SUCH DAMAGE.
*
* @(#)stdarg.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _MACHINE_STDARG_H_
@ -43,8 +42,15 @@
typedef _BSD_VA_LIST_ va_list;
#define va_start(list, parmN) __builtin_stdarg_start(list, parmN)
#define va_end __builtin_va_end
#define va_arg __builtin_va_arg
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_end(ap) \
__builtin_va_end(ap)
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -1,7 +1,5 @@
/* $FreeBSD$ */
/* From: NetBSD: varargs.h,v 1.7 1997/04/06 08:47:46 cgd Exp */
/*-
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
@ -39,19 +37,21 @@
* SUCH DAMAGE.
*
* @(#)varargs.h 8.2 (Berkeley) 3/22/94
* $FreeBSD$
*/
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#include <machine/stdarg.h>
#include <machine/ansi.h>
typedef _BSD_VA_LIST_ va_list;
typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_alist __builtin_va_alist
#define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
#undef va_start
#define va_start(ap) __builtin_varargs_start(&(ap))
#define va_alist __builtin_va_alist
#define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
#define va_start(ap) __builtin_varargs_start(ap)
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#endif /* !_MACHINE_VARARGS_H_ */

View File

@ -71,7 +71,7 @@
#define _BSD_OFF_T_ __int64_t /* file offset */
#define _BSD_PID_T_ int /* process [group] */
#if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 95)
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define _BSD_VA_LIST_ __builtin_va_list /* internally known to gcc */
#else
typedef struct {

View File

@ -1,4 +1,5 @@
/*-
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,6 +35,19 @@
typedef _BSD_VA_LIST_ va_list;
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#ifdef __lint__
#define va_start(ap, last) ((ap) = *(va_list *)0)
@ -117,4 +131,6 @@ typedef _BSD_VA_LIST_ va_list;
((dest) = (src))
#endif
#endif /* __GNUC__ post GCC 2.95 */
#endif /* _POWERPC_STDARG_H_ */

View File

@ -1,4 +1,5 @@
/*-
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,6 +31,21 @@
#ifndef _POWERPC_VARARGS_H_
#define _POWERPC_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#include <machine/ansi.h>
typedef _BSD_VA_LIST_ va_list;
typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_alist __builtin_va_alist
#define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
#define va_start(ap) __builtin_varargs_start(ap)
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#include <machine/stdarg.h>
#define va_alist __builtin_va_alist
@ -47,4 +63,6 @@
(ap).__fpr = __va_first_fpr)
#endif
#endif /* __GNUC__ post GCC 2.95 */
#endif /* _POWERPC_VARARGS_H_ */