Mach-O: misc build adjustments

Oldish gcc warns about local variables shadowing outer scope ones.
Additionally %lx is not (always) suitable to print the result of
bfd_get_32().
This commit is contained in:
Jan Beulich 2020-01-03 10:11:50 +01:00
parent 6e2118f588
commit 4bb7a87e74
3 changed files with 26 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2020-01-03 Jan Beulich <jbeulich@suse.com>
* mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
in parameter names.
(bfd_mach_o_scan): Insert underscore in two variable names.
2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com> 2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com>
* Makefile.am: Add z80-elf target support. * Makefile.am: Add z80-elf target support.

View File

@ -618,12 +618,12 @@ cputype (unsigned long value)
} }
static const char * static const char *
cpusubtype (unsigned long cputype, unsigned long cpusubtype) cpusubtype (unsigned long cpu_type, unsigned long cpu_subtype)
{ {
static char buffer[128]; static char buffer[128];
buffer[0] = 0; buffer[0] = 0;
switch (cpusubtype & BFD_MACH_O_CPU_SUBTYPE_MASK) switch (cpu_subtype & BFD_MACH_O_CPU_SUBTYPE_MASK)
{ {
case 0: case 0:
break; break;
@ -633,13 +633,13 @@ cpusubtype (unsigned long cputype, unsigned long cpusubtype)
sprintf (buffer, _("<unknown mask flags>")); break; sprintf (buffer, _("<unknown mask flags>")); break;
} }
cpusubtype &= ~ BFD_MACH_O_CPU_SUBTYPE_MASK; cpu_subtype &= ~ BFD_MACH_O_CPU_SUBTYPE_MASK;
switch (cputype) switch (cpu_type)
{ {
case BFD_MACH_O_CPU_TYPE_X86_64: case BFD_MACH_O_CPU_TYPE_X86_64:
case BFD_MACH_O_CPU_TYPE_I386: case BFD_MACH_O_CPU_TYPE_I386:
switch (cpusubtype) switch (cpu_subtype)
{ {
case BFD_MACH_O_CPU_SUBTYPE_X86_ALL: case BFD_MACH_O_CPU_SUBTYPE_X86_ALL:
return strcat (buffer, " (X86_ALL)"); return strcat (buffer, " (X86_ALL)");
@ -649,7 +649,7 @@ cpusubtype (unsigned long cputype, unsigned long cpusubtype)
break; break;
case BFD_MACH_O_CPU_TYPE_ARM: case BFD_MACH_O_CPU_TYPE_ARM:
switch (cpusubtype) switch (cpu_subtype)
{ {
case BFD_MACH_O_CPU_SUBTYPE_ARM_ALL: case BFD_MACH_O_CPU_SUBTYPE_ARM_ALL:
return strcat (buffer, " (ARM_ALL)"); return strcat (buffer, " (ARM_ALL)");
@ -669,7 +669,7 @@ cpusubtype (unsigned long cputype, unsigned long cpusubtype)
break; break;
case BFD_MACH_O_CPU_TYPE_ARM64: case BFD_MACH_O_CPU_TYPE_ARM64:
switch (cpusubtype) switch (cpu_subtype)
{ {
case BFD_MACH_O_CPU_SUBTYPE_ARM64_ALL: case BFD_MACH_O_CPU_SUBTYPE_ARM64_ALL:
return strcat (buffer, " (ARM64_ALL)"); return strcat (buffer, " (ARM64_ALL)");
@ -684,7 +684,7 @@ cpusubtype (unsigned long cputype, unsigned long cpusubtype)
break; break;
} }
if (cpusubtype != 0) if (cpu_subtype != 0)
return strcat (buffer, _(" (<unknown>)")); return strcat (buffer, _(" (<unknown>)"));
return buffer; return buffer;
@ -5101,8 +5101,8 @@ bfd_mach_o_scan (bfd *abfd,
bfd_mach_o_data_struct *mdata) bfd_mach_o_data_struct *mdata)
{ {
unsigned int i; unsigned int i;
enum bfd_architecture cputype; enum bfd_architecture cpu_type;
unsigned long cpusubtype; unsigned long cpu_subtype;
unsigned int hdrsize; unsigned int hdrsize;
hdrsize = mach_o_wide_p (header) ? hdrsize = mach_o_wide_p (header) ?
@ -5128,8 +5128,8 @@ bfd_mach_o_scan (bfd *abfd,
abfd->tdata.mach_o_data = mdata; abfd->tdata.mach_o_data = mdata;
bfd_mach_o_convert_architecture (header->cputype, header->cpusubtype, bfd_mach_o_convert_architecture (header->cputype, header->cpusubtype,
&cputype, &cpusubtype); &cpu_type, &cpu_subtype);
if (cputype == bfd_arch_unknown) if (cpu_type == bfd_arch_unknown)
{ {
_bfd_error_handler _bfd_error_handler
/* xgettext:c-format */ /* xgettext:c-format */
@ -5138,7 +5138,7 @@ bfd_mach_o_scan (bfd *abfd,
return FALSE; return FALSE;
} }
bfd_set_arch_mach (abfd, cputype, cpusubtype); bfd_set_arch_mach (abfd, cpu_type, cpu_subtype);
if (header->ncmds != 0) if (header->ncmds != 0)
{ {
@ -5226,8 +5226,8 @@ bfd_mach_o_gen_mkobject (bfd *abfd)
const bfd_target * const bfd_target *
bfd_mach_o_header_p (bfd *abfd, bfd_mach_o_header_p (bfd *abfd,
file_ptr hdr_off, file_ptr hdr_off,
bfd_mach_o_filetype filetype, bfd_mach_o_filetype file_type,
bfd_mach_o_cpu_type cputype) bfd_mach_o_cpu_type cpu_type)
{ {
bfd_mach_o_header header; bfd_mach_o_header header;
bfd_mach_o_data_struct *mdata; bfd_mach_o_data_struct *mdata;
@ -5254,9 +5254,9 @@ bfd_mach_o_header_p (bfd *abfd,
/* Check cputype and filetype. /* Check cputype and filetype.
In case of wildcard, do not accept magics that are handled by existing In case of wildcard, do not accept magics that are handled by existing
targets. */ targets. */
if (cputype) if (cpu_type)
{ {
if (header.cputype != cputype) if (header.cputype != cpu_type)
goto wrong; goto wrong;
} }
else else
@ -5269,9 +5269,9 @@ bfd_mach_o_header_p (bfd *abfd,
#endif #endif
} }
if (filetype) if (file_type)
{ {
if (header.filetype != filetype) if (header.filetype != file_type)
goto wrong; goto wrong;
} }
else else

View File

@ -2011,7 +2011,7 @@ dump_obj_compact_unwind (bfd *abfd,
putchar (' '); putchar (' ');
printf_uint64 (bfd_get_64 (abfd, e->start)); printf_uint64 (bfd_get_64 (abfd, e->start));
printf (" %08lx", bfd_get_32 (abfd, e->length)); printf (" %08lx", (unsigned long)bfd_get_32 (abfd, e->length));
putchar (' '); putchar (' ');
printf_uint64 (bfd_get_64 (abfd, e->personality)); printf_uint64 (bfd_get_64 (abfd, e->personality));
putchar (' '); putchar (' ');