From: bothner@cygnus.com
Subject: Re: patch for binutils/size.c to print unsigned long rather than ints
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 14 Dec 1992 14:58:24 GMT

> One could argue that bfd_size_type is more appropriate in some
> situations.

I think so, so that is what I did.
Please try the appended patch instead.

	--Per Bothner
Cygnus Support     bothner@cygnus.com

===================================================================
RCS file: /rel/cvsfiles/devo/binutils/size.c,v
retrieving revision 1.11
diff -c -r1.11 size.c
*** 1.11	1992/11/05 12:01:43
--- size.c	1992/12/15 06:53:20
***************
*** 234,251 ****
  /* This is what lexical functions are for */
  void
  lprint_number (width, num)
!      int width, num;
  {
!   printf ((radix == decimal ? "%-*d\t" :
! 	   ((radix == octal) ? "%-*o\t" : "%-*x\t")), width, num);
  }
  
  void
  rprint_number(width, num)
!      int width, num;
  {
!   printf ((radix == decimal ? "%*d\t" :
! 	   ((radix == octal) ? "%*o\t" : "%*x\t")), width, num);
  }
  
  static char *bss_section_name = ".bss";
--- 234,253 ----
  /* This is what lexical functions are for */
  void
  lprint_number (width, num)
!      int width;
!      bfd_size_type num;
  {
!   printf ((radix == decimal ? "%-*ld\t" :
! 	   ((radix == octal) ? "%-*lo\t" : "%-*lx\t")), width, (long)num);
  }
  
  void
  rprint_number(width, num)
!      int width;
!      bfd_size_type num;
  {
!   printf ((radix == decimal ? "%*ld\t" :
! 	   ((radix == octal) ? "%*lo\t" : "%*lx\t")), width, (long)num);
  }
  
  static char *bss_section_name = ".bss";
***************
*** 260,269 ****
    sec_ptr bsssection = NULL;
    sec_ptr datasection = NULL;
    sec_ptr textsection = NULL;
!   unsigned long bsssize = 0;
!   unsigned long datasize = 0;
!   unsigned long textsize = 0;
!   unsigned long total = 0;
  
    
    if ((textsection = bfd_get_section_by_name (abfd, text_section_name))
--- 262,271 ----
    sec_ptr bsssection = NULL;
    sec_ptr datasection = NULL;
    sec_ptr textsection = NULL;
!   bfd_size_type bsssize = 0;
!   bfd_size_type datasize = 0;
!   bfd_size_type textsize = 0;
!   bfd_size_type total = 0;
  
    
    if ((textsection = bfd_get_section_by_name (abfd, text_section_name))
***************
*** 302,308 ****
    lprint_number (7, textsize);
    lprint_number (7, datasize);
    lprint_number (7, bsssize);
!   printf (((radix == octal) ? "%-7o\t%-7x\t" : "%-7d\t%-7x\t"), total, total);
  
    fputs(bfd_get_filename(abfd), stdout);
    if (abfd->my_archive) printf (" (ex %s)", abfd->my_archive->filename);
--- 304,311 ----
    lprint_number (7, textsize);
    lprint_number (7, datasize);
    lprint_number (7, bsssize);
!   printf (((radix == octal) ? "%-7lo\t%-7lx\t" : "%-7ld\t%-7lx\t"),
! 	  (long)total, (long)total);
  
    fputs(bfd_get_filename(abfd), stdout);
    if (abfd->my_archive) printf (" (ex %s)", abfd->my_archive->filename);
***************
*** 309,315 ****
  }
  
  /* I REALLY miss lexical functions! */
! int svi_total = 0;
  
  void
  sysv_internal_printer(file, sec, ignore)
--- 312,318 ----
  }
  
  /* I REALLY miss lexical functions! */
! bfd_size_type svi_total = 0;
  
  void
  sysv_internal_printer(file, sec, ignore)
***************
*** 317,323 ****
       sec_ptr sec;
       PTR ignore;
  {
!   int size = bfd_section_size (file, sec);
    if (sec!= &bfd_abs_section 
        && sec!= &bfd_com_section
        && sec!=&bfd_und_section) 
--- 320,326 ----
       sec_ptr sec;
       PTR ignore;
  {
!   bfd_size_type size = bfd_section_size (file, sec);
    if (sec!= &bfd_abs_section 
        && sec!= &bfd_com_section
        && sec!=&bfd_und_section) 

Newsgroups: gnu.utils.bug