This is the mail archive of the binutils@sourceware.org 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]

mainline gcc vs printf args


Current gcc mainline warns about passing a long as a printf argument
for a %lx format.  It wants an unsigned long instead.  I think that's
ridiculously fussy, but decided to fix binutils sources anyhow.

bfd/
	* coff-ppc.c, coffgen.c, ecoff.c, ecofflink.c, elf.c, elf32-frv.c,
	elf32-iq2000.c, elf32-m32c.c, elf32-mep.c, elf32-mt.c,
	elf32-sh-symbian.c, elf64-hppa.c, mach-o.c, peXXigen.c, pef.c,
	ppcboot.c, vms-misc.c, xsym.c: Silence gcc warnings.
binutils/
	* dlltool.c, dwarf.c, objdump.c, readelf.c, resrc.c, resres.c,
	windmc.c: Silence gcc warnings.
gas/
	* messages.c, symbols.c, write.c: Silence gcc warnings.
gprof/
	* corefile.c, symtab.c: Silence gcc warnings.
ld/
	* emultempl/pe.em, emultempl/pep.em: Silence gcc warnings.
opcodes/
	* bfin-dis.c, cris-dis.c, i386-dis.c, or32-opc.c: Silence gcc warnings.


Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.34
diff -u -p -r1.34 coff-ppc.c
--- bfd/coff-ppc.c	15 Oct 2007 02:00:11 -0000	1.34
+++ bfd/coff-ppc.c	29 Jul 2008 11:57:26 -0000
@@ -1566,8 +1566,8 @@ dump_toc (vfile)
 	    {
 	      fprintf (file,
 		      _("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
-		       global_toc_size, global_toc_size,
-		       thunk_size, thunk_size);
+		       global_toc_size, (unsigned long) global_toc_size,
+		       thunk_size, (unsigned long) thunk_size);
 	      cat = _("Out of bounds!");
 	    }
 	}
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.65
diff -u -p -r1.65 coffgen.c
--- bfd/coffgen.c	13 Aug 2007 01:45:11 -0000	1.65
+++ bfd/coffgen.c	29 Jul 2008 11:57:27 -0000
@@ -1946,7 +1946,7 @@ coff_print_symbol (bfd *abfd,
 		    /* Probably a section symbol ?  */
 		    {
 		      fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d",
-			       (long) auxp->u.auxent.x_scn.x_scnlen,
+			       (unsigned long) auxp->u.auxent.x_scn.x_scnlen,
 			       auxp->u.auxent.x_scn.x_nreloc,
 			       auxp->u.auxent.x_scn.x_nlinno);
 		      if (auxp->u.auxent.x_scn.x_checksum != 0
@@ -1972,7 +1972,8 @@ coff_print_symbol (bfd *abfd,
 		      llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
 		      fprintf (file,
 			       "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld",
-			       tagndx, auxp->u.auxent.x_sym.x_misc.x_fsize,
+			       tagndx,
+			       (unsigned long) auxp->u.auxent.x_sym.x_misc.x_fsize,
 			       llnos, next);
 		      break;
 		    }
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.60
diff -u -p -r1.60 ecoff.c
--- bfd/ecoff.c	15 Feb 2008 03:35:52 -0000	1.60
+++ bfd/ecoff.c	29 Jul 2008 11:57:39 -0000
@@ -1038,7 +1038,7 @@ ecoff_emit_aggregate (bfd *abfd,
   sprintf (string,
 	   "%s %s { ifd = %u, index = %lu }",
 	   which, name, ifd,
-	   ((long) indx
+	   ((unsigned long) indx
 	    + debug_info->symbolic_header.iextMax));
 }
 
Index: bfd/ecofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/ecofflink.c,v
retrieving revision 1.23
diff -u -p -r1.23 ecofflink.c
--- bfd/ecofflink.c	3 Jul 2007 14:26:40 -0000	1.23
+++ bfd/ecofflink.c	29 Jul 2008 11:57:40 -0000
@@ -718,7 +718,8 @@ bfd_ecoff_debug_accumulate (handle, outp
 	  lookup = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 20);
 	  if (lookup == NULL)
 	    return FALSE;
-	  sprintf (lookup, "%s %lx %lx", name, fdr.csym, fdr.caux);
+	  sprintf (lookup, "%s %lx %lx", name, (unsigned long) fdr.csym,
+		   (unsigned long) fdr.caux);
 
 	  fh = string_hash_lookup (&ainfo->fdr_hash, lookup, TRUE, TRUE);
 	  free (lookup);
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.458
diff -u -p -r1.458 elf.c
--- bfd/elf.c	27 Jul 2008 03:43:51 -0000	1.458
+++ bfd/elf.c	29 Jul 2008 11:57:45 -0000
@@ -1393,7 +1393,7 @@ bfd_elf_print_symbol (bfd *abfd,
     case bfd_print_symbol_more:
       fprintf (file, "elf ");
       bfd_fprintf_vma (abfd, file, symbol->value);
-      fprintf (file, " %lx", (long) symbol->flags);
+      fprintf (file, " %lx", (unsigned long) symbol->flags);
       break;
     case bfd_print_symbol_all:
       {
@@ -7836,7 +7836,7 @@ elfcore_grok_win32pstatus (bfd *abfd, El
       /* Make a ".module/xxxxxxxx" section.  */
       /* module_info.base_address */
       base_addr = bfd_get_32 (abfd, note->descdata + 4);
-      sprintf (buf, ".module/%08lx", (long) base_addr);
+      sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
 
       len = strlen (buf) + 1;
       name = bfd_alloc (abfd, len);
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.62
diff -u -p -r1.62 elf32-frv.c
--- bfd/elf32-frv.c	21 Jul 2008 14:36:07 -0000	1.62
+++ bfd/elf32-frv.c	29 Jul 2008 11:57:50 -0000
@@ -6838,7 +6838,7 @@ frv_elf_print_private_bfd_data (abfd, pt
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  fprintf (file, _("private flags = 0x%lx:"), (long)flags);
+  fprintf (file, _("private flags = 0x%lx:"), (unsigned long) flags);
 
   switch (flags & EF_FRV_CPU_MASK)
     {
Index: bfd/elf32-iq2000.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-iq2000.c,v
retrieving revision 1.25
diff -u -p -r1.25 elf32-iq2000.c
--- bfd/elf32-iq2000.c	12 Feb 2008 19:11:55 -0000	1.25
+++ bfd/elf32-iq2000.c	29 Jul 2008 11:57:50 -0000
@@ -886,7 +886,7 @@ iq2000_elf_print_private_bfd_data (bfd *
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  fprintf (file, _("private flags = 0x%lx:"), (long)flags);
+  fprintf (file, _("private flags = 0x%lx:"), (unsigned long) flags);
 
   switch (flags & EF_IQ2000_CPU_MASK)
     {
Index: bfd/elf32-m32c.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32c.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf32-m32c.c
--- bfd/elf32-m32c.c	12 Jun 2008 19:49:48 -0000	1.17
+++ bfd/elf32-m32c.c	29 Jul 2008 11:57:50 -0000
@@ -847,7 +847,7 @@ m32c_elf_print_private_bfd_data (bfd *ab
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  fprintf (file, _("private flags = 0x%lx:"), (long)flags);
+  fprintf (file, _("private flags = 0x%lx:"), (unsigned long) flags);
 
   switch (flags & EF_M32C_CPU_MASK)
     {
Index: bfd/elf32-mep.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mep.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf32-mep.c
--- bfd/elf32-mep.c	19 Nov 2007 02:19:39 -0000	1.9
+++ bfd/elf32-mep.c	29 Jul 2008 11:57:50 -0000
@@ -706,7 +706,7 @@ mep_elf_print_private_bfd_data (bfd * ab
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  fprintf (file, _("private flags = 0x%lx"), (long)flags);
+  fprintf (file, _("private flags = 0x%lx"), (unsigned long) flags);
 
   partial_flags = (flags & EF_MEP_CPU_MASK) >> 24;
   if (partial_flags < ARRAY_SIZE (core_names))
Index: bfd/elf32-mt.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mt.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-mt.c
--- bfd/elf32-mt.c	28 Sep 2007 08:43:45 -0000	1.11
+++ bfd/elf32-mt.c	29 Jul 2008 11:57:51 -0000
@@ -580,7 +580,7 @@ mt_elf_print_private_bfd_data (bfd * abf
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  fprintf (file, _("private flags = 0x%lx:"), (long)flags);
+  fprintf (file, _("private flags = 0x%lx:"), (unsigned long) flags);
 
   switch (flags & EF_MT_CPU_MASK)
     {
Index: bfd/elf32-sh-symbian.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh-symbian.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf32-sh-symbian.c
--- bfd/elf32-sh-symbian.c	3 Jul 2007 14:26:41 -0000	1.12
+++ bfd/elf32-sh-symbian.c	29 Jul 2008 11:57:51 -0000
@@ -605,7 +605,8 @@ sh_symbian_relocate_section (bfd *      
 		BFD_ASSERT (ptr->new_symndx);
 		if (SYMBIAN_DEBUG)
 		  fprintf (stderr, "convert reloc %lx from using index %ld to using index %ld\n",
-			   (long) rel->r_info, (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx);
+			   (unsigned long) rel->r_info,
+			   (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx);
 		rel->r_info = ELF32_R_INFO (ptr->new_symndx, r_type);
 		break;
 	      }
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.86
diff -u -p -r1.86 elf64-hppa.c
--- bfd/elf64-hppa.c	30 May 2008 16:13:53 -0000	1.86
+++ bfd/elf64-hppa.c	29 Jul 2008 11:57:55 -0000
@@ -514,7 +514,7 @@ get_dyn_name (abfd, h, rel, pbuf, plen)
     {
       nlen = sprintf (buf, "%x:%lx",
 		      sec->id & 0xffffffff,
-		      (long) ELF64_R_SYM (rel->r_info));
+		      (unsigned long) ELF64_R_SYM (rel->r_info));
       if (rel->r_addend)
 	{
 	  buf[nlen++] = '+';
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.27
diff -u -p -r1.27 mach-o.c
--- bfd/mach-o.c	20 Feb 2008 17:42:36 -0000	1.27
+++ bfd/mach-o.c	29 Jul 2008 11:57:56 -0000
@@ -556,7 +556,7 @@ bfd_mach_o_write_contents (bfd *abfd)
 	default:
 	  fprintf (stderr,
 		   "unable to write unknown load command 0x%lx\n",
-		   (long) cur->type);
+		   (unsigned long) cur->type);
 	  return FALSE;
 	}
     }
@@ -1576,7 +1576,7 @@ bfd_mach_o_object_p (bfd *abfd)
 	 || header.byteorder == BFD_ENDIAN_LITTLE))
     {
       fprintf (stderr, "unknown header byte-order value 0x%lx\n",
-	       (long) header.byteorder);
+	       (unsigned long) header.byteorder);
       goto wrong;
     }
 
@@ -1623,7 +1623,7 @@ bfd_mach_o_core_p (bfd *abfd)
 	 || header.byteorder == BFD_ENDIAN_LITTLE))
     {
       fprintf (stderr, "unknown header byte-order value 0x%lx\n",
-	       (long) header.byteorder);
+	       (unsigned long) header.byteorder);
       abort ();
     }
 
Index: bfd/peXXigen.c
===================================================================
RCS file: /cvs/src/src/bfd/peXXigen.c,v
retrieving revision 1.45
diff -u -p -r1.45 peXXigen.c
--- bfd/peXXigen.c	21 Jul 2008 14:09:57 -0000	1.45
+++ bfd/peXXigen.c	29 Jul 2008 11:57:57 -0000
@@ -1310,7 +1310,7 @@ pe_print_idata (bfd * abfd, void * vfile
 		  && first_thunk != 0
 		  && first_thunk != hint_addr)
 		fprintf (file, "\t%04lx",
-			 (long) bfd_get_32 (abfd, ft_data + ft_idx + j));
+			 (unsigned long) bfd_get_32 (abfd, ft_data + ft_idx + j));
 	      fprintf (file, "\n");
 	    }
 #else
@@ -1342,7 +1342,7 @@ pe_print_idata (bfd * abfd, void * vfile
 		  && first_thunk != 0
 		  && first_thunk != hint_addr)
 		fprintf (file, "\t%04lx",
-			 (long) bfd_get_32 (abfd, ft_data + ft_idx + j));
+			 (unsigned long) bfd_get_32 (abfd, ft_data + ft_idx + j));
 
 	      fprintf (file, "\n");
 	    }
@@ -1961,7 +1961,7 @@ pe_print_reloc (bfd * abfd, void * vfile
 
       fprintf (file,
 	       _("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
-	       (unsigned long) virtual_address, size, size, number);
+	       (unsigned long) virtual_address, size, (unsigned long) size, number);
 
       for (j = 0; j < number; ++j)
 	{
@@ -1974,7 +1974,7 @@ pe_print_reloc (bfd * abfd, void * vfile
 
 	  fprintf (file,
 		   _("\treloc %4d offset %4x [%4lx] %s"),
-		   j, off, (long) (off + virtual_address), tbl[t]);
+		   j, off, (unsigned long) (off + virtual_address), tbl[t]);
 
 	  /* HIGHADJ takes an argument, - the next record *is* the
 	     low 16 bits of addend.  */
@@ -2064,11 +2064,11 @@ _bfd_XX_print_private_bfd_data_common (b
     fprintf (file, "\t(%s)",name);
   fprintf (file, "\nMajorLinkerVersion\t%d\n", i->MajorLinkerVersion);
   fprintf (file, "MinorLinkerVersion\t%d\n", i->MinorLinkerVersion);
-  fprintf (file, "SizeOfCode\t\t%08lx\n", i->SizeOfCode);
+  fprintf (file, "SizeOfCode\t\t%08lx\n", (unsigned long) i->SizeOfCode);
   fprintf (file, "SizeOfInitializedData\t%08lx\n",
-	   i->SizeOfInitializedData);
+	   (unsigned long) i->SizeOfInitializedData);
   fprintf (file, "SizeOfUninitializedData\t%08lx\n",
-	   i->SizeOfUninitializedData);
+	   (unsigned long) i->SizeOfUninitializedData);
   fprintf (file, "AddressOfEntryPoint\t");
   fprintf_vma (file, i->AddressOfEntryPoint);
   fprintf (file, "\nBaseOfCode\t\t");
@@ -2091,10 +2091,10 @@ _bfd_XX_print_private_bfd_data_common (b
   fprintf (file, "MinorImageVersion\t%d\n", i->MinorImageVersion);
   fprintf (file, "MajorSubsystemVersion\t%d\n", i->MajorSubsystemVersion);
   fprintf (file, "MinorSubsystemVersion\t%d\n", i->MinorSubsystemVersion);
-  fprintf (file, "Win32Version\t\t%08lx\n", i->Reserved1);
-  fprintf (file, "SizeOfImage\t\t%08lx\n", i->SizeOfImage);
-  fprintf (file, "SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
-  fprintf (file, "CheckSum\t\t%08lx\n", i->CheckSum);
+  fprintf (file, "Win32Version\t\t%08lx\n", (unsigned long) i->Reserved1);
+  fprintf (file, "SizeOfImage\t\t%08lx\n", (unsigned long) i->SizeOfImage);
+  fprintf (file, "SizeOfHeaders\t\t%08lx\n", (unsigned long) i->SizeOfHeaders);
+  fprintf (file, "CheckSum\t\t%08lx\n", (unsigned long) i->CheckSum);
 
   switch (i->Subsystem)
     {
@@ -2149,15 +2149,16 @@ _bfd_XX_print_private_bfd_data_common (b
   fprintf_vma (file, i->SizeOfHeapReserve);
   fprintf (file, "\nSizeOfHeapCommit\t");
   fprintf_vma (file, i->SizeOfHeapCommit);
-  fprintf (file, "\nLoaderFlags\t\t%08lx\n", i->LoaderFlags);
-  fprintf (file, "NumberOfRvaAndSizes\t%08lx\n", i->NumberOfRvaAndSizes);
+  fprintf (file, "\nLoaderFlags\t\t%08lx\n", (unsigned long) i->LoaderFlags);
+  fprintf (file, "NumberOfRvaAndSizes\t%08lx\n",
+	   (unsigned long) i->NumberOfRvaAndSizes);
 
   fprintf (file, "\nThe Data Directory\n");
   for (j = 0; j < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; j++)
     {
       fprintf (file, "Entry %1x ", j);
       fprintf_vma (file, i->DataDirectory[j].VirtualAddress);
-      fprintf (file, " %08lx ", i->DataDirectory[j].Size);
+      fprintf (file, " %08lx ", (unsigned long) i->DataDirectory[j].Size);
       fprintf (file, "%s\n", dir_names[j]);
     }
 
Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.23
diff -u -p -r1.23 pef.c
--- bfd/pef.c	3 Jul 2007 14:26:42 -0000	1.23
+++ bfd/pef.c	29 Jul 2008 11:57:58 -0000
@@ -186,7 +186,7 @@ bfd_pef_parse_traceback_table (bfd *abfd
     offset += 4;
 
   if (file != NULL)
-    fprintf (file, " [length = 0x%lx]", (long) offset);
+    fprintf (file, " [length = 0x%lx]", (unsigned long) offset);
 
   return offset;
 }
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.29
diff -u -p -r1.29 ppcboot.c
--- bfd/ppcboot.c	3 Jul 2007 14:26:42 -0000	1.29
+++ bfd/ppcboot.c	29 Jul 2008 11:57:58 -0000
@@ -412,8 +412,10 @@ ppcboot_bfd_print_private_bfd_data (abfd
   int i;
 
   fprintf (f, _("\nppcboot header:\n"));
-  fprintf (f, _("Entry offset        = 0x%.8lx (%ld)\n"), entry_offset, entry_offset);
-  fprintf (f, _("Length              = 0x%.8lx (%ld)\n"), length, length);
+  fprintf (f, _("Entry offset        = 0x%.8lx (%ld)\n"),
+	   (unsigned long) entry_offset, entry_offset);
+  fprintf (f, _("Length              = 0x%.8lx (%ld)\n"),
+	   (unsigned long) length, length);
 
   if (tdata->header.flags)
     fprintf (f, _("Flag field          = 0x%.2x\n"), tdata->header.flags);
@@ -453,8 +455,10 @@ ppcboot_bfd_print_private_bfd_data (abfd
 	       tdata->header.partition[i].partition_end.sector,
 	       tdata->header.partition[i].partition_end.cylinder);
 
-      fprintf (f, _("Partition[%d] sector = 0x%.8lx (%ld)\n"), i, sector_begin, sector_begin);
-      fprintf (f, _("Partition[%d] length = 0x%.8lx (%ld)\n"), i, sector_length, sector_length);
+      fprintf (f, _("Partition[%d] sector = 0x%.8lx (%ld)\n"),
+	       i, (unsigned long) sector_begin, sector_begin);
+      fprintf (f, _("Partition[%d] length = 0x%.8lx (%ld)\n"),
+	       i, (unsigned long) sector_length, sector_length);
     }
 
   fprintf (f, "\n");
Index: bfd/vms-misc.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-misc.c,v
retrieving revision 1.28
diff -u -p -r1.28 vms-misc.c
--- bfd/vms-misc.c	20 Feb 2008 17:42:36 -0000	1.28
+++ bfd/vms-misc.c	29 Jul 2008 11:57:59 -0000
@@ -875,7 +875,7 @@ hash_string (const char *ptr)
 char *
 _bfd_vms_length_hash_symbol (bfd * abfd, const char *in, int maxlen)
 {
-  long int result;
+  unsigned long result;
   int in_len;
   char *new_name;
   const char *old_name;
Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.22
diff -u -p -r1.22 xsym.c
--- bfd/xsym.c	3 Jul 2007 14:26:43 -0000	1.22
+++ bfd/xsym.c	29 Jul 2008 11:57:59 -0000
@@ -1640,7 +1640,7 @@ bfd_sym_print_type_information (bfd *abf
 		       bfd_sym_symbol_name (abfd, tinfo.nte_index)[0],
 		       &bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]);
 	  }
-	fprintf (f, " (TTE %lu)", value);
+	fprintf (f, " (TTE %lu)", (unsigned long) value);
 	break;
       }
 
@@ -1701,13 +1701,13 @@ bfd_sym_print_type_information (bfd *abf
 	  fprintf (f, "union (0x%x) of ", type);
 
 	bfd_sym_fetch_long (buf, len, offset, &offset, &nrec);
-	fprintf (f, "%lu elements: ", nrec);
+	fprintf (f, "%lu elements: ", (unsigned long) nrec);
 
 	for (i = 0; i < nrec; i++)
 	  {
 	    bfd_sym_fetch_long (buf, len, offset, &offset, &eloff);
 	    fprintf (f, "\n                ");
-	    fprintf (f, "offset %lu: ", eloff);
+	    fprintf (f, "offset %lu: ", (unsigned long) eloff);
 	    bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
 	  }
 	break;
@@ -1735,7 +1735,7 @@ bfd_sym_print_type_information (bfd *abf
 		 bfd_sym_symbol_name (abfd, value)[0],
 		 &bfd_sym_symbol_name (abfd, value)[1]);
 
-      fprintf (f, " (NTE %lu) with type ", value);
+      fprintf (f, " (NTE %lu) with type ", (unsigned long) value);
       bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
       break;
     }
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.81
diff -u -p -r1.81 dlltool.c
--- binutils/dlltool.c	28 Mar 2008 06:49:44 -0000	1.81
+++ binutils/dlltool.c	29 Jul 2008 11:58:12 -0000
@@ -1604,7 +1604,7 @@ flush_page (FILE *f, long *need, int pag
 
   for (i = 0; i < on_page; i++)
     {
-      long needed = need[i];
+      unsigned long needed = need[i];
 
       if (needed)
 	needed = ((needed - page_addr) | 0x3000) & 0xffff;
@@ -1826,8 +1826,8 @@ gen_exp_file (void)
     {
       fprintf (f, "\t.section	.edata\n\n");
       fprintf (f, "\t%s	0	%s Allways 0\n", ASM_LONG, ASM_C);
-      fprintf (f, "\t%s	0x%lx	%s Time and date\n", ASM_LONG, (long) time(0),
-	       ASM_C);
+      fprintf (f, "\t%s	0x%lx	%s Time and date\n", ASM_LONG,
+	       (unsigned long) time(0), ASM_C);
       fprintf (f, "\t%s	0	%s Major and Minor version\n", ASM_LONG, ASM_C);
       fprintf (f, "\t%sname%s	%s Ptr to name of dll\n", ASM_RVA_BEFORE, ASM_RVA_AFTER, ASM_C);
       fprintf (f, "\t%s	%d	%s Starting ordinal of exports\n", ASM_LONG, d_low_ord, ASM_C);
Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.36
diff -u -p -r1.36 dwarf.c
--- binutils/dwarf.c	10 Jul 2008 01:32:23 -0000	1.36
+++ binutils/dwarf.c	29 Jul 2008 11:58:14 -0000
@@ -1524,7 +1524,7 @@ read_and_display_attr_value (unsigned lo
 
 	if (uvalue >= section->size)
 	  warn (_("Offset %lx used as value for DW_AT_import attribute of DIE at offset %lx is too big.\n"),
-		uvalue, (long int)(orig_data - section->start));
+		uvalue, (unsigned long) (orig_data - section->start));
 	else
 	  {
 	    unsigned long abbrev_number;
@@ -3109,10 +3109,12 @@ display_debug_loc (struct dwarf_section 
 	    {
 	      if (start < next)
 		warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"),
-		      (long)(start - section_begin), (long)(next - section_begin));
+		      (unsigned long) (start - section_begin),
+		      (unsigned long) (next - section_begin));
 	      else if (start > next)
 		warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n"),
-		      (long)(start - section_begin), (long)(next - section_begin));
+		      (unsigned long) (start - section_begin),
+		      (unsigned long) (next - section_begin));
 	    }
 	  start = next;
 
@@ -3502,12 +3504,12 @@ display_debug_ranges (struct dwarf_secti
 	    {
 	      if (start < next)
 		warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"),
-		      (long)(start - section_begin),
-		      (long)(next - section_begin), section->name);
+		      (unsigned long) (start - section_begin),
+		      (unsigned long) (next - section_begin), section->name);
 	      else if (start > next)
 		warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"),
-		      (long)(start - section_begin),
-		      (long)(next - section_begin), section->name);
+		      (unsigned long) (start - section_begin),
+		      (unsigned long) (next - section_begin), section->name);
 	    }
 	  start = next;
 
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.144
diff -u -p -r1.144 objdump.c
--- binutils/objdump.c	15 Jul 2008 18:48:34 -0000	1.144
+++ binutils/objdump.c	29 Jul 2008 11:58:16 -0000
@@ -1428,7 +1428,8 @@ disassemble_bytes (struct disassemble_in
 	  if (display_file_offsets && ((addr_offset + (octets / opb)) < stop_offset))
 	    printf ("\t... (skipping %d zeroes, resuming at file offset: 0x%lx)\n",
 		    octets / opb,
-		    (long int)(section->filepos + (addr_offset + (octets / opb))));
+		    (unsigned long) (section->filepos
+				     + (addr_offset + (octets / opb))));
 	  else
 	    printf ("\t...\n");
 	}
@@ -2563,7 +2564,8 @@ dump_section (bfd *abfd, asection *secti
   
   printf (_("Contents of section %s:"), section->name);
   if (display_file_offsets)
-    printf (_("  (Starting at file offset: 0x%lx)"), (long int)(section->filepos + start_offset));
+    printf (_("  (Starting at file offset: 0x%lx)"),
+	    (unsigned long) (section->filepos + start_offset));
   printf ("\n");
 
   data = xmalloc (datasize);
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.419
diff -u -p -r1.419 readelf.c
--- binutils/readelf.c	28 Jul 2008 04:14:40 -0000	1.419
+++ binutils/readelf.c	29 Jul 2008 11:58:20 -0000
@@ -310,7 +310,7 @@ get_data (void *var, FILE *file, long of
   if (fseek (file, archive_file_offset + offset, SEEK_SET))
     {
       error (_("Unable to seek to 0x%lx for %s\n"),
-	     archive_file_offset + offset, reason);
+	     (unsigned long) archive_file_offset + offset, reason);
       return NULL;
     }
 
@@ -3669,7 +3669,7 @@ offset_from_vma (FILE *file, bfd_vma vma
     }
 
   warn (_("Virtual address 0x%lx not located in any PT_LOAD segment.\n"),
-	(long) vma);
+	(unsigned long) vma);
   return (long) vma;
 }
 
@@ -5686,7 +5686,7 @@ dynamic_section_mips_val (Elf_Internal_D
       break;
 
     default:
-      printf ("%#lx\n", (long) entry->d_un.d_ptr);
+      printf ("%#lx\n", (unsigned long) entry->d_un.d_ptr);
     }
 }
 
@@ -9735,7 +9735,7 @@ process_gnu_liblist (FILE *file)
 
 	  printf (_("\nLibrary list section '%s' contains %lu entries:\n"),
 		  SECTION_NAME (section),
-		  (long) (section->sh_size / sizeof (Elf32_External_Lib)));
+		  (unsigned long) (section->sh_size / sizeof (Elf32_External_Lib)));
 
 	  puts ("     Library              Time Stamp          Checksum   Version Flags");
 
@@ -9995,7 +9995,7 @@ process_corefile_note_segment (FILE *fil
       if (((char *) next) > (((char *) pnotes) + length))
 	{
 	  warn (_("corrupt note found at offset %lx into core notes\n"),
-		(long)((char *)external - (char *)pnotes));
+		(unsigned long) ((char *) external - (char *) pnotes));
 	  warn (_(" type: %lx, namesize: %08lx, descsize: %08lx\n"),
 		inote.type, inote.namesz, inote.descsz);
 	  break;
Index: binutils/resrc.c
===================================================================
RCS file: /cvs/src/src/binutils/resrc.c,v
retrieving revision 1.34
diff -u -p -r1.34 resrc.c
--- binutils/resrc.c	8 Oct 2007 13:50:18 -0000	1.34
+++ binutils/resrc.c	29 Jul 2008 11:58:22 -0000
@@ -685,7 +685,8 @@ get_data (FILE *e, bfd_byte *p, rc_uint_
   if (got == c)
     return;
 
-  fatal (_("%s: read of %lu returned %lu"), msg, (long) c, (long) got);
+  fatal (_("%s: read of %lu returned %lu"),
+	 msg, (unsigned long) c, (unsigned long) got);
 }
 
 /* Define an accelerator resource.  */
@@ -3061,10 +3062,10 @@ write_rc_datablock (FILE *e, rc_uint_typ
 		      {
 	      if (k == 0)
 		plen  = fprintf (e, "0x%lxL",
-				 (long) windres_get_32 (&wrtarget, data + i, length - i));
+				 (unsigned long) windres_get_32 (&wrtarget, data + i, length - i));
 			else
 		plen = fprintf (e, " 0x%lxL",
-				(long) windres_get_32 (&wrtarget, data + i, length - i)) - 1;
+				(unsigned long) windres_get_32 (&wrtarget, data + i, length - i)) - 1;
 	      if (has_next || (i + 4) < length)
 			  {
 		  if (plen>0 && plen < 11)
@@ -3210,7 +3211,7 @@ write_rc_stringtable (FILE *e, const rc_
     {
       if (stringtable->strings[i].length != 0)
 	{
-	  fprintf (e, "  %lu, ", (long) offset + i);
+	  fprintf (e, "  %lu, ", (unsigned long) offset + i);
 	  unicode_print_quoted (e, stringtable->strings[i].string,
 			 stringtable->strings[i].length);
 	  fprintf (e, "\n");
Index: binutils/resres.c
===================================================================
RCS file: /cvs/src/src/binutils/resres.c,v
retrieving revision 1.12
diff -u -p -r1.12 resres.c
--- binutils/resres.c	7 Jul 2008 00:44:41 -0000	1.12
+++ binutils/resres.c	29 Jul 2008 11:58:23 -0000
@@ -155,8 +155,8 @@ write_res_file (const char *fn,const rc_
 					  (const rc_res_id *) NULL,
 					  &language, 1);
   if (sec_length != sec_length_wrote)
-    fatal ("res write failed with different sizes (%lu/%lu).", (long) sec_length,
-    	   (long) sec_length_wrote);
+    fatal ("res write failed with different sizes (%lu/%lu).",
+	   (unsigned long) sec_length, (unsigned long) sec_length_wrote);
 
   bfd_close (abfd);
   return;
Index: binutils/windmc.c
===================================================================
RCS file: /cvs/src/src/binutils/windmc.c,v
retrieving revision 1.4
diff -u -p -r1.4 windmc.c
--- binutils/windmc.c	7 Jul 2008 00:44:41 -0000	1.4
+++ binutils/windmc.c	29 Jul 2008 11:58:23 -0000
@@ -381,7 +381,8 @@ convert_unicode_to_ACP (const unichar *u
     return NULL;
   codepage_from_unicode (&l, usz, &s, mcset_codepage_out);
   if (! s)
-    fatal ("unicode string not mappable to ASCII codepage 0x%lx.\n", (long) mcset_codepage_out);
+    fatal ("unicode string not mappable to ASCII codepage 0x%lx.\n",
+	   (unsigned long) mcset_codepage_out);
   return s;
 }
 
@@ -803,8 +804,8 @@ write_rc (FILE *fp)
   int i, l;
 
   fprintf (fp,
-    "/* Do not edit this file manually.\n"
-    "   This file is autogenerated by windmc.  */\n\n");
+	   "/* Do not edit this file manually.\n"
+	   "   This file is autogenerated by windmc.  */\n\n");
   if (! mc_nodes_lang_count)
     return;
   n = NULL;
@@ -816,10 +817,11 @@ write_rc (FILE *fp)
       ++i;
       n = mc_nodes_lang[l];
       fprintf (fp, "\n// Country: %s\n// Language: %s\n#pragma code_page(%u)\n",
-	n->lang->lang_info.country, n->lang->lang_info.name,
-	(unsigned) n->lang->lang_info.wincp);
-      fprintf (fp, "LANGUAGE 0x%lx, 0x%lx\n", (long) (n->lang->nval & 0x3ff),
-	(long) ((n->lang->nval & 0xffff) >> 10));
+	       n->lang->lang_info.country, n->lang->lang_info.name,
+	       (unsigned) n->lang->lang_info.wincp);
+      fprintf (fp, "LANGUAGE 0x%lx, 0x%lx\n",
+	       (unsigned long) (n->lang->nval & 0x3ff),
+	       (unsigned long) ((n->lang->nval & 0xffff) >> 10));
       fprintf (fp, "1 MESSAGETABLE \"");
       if (mcset_prefix_bin)
 	fprintf (fp, "%s_", mcset_mc_basename);
Index: gas/messages.c
===================================================================
RCS file: /cvs/src/src/gas/messages.c,v
retrieving revision 1.20
diff -u -p -r1.20 messages.c
--- gas/messages.c	3 Jul 2007 11:01:03 -0000	1.20
+++ gas/messages.c	29 Jul 2008 11:58:28 -0000
@@ -500,9 +500,9 @@ as_internal_value_out_of_range (char *  
       if (sizeof (val) > sizeof (bfd_vma))
 	abort ();
 
-      sprintf_vma (val_buf, val);
-      sprintf_vma (min_buf, min);
-      sprintf_vma (max_buf, max);
+      sprintf_vma (val_buf, (bfd_vma) val);
+      sprintf_vma (min_buf, (bfd_vma) min);
+      sprintf_vma (max_buf, (bfd_vma) max);
 
       /* xgettext:c-format.  */
       err = _("%s out of range (0x%s is not between 0x%s and 0x%s)");
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.88
diff -u -p -r1.88 symbols.c
--- gas/symbols.c	3 Mar 2008 15:28:58 -0000	1.88
+++ gas/symbols.c	29 Jul 2008 11:58:29 -0000
@@ -2791,7 +2791,7 @@ print_symbol_value_1 (FILE *file, symbol
 
       if (s != undefined_section
 	  && s != expr_section)
-	fprintf (file, " %lx", (long) S_GET_VALUE (sym));
+	fprintf (file, " %lx", (unsigned long) S_GET_VALUE (sym));
     }
   else if (indent_level < max_indent_level
 	   && S_GET_SEGMENT (sym) != undefined_section)
@@ -2800,7 +2800,7 @@ print_symbol_value_1 (FILE *file, symbol
       fprintf (file, "\n%*s<", indent_level * 4, "");
       if (LOCAL_SYMBOL_CHECK (sym))
 	fprintf (file, "constant %lx",
-		 (long) ((struct local_symbol *) sym)->lsy_value);
+		 (unsigned long) ((struct local_symbol *) sym)->lsy_value);
       else
 	print_expr_1 (file, &sym->sy_value);
       fprintf (file, ">");
@@ -2844,7 +2844,7 @@ print_expr_1 (FILE *file, expressionS *e
       fprintf (file, "absent");
       break;
     case O_constant:
-      fprintf (file, "constant %lx", (long) exp->X_add_number);
+      fprintf (file, "constant %lx", (unsigned long) exp->X_add_number);
       break;
     case O_symbol:
       indent_level++;
@@ -2854,7 +2854,7 @@ print_expr_1 (FILE *file, expressionS *e
     maybe_print_addnum:
       if (exp->X_add_number)
 	fprintf (file, "\n%*s%lx", indent_level * 4, "",
-		 (long) exp->X_add_number);
+		 (unsigned long) exp->X_add_number);
       indent_level--;
       break;
     case O_register:
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.116
diff -u -p -r1.116 write.c
--- gas/write.c	24 Jun 2008 01:49:36 -0000	1.116
+++ gas/write.c	29 Jul 2008 11:58:30 -0000
@@ -2516,7 +2516,8 @@ print_fixup (fixS *fixp)
   fprintf_vma (stderr, (bfd_vma) ((bfd_hostptr_t) fixp->fx_frag));
   fprintf (stderr, " where=%ld offset=%lx addnumber=%lx",
 	   (long) fixp->fx_where,
-	   (long) fixp->fx_offset, (long) fixp->fx_addnumber);
+	   (unsigned long) fixp->fx_offset,
+	   (unsigned long) fixp->fx_addnumber);
   fprintf (stderr, "\n    %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_type),
 	   fixp->fx_r_type);
   if (fixp->fx_addsy)
Index: gprof/corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.30
diff -u -p -r1.30 corefile.c
--- gprof/corefile.c	19 Jun 2008 16:30:29 -0000	1.30
+++ gprof/corefile.c	29 Jul 2008 11:58:44 -0000
@@ -427,7 +427,8 @@ get_src_info (bfd_vma addr, const char *
   else
     {
       DBG (AOUTDEBUG, printf ("[get_src_info] no info for 0x%lx (%s:%d,%s)\n",
-			      (long) addr, fname ? fname : "<unknown>", l,
+			      (unsigned long) addr,
+			      fname ? fname : "<unknown>", l,
 			      func_name ? func_name : "<unknown>"));
       return FALSE;
     }
Index: gprof/symtab.c
===================================================================
RCS file: /cvs/src/src/gprof/symtab.c,v
retrieving revision 1.13
diff -u -p -r1.13 symtab.c
--- gprof/symtab.c	6 Jul 2007 10:40:34 -0000	1.13
+++ gprof/symtab.c	29 Jul 2008 11:58:45 -0000
@@ -164,8 +164,9 @@ symtab_finalize (Sym_Table *tab)
        for (j = 0; j < tab->len; ++j)
 	 {
 	   printf ("[symtab_finalize] 0x%lx-0x%lx\t%s\n",
-		 (long) tab->base[j].addr, (long) tab->base[j].end_addr,
-		 tab->base[j].name);
+		   (unsigned long) tab->base[j].addr,
+		   (unsigned long) tab->base[j].end_addr,
+		   tab->base[j].name);
 	 }
   );
 }
@@ -176,7 +177,7 @@ symtab_finalize (Sym_Table *tab)
 Sym *
 dbg_sym_lookup (Sym_Table *sym_tab, bfd_vma address)
 {
-  long low, mid, high;
+  unsigned long low, mid, high;
   Sym *sym;
 
   fprintf (stderr, "[dbg_sym_lookup] address 0x%lx\n",
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.131
diff -u -p -r1.131 pe.em
--- ld/emultempl/pe.em	15 Feb 2008 03:35:53 -0000	1.131
+++ ld/emultempl/pe.em	29 Jul 2008 11:58:54 -0000
@@ -885,7 +885,7 @@ make_import_fixup (arelent *rel, asectio
 
   if (pe_dll_extra_pe_debug)
     printf ("arelent: %s@%#lx: add=%li\n", sym->name,
-	    (long) rel->address, (long) rel->addend);
+	    (unsigned long) rel->address, (long) rel->addend);
 
   if (! bfd_get_section_contents (s->owner, s, addend, rel->address, sizeof (addend)))
     einfo (_("%C: Cannot get section contents - auto-import exception\n"),
Index: ld/emultempl/pep.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pep.em,v
retrieving revision 1.10
diff -u -p -r1.10 pep.em
--- ld/emultempl/pep.em	9 May 2008 11:56:31 -0000	1.10
+++ ld/emultempl/pep.em	29 Jul 2008 11:58:55 -0000
@@ -844,7 +844,7 @@ make_import_fixup (arelent *rel, asectio
 
   if (pep_dll_extra_pe_debug)
     printf ("arelent: %s@%#lx: add=%li\n", sym->name,
-	    (long) rel->address, (long) rel->addend);
+	    (unsigned long) rel->address, (long) rel->addend);
 
   if (! bfd_get_section_contents (s->owner, s, addend, rel->address, sizeof (addend)))
     einfo (_("%C: Cannot get section contents - auto-import exception\n"),
Index: opcodes/bfin-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/bfin-dis.c,v
retrieving revision 1.8
diff -u -p -r1.8 bfin-dis.c
--- opcodes/bfin-dis.c	26 Mar 2008 16:48:32 -0000	1.8
+++ opcodes/bfin-dis.c	29 Jul 2008 11:59:06 -0000
@@ -148,7 +148,7 @@ fmtconst (const_forms_t cf, TIword x, bf
        }
      else
        {
-	  sprintf (buf, "%lx", x);
+	  sprintf (buf, "%lx", (unsigned long) x);
 	  return buf;
        }
     }
@@ -186,7 +186,7 @@ fmtconst (const_forms_t cf, TIword x, bf
       if (constant_formats[cf].issigned && x < 0)
 	sprintf (buf, "-0x%x", abs (x));
       else
-	sprintf (buf, "0x%lx", x);
+	sprintf (buf, "0x%lx", (unsigned long) x);
     }
 
   return buf;
Index: opcodes/cris-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/cris-dis.c,v
retrieving revision 1.18
diff -u -p -r1.18 cris-dis.c
--- opcodes/cris-dis.c	5 Jul 2007 09:49:00 -0000	1.18
+++ opcodes/cris-dis.c	29 Jul 2008 11:59:07 -0000
@@ -581,7 +581,10 @@ static char *
 format_dec (long number, char *outbuffer, int signedp)
 {
   last_immediate = number;
-  sprintf (outbuffer, signedp ? "%ld" : "%lu", number);
+  if (signedp)
+    sprintf (outbuffer, "%ld", number);
+  else
+    sprintf (outbuffer, "%lu", (unsigned long) number);
 
   return outbuffer + strlen (outbuffer);
 }
Index: opcodes/i386-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-dis.c,v
retrieving revision 1.179
diff -u -p -r1.179 i386-dis.c
--- opcodes/i386-dis.c	2 May 2008 16:53:40 -0000	1.179
+++ opcodes/i386-dis.c	29 Jul 2008 11:59:11 -0000
@@ -11234,7 +11234,7 @@ print_displacement (char *buf, bfd_vma d
   buf[j++] = '0';
   buf[j++] = 'x';
 
-  sprintf_vma (tmp, val);
+  sprintf_vma (tmp, (bfd_vma) val);
   for (i = 0; tmp[i] == '0'; i++)
     continue;
   if (tmp[i] == '\0')
Index: opcodes/or32-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/or32-opc.c,v
retrieving revision 1.7
diff -u -p -r1.7 or32-opc.c
--- opcodes/or32-opc.c	5 Jul 2007 09:49:02 -0000	1.7
+++ opcodes/or32-opc.c	29 Jul 2008 11:59:11 -0000
@@ -586,7 +586,8 @@ cover_insn (unsigned long * cur, int pas
 	  c = cover_insn (cur, curpass, mask & (~(cur_mask << best_first)));
 	  if (c)
 	    {
-	      debug (8, "%li> #%X -> %lu\n", (long)(next - automata), i, (long)(cur - automata));
+	      debug (8, "%li> #%X -> %lu\n", (long)(next - automata), i,
+		     (unsigned long)(cur - automata));
 	      *next = cur - automata;
 	      cur = c;	 
 	    }

-- 
Alan Modra
Australia Development Lab, IBM


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