Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/include Make stdarg/varargs work with GCC 2.96.



details:   https://anonhg.NetBSD.org/src/rev/3b7418d7f82e
branches:  trunk
changeset: 485996:3b7418d7f82e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed May 10 17:53:45 2000 +0000

description:
Make stdarg/varargs work with GCC 2.96.

diffstat:

 sys/arch/alpha/include/ansi.h    |   8 +++++++-
 sys/arch/alpha/include/stdarg.h  |  27 ++++++++++++++++++++-------
 sys/arch/alpha/include/varargs.h |  10 +++++++---
 3 files changed, 34 insertions(+), 11 deletions(-)

diffs (125 lines):

diff -r 566e3995b14d -r 3b7418d7f82e sys/arch/alpha/include/ansi.h
--- a/sys/arch/alpha/include/ansi.h     Wed May 10 17:22:46 2000 +0000
+++ b/sys/arch/alpha/include/ansi.h     Wed May 10 17:53:45 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi.h,v 1.10 1998/04/27 17:39:10 kleink Exp $ */
+/* $NetBSD: ansi.h,v 1.11 2000/05/10 17:53:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,6 +38,8 @@
 #ifndef        _ANSI_H_
 #define        _ANSI_H_
 
+#include <sys/cdefs.h>
+
 /*
  * Types which are fundamental to the implementation and may appear in
  * more than one standard header are defined here.  Standard headers
@@ -52,12 +54,16 @@
 #define        _BSD_SIZE_T_            unsigned long   /* sizeof() */
 #define        _BSD_SSIZE_T_           long            /* byte count or error */
 #define        _BSD_TIME_T_            int             /* time() */
+#if __GNUC_PREREQ__(2, 96)
+#define        _BSD_VA_LIST_           __builtin_va_list /* GCC built-in type */
+#else
 typedef struct {
        char *__base;
        int __offset;
        int __pad;
 } __va_list;
 #define        _BSD_VA_LIST_           __va_list       /* va_list */
+#endif
 #define        _BSD_CLOCKID_T_         int             /* clockid_t */
 #define        _BSD_TIMER_T_           int             /* timer_t */
 #define        _BSD_SUSECONDS_T_       int             /* suseconds_t */
diff -r 566e3995b14d -r 3b7418d7f82e sys/arch/alpha/include/stdarg.h
--- a/sys/arch/alpha/include/stdarg.h   Wed May 10 17:22:46 2000 +0000
+++ b/sys/arch/alpha/include/stdarg.h   Wed May 10 17:53:45 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stdarg.h,v 1.10 2000/02/03 16:16:06 kleink Exp $ */
+/* $NetBSD: stdarg.h,v 1.11 2000/05/10 17:53:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,14 +41,24 @@
 #include <machine/ansi.h>
 #include <sys/featuretest.h>
 
+typedef _BSD_VA_LIST_  va_list;
+
 #ifdef __lint__
 #define        __builtin_saveregs()            (0)
 #define        __builtin_classify_type(t)      (0)
 #define        __builtin_next_arg(t)           ((t) ? 0 : 0)
+#define        __builtin_stdarg_start(a, l)    ((a) = ((l) ? 0 : 0))
+#define        __builtin_va_arg(a, t)          ((a) ? 0 : 0)
+#define        __builtin_va_end                /* nothing */
+#define        __builtin_va_copy(d, s)         ((d) = (s))
 #endif
 
-typedef _BSD_VA_LIST_  va_list;
-
+#if __GNUC_PREREQ__(2, 96)
+#define        va_start(ap, last)      __builtin_stdarg_start((ap), (last))
+#define        va_arg                  __builtin_va_arg
+#define        va_end                  __builtin_va_end
+#define        __va_copy(dest, src)    __builtin_va_copy((dest), (src))
+#else
 #define        __va_size(type) \
        (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
 
@@ -64,13 +74,16 @@
        (*(type *)((ap).__offset += __va_size(type),                    \
                   (ap).__base + (ap).__offset + __va_arg_offset(ap, type)))
 
+#define        va_end(ap)      
+
+#define        __va_copy(dest, src)                                            \
+       ((dest) = (src))
+#endif
+
 #if !defined(_ANSI_SOURCE) &&                                          \
     (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) ||           \
      defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L)
-#define        va_copy(dest, src)                                              \
-       ((dest) = (src))
+#define        va_copy(dest, src)      __va_copy((dest), (src))
 #endif
 
-#define        va_end(ap)      
-
 #endif /* !_ALPHA_STDARG_H_ */
diff -r 566e3995b14d -r 3b7418d7f82e sys/arch/alpha/include/varargs.h
--- a/sys/arch/alpha/include/varargs.h  Wed May 10 17:22:46 2000 +0000
+++ b/sys/arch/alpha/include/varargs.h  Wed May 10 17:53:45 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: varargs.h,v 1.7 1997/04/06 08:47:46 cgd Exp $ */
+/* $NetBSD: varargs.h,v 1.8 2000/05/10 17:53:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -45,17 +45,21 @@
 
 #include <machine/stdarg.h>
 
-#if __GNUC__ == 1
+#if !__GNUC_PREREQ__(2, 0)
 #define        __va_ellipsis
 #else
 #define        __va_ellipsis   ...
 #endif
 
 #define        va_alist        __builtin_va_alist
-#define        va_dcl          long __builtin_va_alist; __va_ellipsis
+#define        va_dcl          __builtin_va_alist_t __builtin_va_alist; __va_ellipsis
 
 #undef va_start
+#if __GNUC_PREREQ__(2, 96)
+#define        va_start(ap)    __builtin_varargs_start((ap))
+#else
 #define        va_start(ap) \
        ((ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0)
+#endif
 
 #endif /* !_ALPHA_VARARGS_H_ */



Home | Main Index | Thread Index | Old Index