This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
another crop of warning fixes
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Fri, 25 Feb 2005 00:02:52 +1030
- Subject: another crop of warning fixes
Compiling with a 64-bit gcc4 gives a few more warnings..
bfd/coffcode.h:2409: warning: format '%5lld' expects type 'long long int', but argument 3 has type 'bfd_signed_vma'
bfd/coffcode.h:2419: warning: format '%4lld' expects type 'long long int', but argument 3 has type 'bfd_signed_vma'
bfd/coff-h8300.c:1185: warning: cast from pointer to integer of different size
bfd/coff-h8300.c:1374: warning: cast from pointer to integer of different size
bfd/elf-m10300.c:1804: warning: cast from pointer to integer of different size
bfd/elf-m10300.c:1910: warning: cast from pointer to integer of different size
bfd/elf-m10300.c:2081: warning: cast from pointer to integer of different size
bfd/elf-m10300.c:2333: warning: cast from pointer to integer of different size
bfd/elf32-sh-symbian.c:378: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
bfd/elf32-sh64.c:593: warning: cast from pointer to integer of different size
bfd/elf32-xtensa.c:4474: warning: cast from pointer to integer of different size
bfd/versados.c:460: warning: cast to pointer from integer of different size
bfd/versados.c:822: warning: cast from pointer to integer of different size
bfd/vms.c:368: warning: cast from pointer to integer of different size
bfd/vms.c:371: warning: cast from pointer to integer of different size
bfd/vms-gsd.c:523: warning: cast to pointer from integer of different size
opcodes/cris-dis.c:454: warning: left shift count >= width of type
opcodes/crx-dis.c:661: warning: missing initializer
opcodes/crx-dis.c:661: warning: (near initialization for 'a.i_r')
opcodes/frv-asm.c:938: warning: comparison between signed and unsigned
bfd/
* coffcode.h (coff_print_aux): Warning fix.
* elf-m10300.c (mn10300_elf_relax_section): Use section->id
instead of section pointer to identify.
* coff-h8300.c (h8300_reloc16_extra_cases): Likewise. Allocate
the correct size buffer for local sym mangling too.
(h8300_bfd_link_add_symbols): Likewise.
* elf32-sh-symbian.c (sh_symbian_process_embedded_commands): Fix
warning.
* elf32-sh64.c (shmedia_prepare_reloc): Use %B and %p in error message
* elf32-xtensa.c (literal_value_hash): Warning fix.
* versados.c (process_otr): Warning fix.
(versados_canonicalize_reloc): Likewise.
* vms-gsd.c (_bfd_vms_slurp_gsd): Warning fix.
* vms.c (fill_section_ptr): Warning fix.
cpu/
* frv.opc (parse_A): Warning fix.
opcodes/
* cris-dis.c (format_hex): Remove ineffective warning fix.
* crx-dis.c (make_instruction): Warning fix.
* frv-asm.c: Regenerate.
Index: bfd/coff-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-h8300.c,v
retrieving revision 1.33
diff -u -p -r1.33 coff-h8300.c
--- bfd/coff-h8300.c 31 Jan 2005 23:13:16 -0000 1.33
+++ bfd/coff-h8300.c 24 Feb 2005 12:12:12 -0000
@@ -1,6 +1,6 @@
/* BFD back-end for Renesas H8/300 COFF binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -1175,14 +1175,12 @@ h8300_reloc16_extra_cases (bfd *abfd, st
name = symbol->name;
if (symbol->flags & BSF_LOCAL)
{
- char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9);
+ char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 10);
if (new_name == NULL)
abort ();
- strcpy (new_name, name);
- sprintf (new_name + strlen (name), "_%08x",
- (int) symbol->section);
+ sprintf (new_name, "%s_%08x", name, symbol->section->id);
name = new_name;
}
@@ -1365,13 +1363,11 @@ h8300_bfd_link_add_symbols (bfd *abfd, s
{
char *new_name;
- new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9);
+ new_name = bfd_malloc ((bfd_size_type) strlen (name) + 10);
if (new_name == NULL)
abort ();
- strcpy (new_name, name);
- sprintf (new_name + strlen (name), "_%08x",
- (int) symbol->section);
+ sprintf (new_name, "%s_%08x", name, symbol->section->id);
name = new_name;
}
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.118
diff -u -p -r1.118 coffcode.h
--- bfd/coffcode.h 22 Feb 2005 00:50:04 -0000 1.118
+++ bfd/coffcode.h 24 Feb 2005 12:12:16 -0000
@@ -1,6 +1,6 @@
/* Support for the generic parts of most COFF variants, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -2406,7 +2406,8 @@ coff_print_aux (abfd, file, table_base,
{
BFD_ASSERT (! aux->fix_scnlen);
#ifdef XCOFF64
- fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l);
+ fprintf (file, "val %5lld",
+ (long long) aux->u.auxent.x_csect.x_scnlen.l);
#else
fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
#endif
@@ -2416,7 +2417,8 @@ coff_print_aux (abfd, file, table_base,
fprintf (file, "indx ");
if (! aux->fix_scnlen)
#ifdef XCOFF64
- fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l);
+ fprintf (file, "%4lld",
+ (long long) aux->u.auxent.x_csect.x_scnlen.l);
#else
fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
#endif
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf-m10300.c
--- bfd/elf-m10300.c 21 Oct 2004 15:28:20 -0000 1.59
+++ bfd/elf-m10300.c 24 Feb 2005 12:12:17 -0000
@@ -1,5 +1,5 @@
/* Matsushita 10300 specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1800,8 +1800,7 @@ mn10300_elf_relax_section (abfd, sec, li
if (new_name == 0)
goto error_return;
- sprintf (new_name, "%s_%08x",
- sym_name, (int) sym_sec);
+ sprintf (new_name, "%s_%08x", sym_name, sym_sec->id);
sym_name = new_name;
elftab = &hash_table->static_hash_table->root;
@@ -1906,8 +1905,7 @@ mn10300_elf_relax_section (abfd, sec, li
if (new_name == 0)
goto error_return;
- sprintf (new_name, "%s_%08x",
- sym_name, (int) sym_sec);
+ sprintf (new_name, "%s_%08x", sym_name, sym_sec->id);
sym_name = new_name;
elftab = &hash_table->static_hash_table->root;
@@ -2078,7 +2076,7 @@ mn10300_elf_relax_section (abfd, sec, li
new_name = bfd_malloc (amt);
if (new_name == 0)
goto error_return;
- sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec);
+ sprintf (new_name, "%s_%08x", sym_name, sym_sec->id);
sym_name = new_name;
elftab = &hash_table->static_hash_table->root;
@@ -2330,7 +2328,7 @@ mn10300_elf_relax_section (abfd, sec, li
new_name = bfd_malloc ((bfd_size_type) strlen (sym_name) + 10);
if (new_name == 0)
goto error_return;
- sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec);
+ sprintf (new_name, "%s_%08x", sym_name, sym_sec->id);
sym_name = new_name;
h = (struct elf32_mn10300_link_hash_entry *)
Index: bfd/elf32-sh-symbian.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh-symbian.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-sh-symbian.c
--- bfd/elf32-sh-symbian.c 20 Feb 2005 14:59:06 -0000 1.5
+++ bfd/elf32-sh-symbian.c 24 Feb 2005 12:12:18 -0000
@@ -374,8 +374,8 @@ sh_symbian_process_embedded_commands (st
if (! result)
{
if (DEBUG)
- fprintf (stderr, "offset into .directive section: %d\n",
- directive - (char *) contents);
+ fprintf (stderr, "offset into .directive section: %ld\n",
+ (long) (directive - (char *) contents));
bfd_set_error (bfd_error_invalid_operation);
_bfd_error_handler (_("%B: Unrecognised .directive command: %s"),
Index: bfd/elf32-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf32-sh64.c
--- bfd/elf32-sh64.c 16 Sep 2004 14:52:05 -0000 1.28
+++ bfd/elf32-sh64.c 24 Feb 2005 12:12:18 -0000
@@ -588,9 +588,9 @@ shmedia_prepare_reloc (struct bfd_link_i
if (dropped != 0)
{
(*_bfd_error_handler)
- (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"),
- bfd_get_filename (input_section->owner), ELF32_R_TYPE (rel->r_info),
- (unsigned)rel->r_offset, (unsigned)relocation);
+ (_("%B: error: unaligned relocation type %d at %08x reloc %p\n"),
+ input_section->owner, ELF32_R_TYPE (rel->r_info),
+ (unsigned) rel->r_offset, relocation);
return FALSE;
}
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf32-xtensa.c
--- bfd/elf32-xtensa.c 11 Jan 2005 09:32:51 -0000 1.41
+++ bfd/elf32-xtensa.c 24 Feb 2005 12:12:23 -0000
@@ -4471,7 +4471,7 @@ literal_value_hash (const literal_value
sec_or_hash = r_reloc_get_section (&src->r_rel);
else
sec_or_hash = r_reloc_get_hash_entry (&src->r_rel);
- hash_val += hash_bfd_vma ((bfd_vma) (unsigned) sec_or_hash);
+ hash_val += hash_bfd_vma ((bfd_vma) (size_t) sec_or_hash);
}
return hash_val;
}
Index: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.24
diff -u -p -r1.24 versados.c
--- bfd/versados.c 8 Oct 2004 14:54:02 -0000 1.24
+++ bfd/versados.c 24 Feb 2005 12:12:23 -0000
@@ -457,7 +457,7 @@ process_otr (abfd, otr, pass)
EDATA (abfd, otr->esdid - 1).section->relocation + rn;
n->address = dst_idx;
- n->sym_ptr_ptr = (asymbol **) esdid;
+ n->sym_ptr_ptr = (asymbol **) (size_t) esdid;
n->addend = 0;
n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
}
@@ -819,7 +819,7 @@ versados_canonicalize_reloc (abfd, secti
/* translate from indexes to symptr ptrs */
for (count = 0; count < section->reloc_count; count++)
{
- int esdid = (int) src[count].sym_ptr_ptr;
+ int esdid = (int) (size_t) src[count].sym_ptr_ptr;
if (esdid == 0)
{
Index: bfd/vms-gsd.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-gsd.c,v
retrieving revision 1.14
diff -u -p -r1.14 vms-gsd.c
--- bfd/vms-gsd.c 24 Jun 2004 04:46:26 -0000 1.14
+++ bfd/vms-gsd.c 24 Feb 2005 12:12:24 -0000
@@ -1,6 +1,6 @@
/* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
go and read the openVMS linker manual (esp. appendix B)
@@ -520,7 +520,7 @@ _bfd_vms_slurp_gsd (abfd, objtype)
else
psect = vms_rec[value_offset-1];
- symbol->section = (asection *)psect;
+ symbol->section = (asection *) (size_t) psect;
#if VMS_DEBUG
vms_debug(4, "gsd sym def #%d (%s, %d [%p], %04x=%s)\n", abfd->symcount,
symbol->name, (int)symbol->section, symbol->section, old_flags, flag2str(gsyflagdesc, old_flags));
Index: bfd/vms.c
===================================================================
RCS file: /cvs/src/src/bfd/vms.c,v
retrieving revision 1.32
diff -u -p -r1.32 vms.c
--- bfd/vms.c 8 Oct 2004 14:54:02 -0000 1.32
+++ bfd/vms.c 24 Feb 2005 12:12:28 -0000
@@ -1,6 +1,6 @@
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@rmi.de)
@@ -365,336 +365,349 @@ fill_section_ptr (entry, sections)
/* fill forward references (these contain section number, not section ptr). */
- if ((unsigned int) sec < priv_section_count)
+ if ((unsigned int) (size_t) sec < priv_section_count)
{
- sec = ((vms_symbol_entry *)entry)->symbol->section =
- ((asection **)sections)[(int)sec];
+ sec = ((vms_symbol_entry *) entry)->symbol->section =
+ ((asection **) sections)[(unsigned int) (size_t) sec];
}
if (strcmp (sym->name, sec->name) == 0)
Index: cpu/frv.opc
===================================================================
RCS file: /cvs/src/src/cpu/frv.opc,v
retrieving revision 1.10
diff -u -p -r1.10 frv.opc
--- cpu/frv.opc 23 Feb 2005 16:04:37 -0000 1.10
+++ cpu/frv.opc 24 Feb 2005 13:31:23 -0000
@@ -968,7 +968,7 @@ static const char * parse_A0
static const char * parse_A1
PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *));
static const char * parse_A
- PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *, long));
+ PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *, unsigned long));
inline static const char *
parse_symbolic_address (CGEN_CPU_DESC cd,
@@ -1821,7 +1821,7 @@ parse_A (cd, strp, opindex, valuep, A)
const char **strp;
int opindex;
unsigned long *valuep;
- long A;
+ unsigned long A;
{
const char *errmsg;
Index: opcodes/cris-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/cris-dis.c,v
retrieving revision 1.9
diff -u -p -r1.9 cris-dis.c
--- opcodes/cris-dis.c 4 Nov 2004 14:54:38 -0000 1.9
+++ opcodes/cris-dis.c 24 Feb 2005 12:12:52 -0000
@@ -448,10 +448,8 @@ format_hex (number, outbuffer, disdata)
char *outbuffer;
struct cris_disasm_data *disdata;
{
- /* Obfuscate to avoid warning on 32-bit host, but properly truncate
- negative numbers on >32-bit hosts. */
- if (sizeof (number) > 4)
- number &= (1 << (sizeof (number) > 4 ? 32 : 1)) - 1;
+ /* Truncate negative numbers on >32-bit hosts. */
+ number &= 0xffffffff;
sprintf (outbuffer, "0x%lx", number);
Index: opcodes/crx-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/crx-dis.c,v
retrieving revision 1.7
diff -u -p -r1.7 crx-dis.c
--- opcodes/crx-dis.c 23 Feb 2005 11:53:31 -0000 1.7
+++ opcodes/crx-dis.c 24 Feb 2005 12:12:52 -0000
@@ -658,8 +658,9 @@ make_instruction (void)
for (i = 0; i < currInsn.nargs; i++)
{
- argument a = { 0 };
+ argument a;
+ memset (&a, 0, sizeof (a));
a.type = getargtype (instruction->operands[i].op_type);
if (instruction->operands[i].op_type == cst4
|| instruction->operands[i].op_type == rbase_dispu4)
--
Alan Modra
IBM OzLabs - Linux Technology Centre