This is the mail archive of the 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]
Other format: [Raw text]

[RFA] Warnings roundup

I ran through an --enable-targets=all --enable-64-bit-bfd build today, with
--enable-build-warnings=-Werror,.  The results were not as bad as they could
have been, but not exactly great either.

Here's the BFD directory.  Three that I have patches for, attached:

 - coff-rs6000.c: Two uninitialized variable warnings.  They're both
  false paths, but expecting a compiler to see that is a little too much
  to ask, I think.  Initialized both to NULL.

 - elf32-sh.c: A signed/unsigned comparison warning. 
  _bfd_elf_section_from_bfd_section can return -1 for failure, but
  that's OK here, so cast appropriately.

 - trad-core.c: We cast a pointer from struct user to a bfd_vma.  I
  silenced a warning by casting to "long" first.  It's certainly not
  correct in the general case, but I think it's right for all targets
  which include trad-core.

Are those OK to commit?

Others I did not fix in bfd/:  Some sh64 warnings which I pointed out to
Alexandre, and a worrying warning in elf32-hppa.c:
../../branch-src/bfd/elf32-hppa.c: In function `elf32_hppa_check_relocs':
../../branch-src/bfd/elf32-hppa.c:1506: warning: suggest parentheses around && within ||

Someone more ELF-wise than I should look at that last and establish the
right solution.

Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-02-10  Daniel Jacobowitz  <>

	* coff-rs6000.c (xcoff_generate_rtinit): Silence uninitialized
	variable warnings.
	* elf32-sh.c (sh_elf_relax_section): Silence signed/unsigned
	comparison warning.
	* trad-core.c (trad_unix_core_file_p): Silence pointer/integer
	cast warnings for the common case.

Index: bfd/coff-rs6000.c
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.29
diff -u -p -r1.29 coff-rs6000.c
--- coff-rs6000.c	2002/01/08 00:28:36	1.29
+++ coff-rs6000.c	2002/02/10 18:20:36
@@ -3062,7 +3062,7 @@ xcoff_generate_rtinit  (abfd, init, fini
   bfd_byte reloc_ext[RELSZ * 2];
   bfd_byte *data_buffer;
   bfd_size_type data_buffer_size;
-  bfd_byte *string_table, *st_tmp;
+  bfd_byte *string_table = NULL, *st_tmp = NULL;
   bfd_size_type string_table_size;
   bfd_vma val;
   size_t initsz, finisz;
Index: bfd/elf32-sh.c
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.42
diff -u -p -r1.42 elf32-sh.c
--- elf32-sh.c	2002/02/08 05:33:23	1.42
+++ elf32-sh.c	2002/02/10 18:20:36
@@ -2066,7 +2066,8 @@ sh_elf_relax_section (abfd, sec, link_in
 	  shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0);
 	  bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
-	  if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec))
+	  if (isym.st_shndx
+	      != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec))
 	       (_("%s: 0x%lx: warning: symbol in unexpected section"),
Index: bfd/trad-core.c
RCS file: /cvs/src/src/bfd/trad-core.c,v
retrieving revision 1.11
diff -u -p -r1.11 trad-core.c
--- trad-core.c	2002/01/05 13:11:33	1.11
+++ trad-core.c	2002/02/10 18:20:36
@@ -211,7 +211,7 @@ trad_unix_core_file_p (abfd)
      0 is at the place pointed to by u_ar0 (by setting the vma of the start
      of the section to -u_ar0).  GDB uses this info to locate the regs,
      using minor trickery to get around the offset-or-absolute-addr problem.  */
-  core_regsec (abfd)->vma = - (bfd_vma) u.u_ar0;
+  core_regsec (abfd)->vma = - (bfd_vma) (unsigned long) u.u_ar0;
   core_datasec (abfd)->filepos = NBPG * UPAGES;
   core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize

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