Subject: botch in sparc stdarg.h?
To: None <port-sparc@NetBSD.ORG>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-sparc
Date: 12/29/1995 10:33:10
There appears to be a slight botch in the sparc stdarg.h.  I had to make 
the following change to get it to compile under the stock (gcc 2.4.5) 
compiler:

Index: stdarg.h
===================================================================
RCS file: /mastersrc/netbsd/src/sys/arch/sparc/include/stdarg.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 stdarg.h
*** stdarg.h	1995/12/27 23:57:45	1.1.1.1
--- stdarg.h	1995/12/29 01:57:53
***************
*** 56,65 ****
  
  #ifdef __GCC_NEW_VARARGS__
  #define	va_start(ap, last) \
! 	(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
  #else
  #define	va_start(ap, last) \
! 	(__builtin_saveregs(), (ap) = (va_list)__builtin_next_arg(last))
  #endif
  
  /*
--- 56,65 ----
  
  #ifdef __GCC_NEW_VARARGS__
  #define	va_start(ap, last) \
! 	(__builtin_next_arg(), (ap) = (va_list)__builtin_saveregs())
  #else
  #define	va_start(ap, last) \
! 	(__builtin_saveregs(), (ap) = (va_list)__builtin_next_arg())
  #endif
  
  /*

The revision log shows the following:

revision 1.7
date: 1995/12/25 22:24:54;  author: mycroft;  state: Exp;  lines: +37 -49
Update for GCC 2.7, and fix bugs.

This is the revision where the "last" argument was added to 
__builtin_next_arg().  Does gcc 2.7.2 require the "last" arg?  It is 
certainly not correct for 2.4.5, and I have a hard time believing that 
the gcc folks would have changed the semantics of it like that...

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939