This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: bfd.h:3672: warning: declaration of `index' shadows global declaration
- From: Nick Clifton <nickc at redhat dot com>
- To: Doug Evans <dje at transmeta dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 31 Jul 2002 10:38:04 +0100
- Subject: Re: bfd.h:3672: warning: declaration of `index' shadows global declaration
- References: <200207310524.WAA20144@casey.transmeta.com>
Hi Doug,
> You can see it for yourself with
>
> cd obj/binutils
> rm addr2line.o
> make addr2line.o CFLAGS=-Wshadow
>
> Howzabout renaming `index' to something else?
Yup - I am applying the patches below to fix this.
Cheers
Nick
bfd/ChangeLog
2002-07-31 Nick Clifton <nickc@redhat.com>
* bfd.c (bfd_alt_mach_code): Rename parameter 'index' to
'alternative' in order to avoid shadowing global symbol of the
same name.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
binutils/ChangeLog
2002-07-31 Nick Clifton <nickc@redhat.com>
* addr2line.c (process_file): Rename parameter 'filename' to
'file_name' in order to avoid shadowing global symbol of the
same name.
(main): Likewise.
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.35
diff -c -3 -p -w -r1.35 bfd.c
*** bfd/bfd.c 5 Jun 2002 03:43:09 -0000 1.35
--- bfd/bfd.c 31 Jul 2002 09:35:53 -0000
*************** FUNCTION
*** 1334,1360 ****
bfd_alt_mach_code
SYNOPSIS
! boolean bfd_alt_mach_code(bfd *abfd, int index);
DESCRIPTION
When more than one machine code number is available for the
same machine type, this function can be used to switch between
! the preferred one (index == 0) and any others. Currently,
only ELF supports this feature, with up to two alternate
machine codes.
*/
boolean
! bfd_alt_mach_code (abfd, index)
bfd *abfd;
! int index;
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
int code;
! switch (index)
{
case 0:
code = get_elf_backend_data (abfd)->elf_machine_code;
--- 1334,1360 ----
bfd_alt_mach_code
SYNOPSIS
! boolean bfd_alt_mach_code(bfd *abfd, int alternative);
DESCRIPTION
When more than one machine code number is available for the
same machine type, this function can be used to switch between
! the preferred one (alternative == 0) and any others. Currently,
only ELF supports this feature, with up to two alternate
machine codes.
*/
boolean
! bfd_alt_mach_code (abfd, alternative)
bfd *abfd;
! int alternative;
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
int code;
! switch (alternative)
{
case 0:
code = get_elf_backend_data (abfd)->elf_machine_code;
Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.15
diff -c -3 -p -w -r1.15 addr2line.c
*** binutils/addr2line.c 2 Jul 2002 04:21:24 -0000 1.15
--- binutils/addr2line.c 31 Jul 2002 09:36:13 -0000
*************** translate_addresses (abfd)
*** 233,251 ****
/* Process a file. */
static void
! process_file (filename, target)
! const char *filename;
const char *target;
{
bfd *abfd;
char **matching;
! abfd = bfd_openr (filename, target);
if (abfd == NULL)
! bfd_fatal (filename);
if (bfd_check_format (abfd, bfd_archive))
! fatal (_("%s: can not get addresses from archive"), filename);
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
{
--- 233,251 ----
/* Process a file. */
static void
! process_file (file_name, target)
! const char *file_name;
const char *target;
{
bfd *abfd;
char **matching;
! abfd = bfd_openr (file_name, target);
if (abfd == NULL)
! bfd_fatal (file_name);
if (bfd_check_format (abfd, bfd_archive))
! fatal (_("%s: can not get addresses from archive"), file_name);
if (! bfd_check_format_matches (abfd, bfd_object, &matching))
{
*************** main (argc, argv)
*** 278,284 ****
int argc;
char **argv;
{
! const char *filename;
char *target;
int c;
--- 278,284 ----
int argc;
char **argv;
{
! const char *file_name;
char *target;
int c;
*************** main (argc, argv)
*** 297,303 ****
bfd_init ();
set_default_bfd_target ();
! filename = NULL;
target = NULL;
while ((c = getopt_long (argc, argv, "b:Ce:sfHhVv", long_options, (int *) 0))
!= EOF)
--- 297,303 ----
bfd_init ();
set_default_bfd_target ();
! file_name = NULL;
target = NULL;
while ((c = getopt_long (argc, argv, "b:Ce:sfHhVv", long_options, (int *) 0))
!= EOF)
*************** main (argc, argv)
*** 324,330 ****
}
break;
case 'e':
! filename = optarg;
break;
case 's':
base_names = true;
--- 324,330 ----
}
break;
case 'e':
! file_name = optarg;
break;
case 's':
base_names = true;
*************** main (argc, argv)
*** 346,358 ****
}
}
! if (filename == NULL)
! filename = "a.out";
addr = argv + optind;
naddr = argc - optind;
! process_file (filename, target);
return 0;
}
--- 346,358 ----
}
}
! if (file_name == NULL)
! file_name = "a.out";
addr = argv + optind;
naddr = argc - optind;
! process_file (file_name, target);
return 0;
}