From 0af1713e7cd57b52f6c81f73aa58934132198880 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 30 Jul 2008 04:34:58 +0000 Subject: Silence gcc printf warnings --- binutils/ChangeLog | 5 +++++ binutils/dlltool.c | 6 +++--- binutils/dwarf.c | 16 +++++++++------- binutils/objdump.c | 6 ++++-- binutils/readelf.c | 10 +++++----- binutils/resrc.c | 11 ++++++----- binutils/resres.c | 4 ++-- binutils/windmc.c | 16 +++++++++------- 8 files changed, 43 insertions(+), 31 deletions(-) (limited to 'binutils') diff --git a/binutils/ChangeLog b/binutils/ChangeLog index c902049..d4e71ae 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2008-07-30 Alan Modra + + * dlltool.c, dwarf.c, objdump.c, readelf.c, resrc.c, resres.c, + windmc.c: Silence gcc warnings. + 2008-07-28 Alan Modra * readelf.c (print_vma): Typo fix. diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 61361b7..505402b 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -1604,7 +1604,7 @@ flush_page (FILE *f, long *need, int page_addr, int on_page) 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); diff --git a/binutils/dwarf.c b/binutils/dwarf.c index d23fec2..26ab941 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -1524,7 +1524,7 @@ read_and_display_attr_value (unsigned long attribute, 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 *section, void *file) { 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_section *section, { 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; diff --git a/binutils/objdump.c b/binutils/objdump.c index 74a4198..d4c32c0 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1428,7 +1428,8 @@ disassemble_bytes (struct disassemble_info * info, 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 *section, void *dummy ATTRIBUTE_UNUSED) 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); diff --git a/binutils/readelf.c b/binutils/readelf.c index 5f3946e..80c5b03 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -310,7 +310,7 @@ get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb, 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, bfd_size_type size) } 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_Dyn *entry) 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 *file, bfd_vma offset, bfd_vma length) 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; diff --git a/binutils/resrc.c b/binutils/resrc.c index 8a5900b..fcd15c7 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -1,5 +1,5 @@ /* resrc.c -- read and write Windows rc files. - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007 + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -685,7 +685,8 @@ get_data (FILE *e, bfd_byte *p, rc_uint_type c, const char *msg) 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_type length, const bfd_byte *data, int has_ { 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_res_id *name, { 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"); diff --git a/binutils/resres.c b/binutils/resres.c index 0ae5694..2ad40b4 100644 --- a/binutils/resres.c +++ b/binutils/resres.c @@ -155,8 +155,8 @@ write_res_file (const char *fn,const rc_res_directory *resdir) (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; diff --git a/binutils/windmc.c b/binutils/windmc.c index 70c9160..283c265 100644 --- a/binutils/windmc.c +++ b/binutils/windmc.c @@ -381,7 +381,8 @@ convert_unicode_to_ACP (const unichar *usz) 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); -- cgit v1.1