Subject: printf woes
To: Simon Burge <simonb@telstra.com.au>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: port-pmax
Date: 02/18/1996 20:04:04
simon burge writes:

>I reported this on Feb 1.  After doing a "make build", the first thing
>I noticed was df has this problem (the %age field).
>
>I haven't had much of a chance to look at it (I now have a daughter
>that seems to be taking up a bit of time :-), but I know that
>/usr/include was installed properly.  For now, I'm just using the old
>libraries and current everyhing else.  That seems to work fine...

In case it's not clear, my hypothesis was that the new varargs.h and
stdarg.h simply don't work on a  mips CPU.   I have not yet had
time to rebuild a libc and verify that that's the case.  The libc
I built on Feb.3, using current libc source and an old  stdarg.h
and varargs.h, seems to work just fine.


Diffs between the stdarg.h I'm using (1.7) and the current revision
(1.10) follow.  Again, if someone could try this out, I'd appreciate
it.  (I'm at an ISOC conference all of the coming week.)

--Jonathan




Index: stdarg.h
===================================================================
RCS file: /a/cvsroot/src/sys/arch/pmax/include/stdarg.h,v
retrieving revision 1.7
retrieving revision 1.10
diff -c -r1.7 -r1.10
*** stdarg.h    1995/03/28 18:19:28     1.7
--- stdarg.h    1995/12/25 23:15:35     1.10
***************
*** 1,4 ****
! /*    $NetBSD: stdarg.h,v 1.7 1995/03/28 18:19:28 jtc Exp $   */
  
  /*-
   * Copyright (c) 1992, 1993
--- 1,4 ----
! /*    $NetBSD: stdarg.h,v 1.10 1995/12/25 23:15:35 mycroft Exp $      */
  
  /*-
   * Copyright (c) 1992, 1993
***************
*** 42,64 ****
  
  typedef _BSD_VA_LIST_ va_list;
  
! #define       __va_promote(type) \
!       (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
  
  #define       va_start(ap, last) \
!       (ap = ((char *)&(last) + __va_promote(last)))
  
- #ifdef _KERNEL
  #define       va_arg(ap, type) \
!       ((type *)(ap += sizeof(type)))[-1]
! #else
! #define       va_arg(ap, type) \
!       ((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
!               sizeof(type) > sizeof(int) ? \
!               (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
!               (abort(), 0)))[-1]
! #endif
  
! #define       va_end(ap)      ((void) 0)
  
  #endif /* !_PMAX_STDARG_H_ */
--- 42,56 ----
  
  typedef _BSD_VA_LIST_ va_list;
  
! #define       __va_size(type) \
!       (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
  
  #define       va_start(ap, last) \
!       ((ap) = (va_list)&(last) + __va_size(last))
  
  #define       va_arg(ap, type) \
!       (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
  
! #define       va_end(ap)      ((void)0)
  
  #endif /* !_PMAX_STDARG_H_ */