Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/include - don't try to to lint the va_arg() m...



details:   https://anonhg.NetBSD.org/src/rev/f0c5bae80605
branches:  trunk
changeset: 572350:f0c5bae80605
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 30 16:22:27 2004 +0000

description:
- don't try to to lint the va_arg() macros, instead replace them.
- replace the va_start() macro for lint

diffstat:

 sys/arch/sparc/include/stdarg.h |  53 ++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 26 deletions(-)

diffs (117 lines):

diff -r 937890be2e9e -r f0c5bae80605 sys/arch/sparc/include/stdarg.h
--- a/sys/arch/sparc/include/stdarg.h   Thu Dec 30 15:38:50 2004 +0000
+++ b/sys/arch/sparc/include/stdarg.h   Thu Dec 30 16:22:27 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stdarg.h,v 1.20 2003/08/07 16:29:41 agc Exp $ */
+/*     $NetBSD: stdarg.h,v 1.21 2004/12/30 16:22:27 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -49,14 +49,12 @@
 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 __alignof__(t)                 (0)
+# define va_start(ap, last) (ap) = (va_list)(void *)&(last)
+#else
+# define va_start(ap, last) \
+       (void)(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
 #endif
 
-#define        va_start(ap, last) \
-       (void)(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
 
 #if !defined(_ANSI_SOURCE) &&                                          \
     (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L ||   \
@@ -68,20 +66,23 @@
 #define va_end(ap)     
 
 #ifdef __arch64__
+# ifdef __lint__
+#  define va_arg(ap, type)     (*(type *)(void *)(ap)) 
+# else /* !__lint__ */
 /*
  * For sparcv9 code.
  */
-#define __va_arg8(ap, type) \
+#  define __va_arg8(ap, type) \
        (*(type *)(void *)((ap) += 8, (ap) - 8))
-#define __va_arg16(ap, type) \
+#  define __va_arg16(ap, type) \
        (*(type *)(void *)((ap) = (va_list)(((unsigned long)(ap) + 31) & -16),\
                           (ap) - 16))
-#define __va_int(ap, type) \
+#  define __va_int(ap, type) \
        (*(type *)(void *)((ap) += 8, (ap) - sizeof(type)))
 
-#define __REAL_TYPE_CLASS      8
-#define        __RECORD_TYPE_CLASS     12
-#define va_arg(ap, type) \
+#  define __REAL_TYPE_CLASS    8
+#  define __RECORD_TYPE_CLASS  12
+#  define va_arg(ap, type) \
        (__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS ?     \
         (__alignof__(type) == 16 ? __va_arg16(ap, type) :              \
          __va_arg8(ap, type)) :                                        \
@@ -90,12 +91,15 @@
          (sizeof(type) <= 8 ? __va_arg8(ap, type) :                    \
           (sizeof(type) <= 16 ? __va_arg16(ap, type) :                 \
            *__va_arg8(ap, type *)))))
-
+# endif /* __lint__ */
 #else /* __arch64__ */
 /* 
  * For sparcv8 code.
  */
-#define        __va_size(type) \
+# ifdef __lint__
+#  define va_arg(ap, type)     (*(type *)(void *)(ap)) 
+# else /* !__lint__ */
+#  define __va_size(type) \
        (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
 
 /*
@@ -114,13 +118,10 @@
  * have a constructor.
  */
 
-#ifdef __lint__
-# define va_arg(ap, type)      (*(type *)(void *)(ap)) 
-#else /* !__lint__ */
-# if __GNUC__ < 2
-#  define __extension__                /* delete __extension__ if non-gcc or gcc1 */
-# endif
-# define __va_8byte(ap, type) \
+#  if __GNUC__ < 2
+#   define __extension__       /* delete __extension__ if non-gcc or gcc1 */
+#  endif
+#  define __va_8byte(ap, type) \
        __extension__ ({                                                \
                union { char __d[sizeof(type)]; int __i[2]; } __va_u;   \
                __va_u.__i[0] = ((int *)(void *)(ap))[0];               \
@@ -128,18 +129,18 @@
                (ap) += 8; *(type *)(va_list)__va_u.__d;                \
        })
 
-# define __va_arg(ap, type) \
+#  define __va_arg(ap, type) \
        (*(type *)((ap) += __va_size(type),                     \
                   (ap) - (sizeof(type) < sizeof(long) &&       \
                           sizeof(type) != __va_size(type) ?    \
                           sizeof(type) : __va_size(type))))
 
-# define __RECORD_TYPE_CLASS   12
-# define va_arg(ap, type) \
+#  define __RECORD_TYPE_CLASS  12
+#  define va_arg(ap, type) \
        (__builtin_classify_type(*(type *)0) >= __RECORD_TYPE_CLASS ?   \
         *__va_arg(ap, type *) : __va_size(type) == 8 ?                 \
         __va_8byte(ap, type) : __va_arg(ap, type))
-#endif /* __lint__ */
+# endif /* __lint__ */
 
 #endif /* __arch64__ */
 



Home | Main Index | Thread Index | Old Index