diff options
author | Jim Wilson <wilson@tuliptree.org> | 2005-07-07 19:27:52 +0000 |
---|---|---|
committer | Jim Wilson <wilson@tuliptree.org> | 2005-07-07 19:27:52 +0000 |
commit | 0fd3a4776c8f607cc778cde80f9215089d36387e (patch) | |
tree | 0332cbbb13c41fc1834d3e17001dfd97936c7c81 /binutils/readelf.c | |
parent | 9968d831f9298e2dc60de7a77013c7b173441951 (diff) | |
download | gdb-0fd3a4776c8f607cc778cde80f9215089d36387e.zip gdb-0fd3a4776c8f607cc778cde80f9215089d36387e.tar.gz gdb-0fd3a4776c8f607cc778cde80f9215089d36387e.tar.bz2 |
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index 0f945dc..5b33470 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -264,7 +264,7 @@ static void (*byte_put) (unsigned char *, bfd_vma, int); #define streq(a,b) (strcmp ((a), (b)) == 0) #define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0) -static void +static void ATTRIBUTE_PRINTF_1 error (const char *message, ...) { va_list args; @@ -275,7 +275,7 @@ error (const char *message, ...) va_end (args); } -static void +static void ATTRIBUTE_PRINTF_1 warn (const char *message, ...) { va_list args; @@ -327,7 +327,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%x for %s\n"), + error (_("Unable to seek to 0x%lx for %s\n"), archive_file_offset + offset, reason); return NULL; } @@ -342,8 +342,8 @@ get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb, if (mvar == NULL) { - error (_("Out of memory allocating 0x%x bytes for %s\n"), - size * nmemb, reason); + error (_("Out of memory allocating 0x%lx bytes for %s\n"), + (unsigned long)(size * nmemb), reason); return NULL; } @@ -352,7 +352,8 @@ get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb, if (fread (mvar, size, nmemb, file) != nmemb) { - error (_("Unable to read in 0x%x bytes of %s\n"), size * nmemb, reason); + error (_("Unable to read in 0x%lx bytes of %s\n"), + (unsigned long)(size * nmemb), reason); if (mvar != var) free (mvar); return NULL; @@ -7453,7 +7454,7 @@ fetch_indirect_string (unsigned long offset) if (offset > debug_str_size) { - warn (_("DW_FORM_strp offset too big: %x\n"), offset); + warn (_("DW_FORM_strp offset too big: %lx\n"), offset); return _("<offset is too big>"); } @@ -8464,7 +8465,7 @@ read_and_display_attr_value (unsigned long attribute, break; default: - warn (_("Unrecognized form: %d\n"), form); + warn (_("Unrecognized form: %lu\n"), form); break; } @@ -9799,10 +9800,10 @@ display_debug_loc (Elf_Internal_Shdr *section, { if (start < next) warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"), - start - section_begin, next - section_begin); + (long)(start - section_begin), (long)(next - section_begin)); else if (start > next) warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n"), - start - section_begin, next - section_begin); + (long)(start - section_begin), (long)(next - section_begin)); } start = next; @@ -10152,10 +10153,10 @@ display_debug_ranges (Elf_Internal_Shdr *section, { if (start < next) warn (_("There is a hole [0x%lx - 0x%lx] in .debug_ranges section.\n"), - start - section_begin, next - section_begin); + (long)(start - section_begin), (long)(next - section_begin)); else if (start > next) warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_ranges section.\n"), - start - section_begin, next - section_begin); + (long)(start - section_begin), (long)(next - section_begin)); } start = next; @@ -10528,7 +10529,7 @@ display_debug_frames (Elf_Internal_Shdr *section, if (!cie) { - warn ("Invalid CIE pointer %08lx in FDE at %08lx\n", + warn ("Invalid CIE pointer %08lx in FDE at %p\n", cie_id, saved_start); start = block_end; fc->ncols = 0; @@ -11814,9 +11815,9 @@ process_corefile_note_segment (FILE *file, bfd_vma offset, bfd_vma length) if (((char *) next) > (((char *) pnotes) + length)) { - warn (_("corrupt note found at offset %x into core notes\n"), - ((char *) external) - ((char *) pnotes)); - warn (_(" type: %x, namesize: %08lx, descsize: %08lx\n"), + warn (_("corrupt note found at offset %lx into core notes\n"), + (long)((char *)external - (char *)pnotes)); + warn (_(" type: %lx, namesize: %08lx, descsize: %08lx\n"), inote.type, inote.namesz, inote.descsz); break; } @@ -12295,7 +12296,7 @@ process_archive (char *file_name, FILE *file) off = strtoul (arhdr.ar_name + 1, NULL, 10); if (off >= longnames_size) { - error (_("%s: invalid archive string table offset %lu\n"), off); + error (_("%s: invalid archive string table offset %lu\n"), file_name, off); ret = 1; break; } @@ -12311,7 +12312,7 @@ process_archive (char *file_name, FILE *file) if (nameend == NULL) { - error (_("%s: bad archive file name\n")); + error (_("%s: bad archive file name\n"), file_name); ret = 1; break; } |