This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: readelf.c won't compile with HP-UX 11.00's cc


Hi Alexandre,

> Mainline readelf.c contains invalid C code.  The result of a type cast
> isn't an lvalue, but we pass the result of a cast to GET_DATA_ALLOC as
> the `var' argument, that is assigned to.  This compiles with GCC, as
> an extension, but some other compilers barf.  This patch fixes it so
> that it compiles.  Ok to install?

I would still like to eliminate the compile time warning message which
the cast was trying to remove.  How about this version instead ?

Cheers
        Nick

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src//src/binutils/readelf.c,v
retrieving revision 1.91
diff -p -r1.91 readelf.c
*** readelf.c	2001/02/11 23:11:39	1.91
--- readelf.c	2001/02/28 01:10:07
*************** typedef int Elf32_Word;
*** 280,289 ****
        return 0;								\
      } 									\
   									\
!   if (fread (var, size, 1, file) != 1) 					\
      { 									\
        error (_("Unable to read in %d bytes of %s\n"), size, reason); 	\
!       free (var); 							\
        var = NULL;							\
        return 0; 							\
      }
--- 280,289 ----
        return 0;								\
      } 									\
   									\
!   if (fread ((char *) var, size, 1, file) != 1) 			\
      { 									\
        error (_("Unable to read in %d bytes of %s\n"), size, reason); 	\
!       free ((char *) var); 						\
        var = NULL;							\
        return 0; 							\
      }
*************** process_unwind (file)
*** 3392,3398 ****
  	  strsec = section_headers + sec->sh_link;
  	  aux.strtab_size = strsec->sh_size;
  	  GET_DATA_ALLOC (strsec->sh_offset, aux.strtab_size,
! 			  (char *) aux.strtab, char *, "string table");
  	}
        else if (sec->sh_type == SHT_IA_64_UNWIND)
  	unwsec = sec;
--- 3392,3398 ----
  	  strsec = section_headers + sec->sh_link;
  	  aux.strtab_size = strsec->sh_size;
  	  GET_DATA_ALLOC (strsec->sh_offset, aux.strtab_size,
! 			  aux.strtab, const char *, "string table");
  	}
        else if (sec->sh_type == SHT_IA_64_UNWIND)
  	unwsec = sec;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]