aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>2005-07-07 19:27:52 +0000
committerJim Wilson <wilson@tuliptree.org>2005-07-07 19:27:52 +0000
commit0fd3a4776c8f607cc778cde80f9215089d36387e (patch)
tree0332cbbb13c41fc1834d3e17001dfd97936c7c81 /binutils
parent9968d831f9298e2dc60de7a77013c7b173441951 (diff)
downloadgdb-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')
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/bucomm.h2
-rw-r--r--binutils/dlltool.c2
-rw-r--r--binutils/dllwrap.c6
-rw-r--r--binutils/objdump.c2
-rw-r--r--binutils/readelf.c37
6 files changed, 33 insertions, 24 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b25d429..3933ec8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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.
+
2005-07-05 Dmitry V. Levin <ldv@altlinux.org>
Nick Clifton <nickc@redhat.com>
diff --git a/binutils/bucomm.h b/binutils/bucomm.h
index df89ea5..f889f92 100644
--- a/binutils/bucomm.h
+++ b/binutils/bucomm.h
@@ -159,7 +159,7 @@ void bfd_nonfatal (const char *);
void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
-void report (const char *, va_list);
+void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 760f437..3f18922 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -708,7 +708,7 @@ static void fill_ordinals (export_type **);
static int alphafunc (const void *, const void *);
static void mangle_defs (void);
static void usage (FILE *, int);
-static void inform (const char *, ...);
+static void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
static void set_dll_name_from_def (const char *);
static char *
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 0c01f5f..97b138a 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -118,9 +118,9 @@ static int run (const char *, char *);
static char *mybasename (const char *);
static int strhash (const char *);
static void usage (FILE *, int);
-static void display (const char *, va_list);
-static void inform (const char *, ...);
-static void warn (const char *, ...);
+static void display (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
+static void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
+static void warn (const char *, ...) ATTRIBUTE_PRINTF_1;
static char *look_for_prog (const char *, const char *, int);
static char *deduce_name (const char *);
static void delete_temp_files (void);
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 195b9c1..f8e7cd9 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1189,7 +1189,7 @@ typedef struct
/* sprintf to a "stream". */
-static int
+static int ATTRIBUTE_PRINTF_2
objdump_sprintf (SFILE *f, const char *format, ...)
{
size_t n;
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;
}