diff options
author | Nick Clifton <nickc@redhat.com> | 2009-12-11 13:42:17 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-12-11 13:42:17 +0000 |
commit | 91d6fa6a035cc7d0b7be5c99c194a64cb80924b0 (patch) | |
tree | 214507c313b77d619b52afcae2af0b02c9fa700b /binutils | |
parent | 01fe1b4183324882e88e8c64748bffdc69ea3a9c (diff) | |
download | binutils-gdb-91d6fa6a035cc7d0b7be5c99c194a64cb80924b0.tar.gz |
Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 27 | ||||
-rw-r--r-- | binutils/Makefile.in | 2 | ||||
-rw-r--r-- | binutils/ar.c | 6 | ||||
-rw-r--r-- | binutils/bucomm.c | 12 | ||||
-rw-r--r-- | binutils/coffgrok.c | 9 | ||||
-rwxr-xr-x | binutils/configure | 2 | ||||
-rw-r--r-- | binutils/dlltool.c | 24 | ||||
-rw-r--r-- | binutils/dllwrap.c | 9 | ||||
-rw-r--r-- | binutils/doc/Makefile.in | 2 | ||||
-rw-r--r-- | binutils/dwarf.c | 229 | ||||
-rw-r--r-- | binutils/ieee.c | 14 | ||||
-rw-r--r-- | binutils/nlmconv.c | 10 | ||||
-rw-r--r-- | binutils/nm.c | 38 | ||||
-rw-r--r-- | binutils/objcopy.c | 34 | ||||
-rw-r--r-- | binutils/objdump.c | 224 | ||||
-rw-r--r-- | binutils/prdbg.c | 10 | ||||
-rw-r--r-- | binutils/readelf.c | 201 | ||||
-rw-r--r-- | binutils/resbin.c | 20 | ||||
-rw-r--r-- | binutils/resrc.c | 4 | ||||
-rw-r--r-- | binutils/resres.c | 20 | ||||
-rw-r--r-- | binutils/srconv.c | 41 | ||||
-rw-r--r-- | binutils/stabs.c | 14 | ||||
-rw-r--r-- | binutils/sysdump.c | 20 | ||||
-rw-r--r-- | binutils/sysinfo.y | 40 | ||||
-rw-r--r-- | binutils/wrstabs.c | 156 |
25 files changed, 595 insertions, 573 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index e295fcac74d..9ed437602e7 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,30 @@ +2009-12-11 Nick Clifton <nickc@redhat.com> + + * Makefile.in: Regenerate. + * doc/Makefile.in: Regenerate. + * ar.c: Fix shadowed variable warnings. + * bucomm.c: Likewise. + * coffgrok.c: Likewise. + * configure: Likewise. + * dlltool.c: Likewise. + * dllwrap.c: Likewise. + * dwarf.c: Likewise. + * ieee.c: Likewise. + * nlmconv.c: Likewise. + * nm.c: Likewise. + * objcopy.c: Likewise. + * objdump.c: Likewise. + * prdbg.c: Likewise. + * readelf.c: Likewise. + * resbin.c: Likewise. + * resrc.c: Likewise. + * resres.c: Likewise. + * srconv.c: Likewise. + * stabs.c: Likewise. + * sysdump.c: Likewise. + * sysinfo.y: Likewise. + * wrstabs.c: Likewise. + 2009-12-10 Tristan Gingold <gingold@adacore.com> * addr2line.c (pretty_print): New variable. diff --git a/binutils/Makefile.in b/binutils/Makefile.in index dcda20fa3dc..5b29a026f8e 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -54,10 +54,12 @@ DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \ rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/largefile.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-link.m4 \ diff --git a/binutils/ar.c b/binutils/ar.c index 5bffd50a66b..15a7b477bf1 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -1168,14 +1168,14 @@ move_members (bfd *arch, char **files_to_move) { /* Move this file to the end of the list - first cut from where it is. */ - bfd *link; + bfd *link_bfd; *current_ptr_ptr = current_ptr->archive_next; /* Now glue to end */ after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL); - link = *after_bfd; + link_bfd = *after_bfd; *after_bfd = current_ptr; - current_ptr->archive_next = link; + current_ptr->archive_next = link_bfd; if (verbose) printf ("m - %s\n", *files_to_move); diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 64653d65a1e..e568b031ab9 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -70,12 +70,12 @@ bfd_nonfatal (const char *string) PROGRAM:file: bfd-error-message PROGRAM:file[section]: bfd-error-message PROGRAM:file: printf-message: bfd-error-message - PROGRAM:file[section]: printf-message: bfd-error-message -*/ + PROGRAM:file[section]: printf-message: bfd-error-message. */ void bfd_nonfatal_message (const char *filename, - const bfd *bfd, const asection *section, + const bfd *abfd, + const asection *section, const char *format, ...) { const char *errmsg = bfd_errmsg (bfd_get_error ()); @@ -85,12 +85,12 @@ bfd_nonfatal_message (const char *filename, va_start (args, format); fprintf (stderr, "%s", program_name); - if (bfd) + if (abfd) { if (!filename) - filename = bfd_get_archive_filename (bfd); + filename = bfd_get_archive_filename (abfd); if (section) - section_name = bfd_get_section_name (bfd, section); + section_name = bfd_get_section_name (abfd, section); } if (section_name) fprintf (stderr, ":%s[%s]", filename, section_name); diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c index cc425f0fdb2..97574e7d0ca 100644 --- a/binutils/coffgrok.c +++ b/binutils/coffgrok.c @@ -1,6 +1,6 @@ /* coffgrok.c - Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, + 2007, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -96,10 +96,11 @@ empty_symbol (void) /*int l;*/ static void -push_scope (int link) +push_scope (int slink) { struct coff_scope *n = empty_scope (); - if (link) + + if (slink) { if (top_scope) { diff --git a/binutils/configure b/binutils/configure index 65d22ce3f70..cb54f078ebd 100755 --- a/binutils/configure +++ b/binutils/configure @@ -11440,7 +11440,7 @@ esac fi -GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow" # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : diff --git a/binutils/dlltool.c b/binutils/dlltool.c index b9d717fb210..280edc14dd0 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -879,9 +879,9 @@ inform VPARAMS ((const char * message, ...)) } static const char * -rvaafter (int machine) +rvaafter (int mach) { - switch (machine) + switch (mach) { case MARM: case M386: @@ -898,16 +898,16 @@ rvaafter (int machine) break; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; } static const char * -rvabefore (int machine) +rvabefore (int mach) { - switch (machine) + switch (mach) { case MARM: case M386: @@ -924,16 +924,16 @@ rvabefore (int machine) return ".rva\t"; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; } static const char * -asm_prefix (int machine, const char *name) +asm_prefix (int mach, const char *name) { - switch (machine) + switch (mach) { case MARM: case MPPC: @@ -955,7 +955,7 @@ asm_prefix (int machine, const char *name) return "_"; default: /* xgettext:c-format */ - fatal (_("Internal error: Unknown machine type: %d"), machine); + fatal (_("Internal error: Unknown machine type: %d"), mach); break; } return ""; @@ -1155,7 +1155,7 @@ def_stacksize (int reserve, int commit) import_list. It is used by def_import. */ static void -append_import (const char *symbol_name, const char *dll_name, int func_ordinal, +append_import (const char *symbol_name, const char *dllname, int func_ordinal, const char *its_name) { iheadtype **pq; @@ -1163,7 +1163,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal, for (pq = &import_list; *pq != NULL; pq = &(*pq)->next) { - if (strcmp ((*pq)->dllname, dll_name) == 0) + if (strcmp ((*pq)->dllname, dllname) == 0) { q = *pq; q->functail->next = xmalloc (sizeof (ifunctype)); @@ -1178,7 +1178,7 @@ append_import (const char *symbol_name, const char *dll_name, int func_ordinal, } q = xmalloc (sizeof (iheadtype)); - q->dllname = xstrdup (dll_name); + q->dllname = xstrdup (dllname); q->nfuncs = 1; q->funchead = xmalloc (sizeof (ifunctype)); q->functail = q->funchead; diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c index 50bbeb56310..c807f49c277 100644 --- a/binutils/dllwrap.c +++ b/binutils/dllwrap.c @@ -1,5 +1,5 @@ /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc. Contributed by Mumit Khan (khan@xraylith.wisc.edu). @@ -182,20 +182,20 @@ warn VPARAMS ((const char *format, ...)) appropriate. */ static char * -look_for_prog (const char *prog_name, const char *prefix, int end_prefix) +look_for_prog (const char *progname, const char *prefix, int end_prefix) { struct stat s; char *cmd; cmd = xmalloc (strlen (prefix) - + strlen (prog_name) + + strlen (progname) #ifdef HAVE_EXECUTABLE_SUFFIX + strlen (EXECUTABLE_SUFFIX) #endif + 10); strcpy (cmd, prefix); - sprintf (cmd + end_prefix, "%s", prog_name); + sprintf (cmd + end_prefix, "%s", progname); if (strchr (cmd, '/') != NULL) { @@ -973,7 +973,6 @@ Creating one, but that may not be what you want")); if (! def_file_seen) { - int i; dyn_string_t step_pre1; step_pre1 = dyn_string_new (1024); diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in index f2d63c87faf..897e5d8bee5 100644 --- a/binutils/doc/Makefile.in +++ b/binutils/doc/Makefile.in @@ -38,10 +38,12 @@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/warning.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/iconv.m4 \ + $(top_srcdir)/../config/largefile.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lib-ld.m4 \ $(top_srcdir)/../config/lib-link.m4 \ diff --git a/binutils/dwarf.c b/binutils/dwarf.c index e2e85bc311e..eb6c2d70905 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -438,23 +438,23 @@ static abbrev_entry *last_abbrev = NULL; static void free_abbrevs (void) { - abbrev_entry *abbrev; + abbrev_entry *abbrv; - for (abbrev = first_abbrev; abbrev;) + for (abbrv = first_abbrev; abbrv;) { - abbrev_entry *next = abbrev->next; + abbrev_entry *next_abbrev = abbrv->next; abbrev_attr *attr; - for (attr = abbrev->first_attr; attr;) + for (attr = abbrv->first_attr; attr;) { - abbrev_attr *next = attr->next; + abbrev_attr *next_attr = attr->next; free (attr); - attr = next; + attr = next_attr; } - free (abbrev); - abbrev = next; + free (abbrv); + abbrv = next_abbrev; } last_abbrev = first_abbrev = NULL; @@ -1355,19 +1355,19 @@ read_and_display_attr_value (unsigned long attribute, if (form == DW_FORM_data4 || form == DW_FORM_data8) { /* Process location list. */ - unsigned int max = debug_info_p->max_loc_offsets; + unsigned int lmax = debug_info_p->max_loc_offsets; unsigned int num = debug_info_p->num_loc_offsets; - if (max == 0 || num >= max) + if (lmax == 0 || num >= lmax) { - max += 1024; + lmax += 1024; debug_info_p->loc_offsets = (long unsigned int *) xcrealloc (debug_info_p->loc_offsets, - max, sizeof (*debug_info_p->loc_offsets)); + lmax, sizeof (*debug_info_p->loc_offsets)); debug_info_p->have_frame_base = (int *) xcrealloc (debug_info_p->have_frame_base, - max, sizeof (*debug_info_p->have_frame_base)); - debug_info_p->max_loc_offsets = max; + lmax, sizeof (*debug_info_p->have_frame_base)); + debug_info_p->max_loc_offsets = lmax; } debug_info_p->loc_offsets [num] = uvalue; debug_info_p->have_frame_base [num] = have_frame_base; @@ -1384,16 +1384,16 @@ read_and_display_attr_value (unsigned long attribute, if (form == DW_FORM_data4 || form == DW_FORM_data8) { /* Process range list. */ - unsigned int max = debug_info_p->max_range_lists; + unsigned int lmax = debug_info_p->max_range_lists; unsigned int num = debug_info_p->num_range_lists; - if (max == 0 || num >= max) + if (lmax == 0 || num >= lmax) { - max += 1024; + lmax += 1024; debug_info_p->range_lists = (long unsigned int *) xcrealloc (debug_info_p->range_lists, - max, sizeof (*debug_info_p->range_lists)); - debug_info_p->max_range_lists = max; + lmax, sizeof (*debug_info_p->range_lists)); + debug_info_p->max_range_lists = lmax; } debug_info_p->range_lists [num] = uvalue; debug_info_p->num_range_lists++; @@ -2226,7 +2226,7 @@ display_debug_lines_raw (struct dwarf_section *section, while (data < end) { - DWARF2_Internal_LineInfo info; + DWARF2_Internal_LineInfo linfo; unsigned char *standard_opcodes; unsigned char *end_of_sequence; unsigned char *hdrptr; @@ -2239,13 +2239,13 @@ display_debug_lines_raw (struct dwarf_section *section, hdroff = hdrptr - start; /* Check the length of the block. */ - info.li_length = byte_get (hdrptr, 4); + linfo.li_length = byte_get (hdrptr, 4); hdrptr += 4; - if (info.li_length == 0xffffffff) + if (linfo.li_length == 0xffffffff) { /* This section is 64-bit DWARF 3. */ - info.li_length = byte_get (hdrptr, 8); + linfo.li_length = byte_get (hdrptr, 8); hdrptr += 8; offset_size = 8; initial_length_size = 12; @@ -2256,7 +2256,7 @@ display_debug_lines_raw (struct dwarf_section *section, initial_length_size = 4; } - if (info.li_length + initial_length_size > section->size) + if (linfo.li_length + initial_length_size > section->size) { warn (_("The information in section %s appears to be corrupt - the section is too small\n"), @@ -2265,55 +2265,55 @@ display_debug_lines_raw (struct dwarf_section *section, } /* Check its version number. */ - info.li_version = byte_get (hdrptr, 2); + linfo.li_version = byte_get (hdrptr, 2); hdrptr += 2; - if (info.li_version != 2 && info.li_version != 3) + if (linfo.li_version != 2 && linfo.li_version != 3) { warn (_("Only DWARF version 2 and 3 line info is currently supported.\n")); return 0; } - info.li_prologue_length = byte_get (hdrptr, offset_size); + linfo.li_prologue_length = byte_get (hdrptr, offset_size); hdrptr += offset_size; - info.li_min_insn_length = byte_get (hdrptr, 1); + linfo.li_min_insn_length = byte_get (hdrptr, 1); hdrptr++; - info.li_default_is_stmt = byte_get (hdrptr, 1); + linfo.li_default_is_stmt = byte_get (hdrptr, 1); hdrptr++; - info.li_line_base = byte_get (hdrptr, 1); + linfo.li_line_base = byte_get (hdrptr, 1); hdrptr++; - info.li_line_range = byte_get (hdrptr, 1); + linfo.li_line_range = byte_get (hdrptr, 1); hdrptr++; - info.li_opcode_base = byte_get (hdrptr, 1); + linfo.li_opcode_base = byte_get (hdrptr, 1); hdrptr++; /* Sign extend the line base field. */ - info.li_line_base <<= 24; - info.li_line_base >>= 24; + linfo.li_line_base <<= 24; + linfo.li_line_base >>= 24; printf (_(" Offset: 0x%lx\n"), hdroff); - printf (_(" Length: %ld\n"), info.li_length); - printf (_(" DWARF Version: %d\n"), info.li_version); - printf (_(" Prologue Length: %d\n"), info.li_prologue_length); - printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length); - printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt); - printf (_(" Line Base: %d\n"), info.li_line_base); - printf (_(" Line Range: %d\n"), info.li_line_range); - printf (_(" Opcode Base: %d\n"), info.li_opcode_base); + printf (_(" Length: %ld\n"), linfo.li_length); + printf (_(" DWARF Version: %d\n"), linfo.li_version); + printf (_(" Prologue Length: %d\n"), linfo.li_prologue_length); + printf (_(" Minimum Instruction Length: %d\n"), linfo.li_min_insn_length); + printf (_(" Initial value of 'is_stmt': %d\n"), linfo.li_default_is_stmt); + printf (_(" Line Base: %d\n"), linfo.li_line_base); + printf (_(" Line Range: %d\n"), linfo.li_line_range); + printf (_(" Opcode Base: %d\n"), linfo.li_opcode_base); - end_of_sequence = data + info.li_length + initial_length_size; + end_of_sequence = data + linfo.li_length + initial_length_size; - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); /* Display the contents of the Opcodes table. */ standard_opcodes = hdrptr; printf (_("\n Opcodes:\n")); - for (i = 1; i < info.li_opcode_base; i++) + for (i = 1; i < linfo.li_opcode_base; i++) printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); /* Display the contents of the Directory table. */ - data = standard_opcodes + info.li_opcode_base - 1; + data = standard_opcodes + linfo.li_opcode_base - 1; if (*data == 0) printf (_("\n The Directory Table is empty.\n")); @@ -2375,14 +2375,14 @@ display_debug_lines_raw (struct dwarf_section *section, op_code = *data++; - if (op_code >= info.li_opcode_base) + if (op_code >= linfo.li_opcode_base) { - op_code -= info.li_opcode_base; - uladv = (op_code / info.li_line_range) * info.li_min_insn_length; + op_code -= linfo.li_opcode_base; + uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length; state_machine_regs.address += uladv; printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"), op_code, uladv, state_machine_regs.address); - adv = (op_code % info.li_line_range) + info.li_line_base; + adv = (op_code % linfo.li_line_range) + linfo.li_line_base; state_machine_regs.line += adv; printf (_(" and Line by %d to %d\n"), adv, state_machine_regs.line); @@ -2390,7 +2390,7 @@ display_debug_lines_raw (struct dwarf_section *section, else switch (op_code) { case DW_LNS_extended_op: - data += process_extended_line_op (data, info.li_default_is_stmt); + data += process_extended_line_op (data, linfo.li_default_is_stmt); break; case DW_LNS_copy: @@ -2399,7 +2399,7 @@ display_debug_lines_raw (struct dwarf_section *section, case DW_LNS_advance_pc: uladv = read_leb128 (data, & bytes_read, 0); - uladv *= info.li_min_insn_length; + uladv *= linfo.li_min_insn_length; data += bytes_read; state_machine_regs.address += uladv; printf (_(" Advance PC by %lu to 0x%lx\n"), uladv, @@ -2442,8 +2442,8 @@ display_debug_lines_raw (struct dwarf_section *section, break; case DW_LNS_const_add_pc: - uladv = (((255 - info.li_opcode_base) / info.li_line_range) - * info.li_min_insn_length); + uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range) + * linfo.li_min_insn_length); state_machine_regs.address += uladv; printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv, state_machine_regs.address); @@ -2511,7 +2511,7 @@ display_debug_lines_decoded (struct dwarf_section *section, while (data < end) { /* This loop amounts to one iteration per compilation unit. */ - DWARF2_Internal_LineInfo info; + DWARF2_Internal_LineInfo linfo; unsigned char *standard_opcodes; unsigned char *end_of_sequence; unsigned char *hdrptr; @@ -2528,13 +2528,13 @@ display_debug_lines_decoded (struct dwarf_section *section, (section 6.2.4 in the Dwarf3 doc). */ /* Get the length of this CU's line number information block. */ - info.li_length = byte_get (hdrptr, 4); + linfo.li_length = byte_get (hdrptr, 4); hdrptr += 4; - if (info.li_length == 0xffffffff) + if (linfo.li_length == 0xffffffff) { /* This section is 64-bit DWARF 3. */ - info.li_length = byte_get (hdrptr, 8); + linfo.li_length = byte_get (hdrptr, 8); hdrptr += 8; offset_size = 8; initial_length_size = 12; @@ -2545,7 +2545,7 @@ display_debug_lines_decoded (struct dwarf_section *section, initial_length_size = 4; } - if (info.li_length + initial_length_size > section->size) + if (linfo.li_length + initial_length_size > section->size) { warn (_("The line info appears to be corrupt - " "the section is too small\n")); @@ -2553,47 +2553,46 @@ display_debug_lines_decoded (struct dwarf_section *section, } /* Get this CU's Line Number Block version number. */ - info.li_version = byte_get (hdrptr, 2); + linfo.li_version = byte_get (hdrptr, 2); hdrptr += 2; - if (info.li_version != 2 && info.li_version != 3) + if (linfo.li_version != 2 && linfo.li_version != 3) { warn (_("Only DWARF version 2 and 3 line info is currently " "supported.\n")); return 0; } - info.li_prologue_length = byte_get (hdrptr, offset_size); + linfo.li_prologue_length = byte_get (hdrptr, offset_size); hdrptr += offset_size; - info.li_min_insn_length = byte_get (hdrptr, 1); + linfo.li_min_insn_length = byte_get (hdrptr, 1); hdrptr++; - info.li_default_is_stmt = byte_get (hdrptr, 1); + linfo.li_default_is_stmt = byte_get (hdrptr, 1); hdrptr++; - info.li_line_base = byte_get (hdrptr, 1); + linfo.li_line_base = byte_get (hdrptr, 1); hdrptr++; - info.li_line_range = byte_get (hdrptr, 1); + linfo.li_line_range = byte_get (hdrptr, 1); hdrptr++; - info.li_opcode_base = byte_get (hdrptr, 1); + linfo.li_opcode_base = byte_get (hdrptr, 1); hdrptr++; /* Sign extend the line base field. */ - info.li_line_base <<= 24; - info.li_line_base >>= 24; + linfo.li_line_base <<= 24; + linfo.li_line_base >>= 24; /* Find the end of this CU's Line Number Information Block. */ - end_of_sequence = data + info.li_length + initial_length_size; + end_of_sequence = data + linfo.li_length + initial_length_size; - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); /* Save a pointer to the contents of the Opcodes table. */ standard_opcodes = hdrptr; /* Traverse the Directory table just to count entries. */ - data = standard_opcodes + info.li_opcode_base - 1; + data = standard_opcodes + linfo.li_opcode_base - 1; if (*data != 0) { unsigned int n_directories = 0; unsigned char *ptr_directory_table = data; - int i; while (*data != 0) { @@ -2621,7 +2620,6 @@ display_debug_lines_decoded (struct dwarf_section *section, { unsigned int n_files = 0; unsigned char *ptr_file_name_table = data; - int i; while (*data != 0) { @@ -2700,13 +2698,13 @@ display_debug_lines_decoded (struct dwarf_section *section, op_code = *data++; prev_line = state_machine_regs.line; - if (op_code >= info.li_opcode_base) + if (op_code >= linfo.li_opcode_base) { - op_code -= info.li_opcode_base; - uladv = (op_code / info.li_line_range) * info.li_min_insn_length; + op_code -= linfo.li_opcode_base; + uladv = (op_code / linfo.li_line_range) * linfo.li_min_insn_length; state_machine_regs.address += uladv; - adv = (op_code % info.li_line_range) + info.li_line_base; + adv = (op_code % linfo.li_line_range) + linfo.li_line_base; state_machine_regs.line += adv; is_special_opcode = 1; } @@ -2715,7 +2713,6 @@ display_debug_lines_decoded (struct dwarf_section *section, case DW_LNS_extended_op: { unsigned int ext_op_code_len; - unsigned int bytes_read; unsigned char ext_op_code; unsigned char *op_code_data = data; @@ -2733,7 +2730,7 @@ display_debug_lines_decoded (struct dwarf_section *section, switch (ext_op_code) { case DW_LNE_end_sequence: - reset_state_machine (info.li_default_is_stmt); + reset_state_machine (linfo.li_default_is_stmt); break; case DW_LNE_set_address: state_machine_regs.address = @@ -2766,7 +2763,7 @@ display_debug_lines_decoded (struct dwarf_section *section, case DW_LNS_advance_pc: uladv = read_leb128 (data, & bytes_read, 0); - uladv *= info.li_min_insn_length; + uladv *= linfo.li_min_insn_length; data += bytes_read; state_machine_regs.address += uladv; break; @@ -2813,8 +2810,8 @@ display_debug_lines_decoded (struct dwarf_section *section, break; case DW_LNS_const_add_pc: - uladv = (((255 - info.li_opcode_base) / info.li_line_range) - * info.li_min_insn_length); + uladv = (((255 - linfo.li_opcode_base) / linfo.li_line_range) + * linfo.li_min_insn_length); state_machine_regs.address += uladv; break; @@ -2949,7 +2946,7 @@ static int display_debug_pubnames (struct dwarf_section *section, void *file ATTRIBUTE_UNUSED) { - DWARF2_Internal_PubNames pubnames; + DWARF2_Internal_PubNames names; unsigned char *start = section->start; unsigned char *end = start + section->size; @@ -2967,11 +2964,11 @@ display_debug_pubnames (struct dwarf_section *section, data = start; - pubnames.pn_length = byte_get (data, 4); + names.pn_length = byte_get (data, 4); data += 4; - if (pubnames.pn_length == 0xffffffff) + if (names.pn_length == 0xffffffff) { - pubnames.pn_length = byte_get (data, 8); + names.pn_length = byte_get (data, 8); data += 8; offset_size = 8; initial_length_size = 12; @@ -2982,24 +2979,24 @@ display_debug_pubnames (struct dwarf_section *section, initial_length_size = 4; } - pubnames.pn_version = byte_get (data, 2); + names.pn_version = byte_get (data, 2); data += 2; - pubnames.pn_offset = byte_get (data, offset_size); + names.pn_offset = byte_get (data, offset_size); data += offset_size; if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE && num_debug_info_entries > 0 - && find_debug_info_for_offset (pubnames.pn_offset) == NULL) + && find_debug_info_for_offset (names.pn_offset) == NULL) warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"), - pubnames.pn_offset, section->name); + names.pn_offset, section->name); - pubnames.pn_size = byte_get (data, offset_size); + names.pn_size = byte_get (data, offset_size); data += offset_size; - start += pubnames.pn_length + initial_length_size; + start += names.pn_length + initial_length_size; - if (pubnames.pn_version != 2 && pubnames.pn_version != 3) + if (names.pn_version != 2 && names.pn_version != 3) { static int warned = 0; @@ -3013,13 +3010,13 @@ display_debug_pubnames (struct dwarf_section *section, } printf (_(" Length: %ld\n"), - pubnames.pn_length); + names.pn_length); printf (_(" Version: %d\n"), - pubnames.pn_version); + names.pn_version); printf (_(" Offset into .debug_info section: 0x%lx\n"), - pubnames.pn_offset); + names.pn_offset); printf (_(" Size of area in .debug_info section: %ld\n"), - pubnames.pn_size); + names.pn_size); printf (_("\n Offset\tName\n")); @@ -3464,7 +3461,7 @@ display_debug_aranges (struct dwarf_section *section, { unsigned char *hdrptr; DWARF2_Internal_ARange arange; - unsigned char *ranges; + unsigned char *addr_ranges; dwarf_vma length; dwarf_vma address; unsigned char address_size; @@ -3536,24 +3533,24 @@ display_debug_aranges (struct dwarf_section *section, else printf (_("\n Address Length\n")); - ranges = hdrptr; + addr_ranges = hdrptr; /* Must pad to an alignment boundary that is twice the address size. */ excess = (hdrptr - start) % (2 * address_size); if (excess) - ranges += (2 * address_size) - excess; + addr_ranges += (2 * address_size) - excess; start += arange.ar_length + initial_length_size; - while (ranges + 2 * address_size <= start) + while (addr_ranges + 2 * address_size <= start) { - address = byte_get (ranges, address_size); + address = byte_get (addr_ranges, address_size); - ranges += address_size; + addr_ranges += address_size; - length = byte_get (ranges, address_size); + length = byte_get (addr_ranges, address_size); - ranges += address_size; + addr_ranges += address_size; printf (" "); print_dwarf_vma (address, address_size); @@ -3880,11 +3877,11 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) if (*need_col_headers) { - static const char *loc = " LOC"; + static const char *sloc = " LOC"; *need_col_headers = 0; - printf ("%-*s CFA ", eh_addr_size * 2, loc); + printf ("%-*s CFA ", eh_addr_size * 2, sloc); for (r = 0; r < *max_regs; r++) if (fc->col_type[r] != DW_CFA_unreferenced) @@ -4218,7 +4215,7 @@ display_debug_frames (struct dwarf_section *section, while (start < block_end) { unsigned op, opa; - unsigned long reg, tmp; + unsigned long reg, temp; op = *start++; opa = op & 0x3f; @@ -4289,14 +4286,14 @@ display_debug_frames (struct dwarf_section *section, LEB (); break; case DW_CFA_def_cfa_expression: - tmp = LEB (); - start += tmp; + temp = LEB (); + start += temp; break; case DW_CFA_expression: case DW_CFA_val_expression: reg = LEB (); - tmp = LEB (); - start += tmp; + temp = LEB (); + start += temp; if (frame_need_space (fc, reg) >= 0) fc->col_type[reg] = DW_CFA_undefined; break; @@ -4918,10 +4915,10 @@ dwarf_select_sections_by_names (const char *names) void dwarf_select_sections_by_letters (const char *letters) { - unsigned int index = 0; + unsigned int lindex = 0; - while (letters[index]) - switch (letters[index++]) + while (letters[lindex]) + switch (letters[lindex++]) { case 'i': do_debug_info = 1; diff --git a/binutils/ieee.c b/binutils/ieee.c index fd8374b335d..9a5bb55414c 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -2616,7 +2616,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, case 'b': { bfd_vma flags, cinline; - const char *basename, *fieldname; + const char *base, *fieldname; unsigned long baselen, fieldlen; char *basecopy; debug_type basetype; @@ -2628,7 +2628,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, /* This represents a base or friend class. */ if (! ieee_require_asn (info, pp, &flags) - || ! ieee_require_atn65 (info, pp, &basename, &baselen) + || ! ieee_require_atn65 (info, pp, &base, &baselen) || ! ieee_require_asn (info, pp, &cinline) || ! ieee_require_atn65 (info, pp, &fieldname, &fieldlen)) return FALSE; @@ -2650,7 +2650,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, return FALSE; } - basecopy = savestring (basename, baselen); + basecopy = savestring (base, baselen); basetype = debug_find_tagged_type (dhandle, basecopy, DEBUG_KIND_ILLEGAL); free (basecopy); @@ -3113,7 +3113,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, case 'z': { - const char *vname, *basename; + const char *vname, *base; unsigned long vnamelen, baselen; bfd_vma vsize, control; @@ -3121,7 +3121,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, if (! ieee_require_atn65 (info, pp, &vname, &vnamelen) || ! ieee_require_asn (info, pp, &vsize) - || ! ieee_require_atn65 (info, pp, &basename, &baselen) + || ! ieee_require_atn65 (info, pp, &base, &baselen) || ! ieee_require_asn (info, pp, &control)) return FALSE; count -= 4; @@ -3138,7 +3138,7 @@ ieee_read_cxx_class (struct ieee_info *info, const bfd_byte **pp, { char *basecopy; - basecopy = savestring (basename, baselen); + basecopy = savestring (base, baselen); vptrbase = debug_find_tagged_type (dhandle, basecopy, DEBUG_KIND_ILLEGAL); free (basecopy); @@ -5980,8 +5980,6 @@ ieee_struct_field (void *p, const char *name, bfd_vma bitpos, bfd_vma bitsize, if (referencep) { - unsigned int nindx; - /* We need to output a record recording that this field is really of reference type. We put this on the refs field of classdef, so that it can be appended to the C++ diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index c10eb12076a..a675f61b62b 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -2039,7 +2039,7 @@ powerpc_mangle_relocs (bfd *outbfd, asection *insec, file. */ static char * -link_inputs (struct string_list *inputs, char *ld, char * map_file) +link_inputs (struct string_list *inputs, char *ld, char * mfile) { size_t c; struct string_list *q; @@ -2088,12 +2088,12 @@ link_inputs (struct string_list *inputs, char *ld, char * map_file) argv[3] = unlink_on_exit; /* If we have been given the name of a mapfile and that name is not 'stderr' then pass it on to the linker. */ - if (map_file - && * map_file - && strcmp (map_file, "stderr") == 0) + if (mfile + && * mfile + && strcmp (mfile, "stderr") == 0) { argv[4] = (char *) "-Map"; - argv[5] = map_file; + argv[5] = mfile; i = 6; } else diff --git a/binutils/nm.c b/binutils/nm.c index c838b0a2b03..5ad9c2060e5 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -343,11 +343,11 @@ get_symbol_type (unsigned int type) } } -/* Print symbol name NAME, read from ABFD, with printf format FORMAT, +/* Print symbol name NAME, read from ABFD, with printf format FORM, demangling it if requested. */ static void -print_symname (const char *format, const char *name, bfd *abfd) +print_symname (const char *form, const char *name, bfd *abfd) { if (do_demangle && *name) { @@ -355,13 +355,13 @@ print_symname (const char *format, const char *name, bfd *abfd) if (res != NULL) { - printf (format, res); + printf (form, res); free (res); return; } } - printf (format, name); + printf (form, name); } static void @@ -397,7 +397,7 @@ print_symdef_entry (bfd *abfd) Return the number of symbols to be printed. */ static long -filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, +filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size) { bfd_byte *from, *fromend, *to; @@ -418,7 +418,7 @@ filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, PROGRESS (1); - sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -659,7 +659,7 @@ size_forward2 (const void *P_x, const void *P_y) size. */ static long -sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, +sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size, struct size_sym **symsizesp) { @@ -686,7 +686,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, if (from < fromend) { - sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, (const void *) from, store_sym); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -702,7 +702,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, if (from + size < fromend) { next = bfd_minisymbol_to_symbol (abfd, - dynamic, + is_dynamic, (const void *) (from + size), store_next); if (next == NULL) @@ -861,7 +861,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) if (relocs == NULL) { - struct get_relocs_info info; + struct get_relocs_info rinfo; seccount = bfd_count_sections (abfd); @@ -869,11 +869,11 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); relcount = (long *) xmalloc (seccount * sizeof *relcount); - info.secs = secs; - info.relocs = relocs; - info.relcount = relcount; - info.syms = syms; - bfd_map_over_sections (abfd, get_relocs, (void *) &info); + rinfo.secs = secs; + rinfo.relocs = relocs; + rinfo.relcount = relcount; + rinfo.syms = syms; + bfd_map_over_sections (abfd, get_relocs, (void *) &rinfo); lineno_cache_rel_bfd = abfd; } @@ -923,7 +923,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) /* Print the symbols when sorting by size. */ static void -print_size_symbols (bfd *abfd, bfd_boolean dynamic, +print_size_symbols (bfd *abfd, bfd_boolean is_dynamic, struct size_sym *symsizes, long symcount, bfd *archive_bfd) { @@ -941,7 +941,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic, asymbol *sym; bfd_vma ssize; - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from->minisym, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -960,7 +960,7 @@ print_size_symbols (bfd *abfd, bfd_boolean dynamic, containing ABFD. */ static void -print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, +print_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, long symcount, unsigned int size, bfd *archive_bfd) { asymbol *store; @@ -976,7 +976,7 @@ print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, { asymbol *sym; - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store); + sym = bfd_minisymbol_to_symbol (abfd, is_dynamic, from, store); if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 9732b86fa8c..20f867c01f9 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2295,28 +2295,28 @@ static void add_section_rename (const char * old_name, const char * new_name, flagword flags) { - section_rename * rename; + section_rename * srename; /* Check for conflicts first. */ - for (rename = section_rename_list; rename != NULL; rename = rename->next) - if (strcmp (rename->old_name, old_name) == 0) + for (srename = section_rename_list; srename != NULL; srename = srename->next) + if (strcmp (srename->old_name, old_name) == 0) { /* Silently ignore duplicate definitions. */ - if (strcmp (rename->new_name, new_name) == 0 - && rename->flags == flags) + if (strcmp (srename->new_name, new_name) == 0 + && srename->flags == flags) return; fatal (_("Multiple renames of section %s"), old_name); } - rename = (section_rename *) xmalloc (sizeof (* rename)); + srename = (section_rename *) xmalloc (sizeof (* srename)); - rename->old_name = old_name; - rename->new_name = new_name; - rename->flags = flags; - rename->next = section_rename_list; + srename->old_name = old_name; + srename->new_name = new_name; + srename->flags = flags; + srename->next = section_rename_list; - section_rename_list = rename; + section_rename_list = srename; } /* Check the section rename list for a new name of the input section @@ -2328,18 +2328,18 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection, flagword * returned_flags) { const char * old_name = bfd_section_name (ibfd, isection); - section_rename * rename; + section_rename * srename; /* Default to using the flags of the input section. */ * returned_flags = bfd_get_section_flags (ibfd, isection); - for (rename = section_rename_list; rename != NULL; rename = rename->next) - if (strcmp (rename->old_name, old_name) == 0) + for (srename = section_rename_list; srename != NULL; srename = srename->next) + if (strcmp (srename->old_name, old_name) == 0) { - if (rename->flags != (flagword) -1) - * returned_flags = rename->flags; + if (srename->flags != (flagword) -1) + * returned_flags = srename->flags; - return rename->new_name; + return srename->new_name; } return old_name; diff --git a/binutils/objdump.c b/binutils/objdump.c index 42d8961b93d..79be66501d8 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -667,14 +667,14 @@ compare_relocs (const void *ap, const void *bp) If SKIP_ZEROES is TRUE, omit leading zeroes. */ static void -objdump_print_value (bfd_vma vma, struct disassemble_info *info, +objdump_print_value (bfd_vma vma, struct disassemble_info *inf, bfd_boolean skip_zeroes) { char buf[30]; char *p; struct objdump_disasm_info *aux; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; bfd_sprintf_vma (aux->abfd, buf, vma); if (! skip_zeroes) p = buf; @@ -685,13 +685,13 @@ objdump_print_value (bfd_vma vma, struct disassemble_info *info, if (*p == '\0') --p; } - (*info->fprintf_func) (info->stream, "%s", p); + (*inf->fprintf_func) (inf->stream, "%s", p); } /* Print the name of a symbol. */ static void -objdump_print_symname (bfd *abfd, struct disassemble_info *info, +objdump_print_symname (bfd *abfd, struct disassemble_info *inf, asymbol *sym) { char *alloc; @@ -707,8 +707,8 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info, name = alloc; } - if (info != NULL) - (*info->fprintf_func) (info->stream, "%s", name); + if (inf != NULL) + (*inf->fprintf_func) (inf->stream, "%s", name); else printf ("%s", name); @@ -724,7 +724,7 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info, static asymbol * find_symbol_for_address (bfd_vma vma, - struct disassemble_info *info, + struct disassemble_info *inf, long *place) { /* @@ Would it speed things up to cache the last two symbols returned, @@ -734,7 +734,7 @@ find_symbol_for_address (bfd_vma vma, /* Indices in `sorted_syms'. */ long min = 0; - long max = sorted_symcount; + long max_count = sorted_symcount; long thisplace; struct objdump_disasm_info *aux; bfd *abfd; @@ -745,22 +745,22 @@ find_symbol_for_address (bfd_vma vma, if (sorted_symcount < 1) return NULL; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; abfd = aux->abfd; sec = aux->sec; - opb = info->octets_per_byte; + opb = inf->octets_per_byte; /* Perform a binary search looking for the closest symbol to the - required value. We are searching the range (min, max]. */ - while (min + 1 < max) + required value. We are searching the range (min, max_count]. */ + while (min + 1 < max_count) { asymbol *sym; - thisplace = (max + min) / 2; + thisplace = (max_count + min) / 2; sym = sorted_syms[thisplace]; if (bfd_asymbol_value (sym) > vma) - max = thisplace; + max_count = thisplace; else if (bfd_asymbol_value (sym) < vma) min = thisplace; else @@ -783,12 +783,12 @@ find_symbol_for_address (bfd_vma vma, with the same value, as can occur with overlays or zero size sections. */ min = thisplace; - while (min < max + while (min < max_count && (bfd_asymbol_value (sorted_syms[min]) == bfd_asymbol_value (sorted_syms[thisplace]))) { if (sorted_syms[min]->section == sec - && info->symbol_is_valid (sorted_syms[min], info)) + && inf->symbol_is_valid (sorted_syms[min], inf)) { thisplace = min; @@ -816,7 +816,7 @@ find_symbol_for_address (bfd_vma vma, && vma < (bfd_get_section_vma (abfd, sec) + bfd_section_size (abfd, sec) / opb))); if ((sorted_syms[thisplace]->section != sec && want_section) - || !info->symbol_is_valid (sorted_syms[thisplace], info)) + || ! inf->symbol_is_valid (sorted_syms[thisplace], inf)) { long i; long newplace = sorted_symcount; @@ -824,7 +824,7 @@ find_symbol_for_address (bfd_vma vma, for (i = min - 1; i >= 0; i--) { if ((sorted_syms[i]->section == sec || !want_section) - && info->symbol_is_valid (sorted_syms[i], info)) + && inf->symbol_is_valid (sorted_syms[i], inf)) { if (newplace == sorted_symcount) newplace = i; @@ -848,7 +848,7 @@ find_symbol_for_address (bfd_vma vma, for (i = thisplace + 1; i < sorted_symcount; i++) { if ((sorted_syms[i]->section == sec || !want_section) - && info->symbol_is_valid (sorted_syms[i], info)) + && inf->symbol_is_valid (sorted_syms[i], inf)) { thisplace = i; break; @@ -857,7 +857,7 @@ find_symbol_for_address (bfd_vma vma, } if ((sorted_syms[thisplace]->section != sec && want_section) - || !info->symbol_is_valid (sorted_syms[thisplace], info)) + || ! inf->symbol_is_valid (sorted_syms[thisplace], inf)) /* There is no suitable symbol. */ return NULL; } @@ -872,49 +872,49 @@ find_symbol_for_address (bfd_vma vma, static void objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, - bfd_vma vma, struct disassemble_info *info, + bfd_vma vma, struct disassemble_info *inf, bfd_boolean skip_zeroes) { - objdump_print_value (vma, info, skip_zeroes); + objdump_print_value (vma, inf, skip_zeroes); if (sym == NULL) { bfd_vma secaddr; - (*info->fprintf_func) (info->stream, " <%s", - bfd_get_section_name (abfd, sec)); + (*inf->fprintf_func) (inf->stream, " <%s", + bfd_get_section_name (abfd, sec)); secaddr = bfd_get_section_vma (abfd, sec); if (vma < secaddr) { - (*info->fprintf_func) (info->stream, "-0x"); - objdump_print_value (secaddr - vma, info, TRUE); + (*inf->fprintf_func) (inf->stream, "-0x"); + objdump_print_value (secaddr - vma, inf, TRUE); } else if (vma > secaddr) { - (*info->fprintf_func) (info->stream, "+0x"); - objdump_print_value (vma - secaddr, info, TRUE); + (*inf->fprintf_func) (inf->stream, "+0x"); + objdump_print_value (vma - secaddr, inf, TRUE); } - (*info->fprintf_func) (info->stream, ">"); + (*inf->fprintf_func) (inf->stream, ">"); } else { - (*info->fprintf_func) (info->stream, " <"); - objdump_print_symname (abfd, info, sym); + (*inf->fprintf_func) (inf->stream, " <"); + objdump_print_symname (abfd, inf, sym); if (bfd_asymbol_value (sym) > vma) { - (*info->fprintf_func) (info->stream, "-0x"); - objdump_print_value (bfd_asymbol_value (sym) - vma, info, TRUE); + (*inf->fprintf_func) (inf->stream, "-0x"); + objdump_print_value (bfd_asymbol_value (sym) - vma, inf, TRUE); } else if (vma > bfd_asymbol_value (sym)) { - (*info->fprintf_func) (info->stream, "+0x"); - objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE); + (*inf->fprintf_func) (inf->stream, "+0x"); + objdump_print_value (vma - bfd_asymbol_value (sym), inf, TRUE); } - (*info->fprintf_func) (info->stream, ">"); + (*inf->fprintf_func) (inf->stream, ">"); } if (display_file_offsets) - info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), + inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), (long int)(sec->filepos + (vma - sec->vma))); } @@ -923,23 +923,23 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, static void objdump_print_addr (bfd_vma vma, - struct disassemble_info *info, + struct disassemble_info *inf, bfd_boolean skip_zeroes) { struct objdump_disasm_info *aux; asymbol *sym = NULL; bfd_boolean skip_find = FALSE; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; if (sorted_symcount < 1) { - (*info->fprintf_func) (info->stream, "0x"); - objdump_print_value (vma, info, skip_zeroes); + (*inf->fprintf_func) (inf->stream, "0x"); + objdump_print_value (vma, inf, skip_zeroes); if (display_file_offsets) - info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"), - (long int)(aux->sec->filepos + (vma - aux->sec->vma))); + inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), + (long int)(aux->sec->filepos + (vma - aux->sec->vma))); return; } @@ -957,9 +957,9 @@ objdump_print_addr (bfd_vma vma, } if (!skip_find) - sym = find_symbol_for_address (vma, info, NULL); + sym = find_symbol_for_address (vma, inf, NULL); - objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, + objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, inf, skip_zeroes); } @@ -967,19 +967,19 @@ objdump_print_addr (bfd_vma vma, routine. */ static void -objdump_print_address (bfd_vma vma, struct disassemble_info *info) +objdump_print_address (bfd_vma vma, struct disassemble_info *inf) { - objdump_print_addr (vma, info, ! prefix_addresses); + objdump_print_addr (vma, inf, ! prefix_addresses); } /* Determine if the given address has a symbol associated with it. */ static int -objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info) +objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * inf) { asymbol * sym; - sym = find_symbol_for_address (vma, info, NULL); + sym = find_symbol_for_address (vma, inf, NULL); return (sym != NULL && (bfd_asymbol_value (sym) == vma)); } @@ -1191,15 +1191,15 @@ update_source_path (const char *filename) /* Print a source file line. */ static void -print_line (struct print_file_list *p, unsigned int line) +print_line (struct print_file_list *p, unsigned int linenum) { const char *l; size_t len; - --line; - if (line >= p->maxline) + --linenum; + if (linenum >= p->maxline) return; - l = p->linemap [line]; + l = p->linemap [linenum]; /* Test fwrite return value to quiet glibc warning. */ len = strcspn (l, "\n\r"); if (len == 0 || fwrite (l, len, 1, stdout) == 1) @@ -1228,14 +1228,14 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) { const char *filename; const char *functionname; - unsigned int line; + unsigned int linenumber; bfd_boolean reloc; if (! with_line_numbers && ! with_source_code) return; if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename, - &functionname, &line)) + &functionname, &linenumber)) return; if (filename != NULL && *filename == '\0') @@ -1287,13 +1287,13 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) && (prev_functionname == NULL || strcmp (functionname, prev_functionname) != 0)) printf ("%s():\n", functionname); - if (line > 0 && line != prev_line) - printf ("%s:%u\n", filename == NULL ? "???" : filename, line); + if (linenumber > 0 && linenumber != prev_line) + printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber); } if (with_source_code && filename != NULL - && line > 0) + && linenumber > 0) { struct print_file_list **pp, *p; unsigned l; @@ -1310,20 +1310,20 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) p = update_source_path (filename); } - if (p != NULL && line != p->last_line) + if (p != NULL && linenumber != p->last_line) { if (file_start_context && p->first) l = 1; else { - l = line - SHOW_PRECEDING_CONTEXT_LINES; - if (l >= line) + l = linenumber - SHOW_PRECEDING_CONTEXT_LINES; + if (l >= linenumber) l = 1; - if (p->last_line >= l && p->last_line <= line) + if (p->last_line >= l && p->last_line <= linenumber) l = p->last_line + 1; } - dump_lines (p, l, line); - p->last_line = line; + dump_lines (p, l, linenumber); + p->last_line = linenumber; p->first = 0; } } @@ -1338,8 +1338,8 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) strcpy (prev_functionname, functionname); } - if (line > 0 && line != prev_line) - prev_line = line; + if (linenumber > 0 && linenumber != prev_line) + prev_line = linenumber; } /* Pseudo FILE object for strings. */ @@ -1394,7 +1394,7 @@ objdump_sprintf (SFILE *f, const char *format, ...) /* Disassemble some data in memory between given values. */ static void -disassemble_bytes (struct disassemble_info * info, +disassemble_bytes (struct disassemble_info * inf, disassembler_ftype disassemble_fn, bfd_boolean insns, bfd_byte * data, @@ -1410,13 +1410,13 @@ disassemble_bytes (struct disassemble_info * info, bfd_boolean done_dot; int skip_addr_chars; bfd_vma addr_offset; - unsigned int opb = info->octets_per_byte; - unsigned int skip_zeroes = info->skip_zeroes; - unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end; + unsigned int opb = inf->octets_per_byte; + unsigned int skip_zeroes = inf->skip_zeroes; + unsigned int skip_zeroes_at_end = inf->skip_zeroes_at_end; int octets = opb; SFILE sfile; - aux = (struct objdump_disasm_info *) info->application_data; + aux = (struct objdump_disasm_info *) inf->application_data; section = aux->sec; sfile.alloc = 120; @@ -1452,7 +1452,7 @@ disassemble_bytes (struct disassemble_info * info, skip_addr_chars = (skip_addr_chars - 1) & -4; } - info->insn_info_valid = 0; + inf->insn_info_valid = 0; done_dot = FALSE; addr_offset = start_offset; @@ -1472,8 +1472,8 @@ disassemble_bytes (struct disassemble_info * info, if (data[z] != 0) break; if (! disassemble_zeroes - && (info->insn_info_valid == 0 - || info->branch_delay_insns == 0) + && (inf->insn_info_valid == 0 + || inf->branch_delay_insns == 0) && (z - addr_offset * opb >= skip_zeroes || (z == stop_offset * opb && z - addr_offset * opb < skip_zeroes_at_end))) @@ -1523,7 +1523,7 @@ disassemble_bytes (struct disassemble_info * info, else { aux->require_sec = TRUE; - objdump_print_address (section->vma + addr_offset, info); + objdump_print_address (section->vma + addr_offset, inf); aux->require_sec = FALSE; putchar (' '); } @@ -1531,15 +1531,15 @@ disassemble_bytes (struct disassemble_info * info, if (insns) { sfile.pos = 0; - info->fprintf_func = (fprintf_ftype) objdump_sprintf; - info->stream = &sfile; - info->bytes_per_line = 0; - info->bytes_per_chunk = 0; - info->flags = disassemble_all ? DISASSEMBLE_DATA : 0; + inf->fprintf_func = (fprintf_ftype) objdump_sprintf; + inf->stream = &sfile; + inf->bytes_per_line = 0; + inf->bytes_per_chunk = 0; + inf->flags = disassemble_all ? DISASSEMBLE_DATA : 0; if (machine) - info->flags |= USER_SPECIFIED_MACHINE_TYPE; + inf->flags |= USER_SPECIFIED_MACHINE_TYPE; - if (info->disassembler_needs_relocs + if (inf->disassembler_needs_relocs && (bfd_get_file_flags (aux->abfd) & EXEC_P) == 0 && (bfd_get_file_flags (aux->abfd) & DYNAMIC) == 0 && *relppp < relppend) @@ -1566,18 +1566,18 @@ disassemble_bytes (struct disassemble_info * info, || (distance_to_rel > 0 && distance_to_rel < (bfd_signed_vma) (previous_octets/ opb))) { - info->flags |= INSN_HAS_RELOC; + inf->flags |= INSN_HAS_RELOC; aux->reloc = **relppp; } else aux->reloc = NULL; } - octets = (*disassemble_fn) (section->vma + addr_offset, info); - info->fprintf_func = (fprintf_ftype) fprintf; - info->stream = stdout; - if (insn_width == 0 && info->bytes_per_line != 0) - octets_per_line = info->bytes_per_line; + octets = (*disassemble_fn) (section->vma + addr_offset, inf); + inf->fprintf_func = (fprintf_ftype) fprintf; + inf->stream = stdout; + if (insn_width == 0 && inf->bytes_per_line != 0) + octets_per_line = inf->bytes_per_line; if (octets < 0) { if (sfile.pos) @@ -1615,8 +1615,8 @@ disassemble_bytes (struct disassemble_info * info, if (pb > octets_per_line && ! prefix_addresses && ! wide_output) pb = octets_per_line; - if (info->bytes_per_chunk) - bpc = info->bytes_per_chunk; + if (inf->bytes_per_chunk) + bpc = inf->bytes_per_chunk; else bpc = 1; @@ -1624,7 +1624,7 @@ disassemble_bytes (struct disassemble_info * info, { int k; - if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE) { for (k = bpc - 1; k >= 0; k--) printf ("%02x", (unsigned) data[j + k]); @@ -1685,7 +1685,7 @@ disassemble_bytes (struct disassemble_info * info, { int k; - if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) + if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE) { for (k = bpc - 1; k >= 0; k--) printf ("%02x", (unsigned) data[j + k]); @@ -1722,7 +1722,7 @@ disassemble_bytes (struct disassemble_info * info, printf ("\t\t\t"); objdump_print_value (section->vma - rel_offset + q->address, - info, TRUE); + inf, TRUE); if (q->howto == NULL) printf (": *unknown*\t"); @@ -1739,7 +1739,7 @@ disassemble_bytes (struct disassemble_info * info, sym_name = bfd_asymbol_name (*q->sym_ptr_ptr); if (sym_name != NULL && *sym_name != '\0') - objdump_print_symname (aux->abfd, info, *q->sym_ptr_ptr); + objdump_print_symname (aux->abfd, inf, *q->sym_ptr_ptr); else { asection *sym_sec; @@ -1755,7 +1755,7 @@ disassemble_bytes (struct disassemble_info * info, if (q->addend) { printf ("+0x"); - objdump_print_value (q->addend, info, TRUE); + objdump_print_value (q->addend, inf, TRUE); } printf ("\n"); @@ -1774,11 +1774,11 @@ disassemble_bytes (struct disassemble_info * info, } static void -disassemble_section (bfd *abfd, asection *section, void *info) +disassemble_section (bfd *abfd, asection *section, void *inf) { const struct elf_backend_data * bed; bfd_vma sign_adjust = 0; - struct disassemble_info * pinfo = (struct disassemble_info *) info; + struct disassemble_info * pinfo = (struct disassemble_info *) inf; struct objdump_disasm_info * paux; unsigned int opb = pinfo->octets_per_byte; bfd_byte * data = NULL; @@ -1888,7 +1888,7 @@ disassemble_section (bfd *abfd, asection *section, void *info) /* Find the nearest symbol forwards from our current position. */ paux->require_sec = TRUE; sym = (asymbol *) find_symbol_for_address (section->vma + addr_offset, - (struct disassemble_info *) info, + (struct disassemble_info *) inf, &place); paux->require_sec = FALSE; @@ -2056,12 +2056,12 @@ disassemble_data (bfd *abfd) if (machine != NULL) { - const bfd_arch_info_type *info = bfd_scan_arch (machine); + const bfd_arch_info_type *inf = bfd_scan_arch (machine); - if (info == NULL) + if (inf == NULL) fatal (_("Can't use supplied machine %s"), machine); - abfd->arch_info = info; + abfd->arch_info = inf; } if (endian != BFD_ENDIAN_UNKNOWN) @@ -2665,26 +2665,26 @@ static void dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) { asymbol **current; - long max; + long max_count; long count; if (dynamic) { current = dynsyms; - max = dynsymcount; + max_count = dynsymcount; printf ("DYNAMIC SYMBOL TABLE:\n"); } else { current = syms; - max = symcount; + max_count = symcount; printf ("SYMBOL TABLE:\n"); } - if (max == 0) + if (max_count == 0) printf (_("no symbols\n")); - for (count = 0; count < max; count++) + for (count = 0; count < max_count; count++) { bfd *cur_bfd; @@ -2759,7 +2759,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) { arelent *q = *p; const char *filename, *functionname; - unsigned int line; + unsigned int linenumber; const char *sym_name; const char *section_name; @@ -2773,7 +2773,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) if (with_line_numbers && sec != NULL && bfd_find_nearest_line (abfd, sec, syms, q->address, - &filename, &functionname, &line)) + &filename, &functionname, &linenumber)) { if (functionname != NULL && (last_functionname == NULL @@ -2785,14 +2785,14 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) last_functionname = xstrdup (functionname); } - if (line > 0 - && (line != last_line + if (linenumber > 0 + && (linenumber != last_line || (filename != NULL && last_filename != NULL && strcmp (filename, last_filename) != 0))) { - printf ("%s:%u\n", filename == NULL ? "???" : filename, line); - last_line = line; + printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber); + last_line = linenumber; if (last_filename != NULL) free (last_filename); if (filename == NULL) diff --git a/binutils/prdbg.c b/binutils/prdbg.c index 59313bb82a2..78a8fc7511f 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -1947,13 +1947,13 @@ translate_addresses (bfd *abfd, char *addr_hex, FILE *f, asymbol **syms) /* Start a new compilation unit. */ static bfd_boolean -tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED) +tg_start_compilation_unit (void * p, const char *fname ATTRIBUTE_UNUSED) { struct pr_handle *info = (struct pr_handle *) p; free (info->filename); /* Should it be relative? best way to do it here?. */ - info->filename = strdup (filename); + info->filename = strdup (fname); return TRUE; } @@ -1961,13 +1961,13 @@ tg_start_compilation_unit (void * p, const char *filename ATTRIBUTE_UNUSED) /* Start a source file within a compilation unit. */ static bfd_boolean -tg_start_source (void *p, const char *filename) +tg_start_source (void *p, const char *fname) { struct pr_handle *info = (struct pr_handle *) p; free (info->filename); /* Should it be relative? best way to do it here?. */ - info->filename = strdup (filename); + info->filename = strdup (fname); return TRUE; } @@ -2744,7 +2744,7 @@ tg_start_block (void *p, bfd_vma addr) /* Write out line number information. */ static bfd_boolean -tg_lineno (void *p ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED, +tg_lineno (void *p ATTRIBUTE_UNUSED, const char *fname ATTRIBUTE_UNUSED, unsigned long lineno ATTRIBUTE_UNUSED, bfd_vma addr ATTRIBUTE_UNUSED) { diff --git a/binutils/readelf.c b/binutils/readelf.c index 92a214217d9..689cd8acc5e 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -729,13 +729,13 @@ slurp_rela_relocs (FILE * file, little-endian symbol index followed by four individual byte fields. Reorder INFO accordingly. */ - bfd_vma info = relas[i].r_info; - info = (((info & 0xffffffff) << 32) - | ((info >> 56) & 0xff) - | ((info >> 40) & 0xff00) - | ((info >> 24) & 0xff0000) - | ((info >> 8) & 0xff000000)); - relas[i].r_info = info; + bfd_vma inf = relas[i].r_info; + inf = (((inf & 0xffffffff) << 32) + | ((inf >> 56) & 0xff) + | ((inf >> 40) & 0xff00) + | ((inf >> 24) & 0xff0000) + | ((inf >> 8) & 0xff000000)); + relas[i].r_info = inf; } #endif /* BFD64 */ } @@ -825,13 +825,13 @@ slurp_rel_relocs (FILE * file, little-endian symbol index followed by four individual byte fields. Reorder INFO accordingly. */ - bfd_vma info = rels[i].r_info; - info = (((info & 0xffffffff) << 32) - | ((info >> 56) & 0xff) - | ((info >> 40) & 0xff00) - | ((info >> 24) & 0xff0000) - | ((info >> 8) & 0xff000000)); - rels[i].r_info = info; + bfd_vma inf = rels[i].r_info; + inf = (((inf & 0xffffffff) << 32) + | ((inf >> 56) & 0xff) + | ((inf >> 40) & 0xff00) + | ((inf >> 24) & 0xff0000) + | ((inf >> 8) & 0xff000000)); + rels[i].r_info = inf; } #endif /* BFD64 */ } @@ -942,21 +942,21 @@ dump_relocations (FILE * file, { const char * rtype; bfd_vma offset; - bfd_vma info; + bfd_vma inf; bfd_vma symtab_index; bfd_vma type; offset = rels[i].r_offset; - info = rels[i].r_info; + inf = rels[i].r_info; - type = get_reloc_type (info); - symtab_index = get_reloc_symindex (info); + type = get_reloc_type (inf); + symtab_index = get_reloc_symindex (inf); if (is_32bit_elf) { printf ("%8.8lx %8.8lx ", (unsigned long) offset & 0xffffffff, - (unsigned long) info & 0xffffffff); + (unsigned long) inf & 0xffffffff); } else { @@ -964,18 +964,18 @@ dump_relocations (FILE * file, printf (do_wide ? "%16.16lx %16.16lx " : "%12.12lx %12.12lx ", - offset, info); + offset, inf); #elif BFD_HOST_64BIT_LONG_LONG #ifndef __MSVCRT__ printf (do_wide ? "%16.16llx %16.16llx " : "%12.12llx %12.12llx ", - offset, info); + offset, inf); #else printf (do_wide ? "%16.16I64x %16.16I64x " : "%12.12I64x %12.12I64x ", - offset, info); + offset, inf); #endif #else printf (do_wide @@ -983,8 +983,8 @@ dump_relocations (FILE * file, : "%4.4lx%8.8lx %4.4lx%8.8lx ", _bfd_int64_high (offset), _bfd_int64_low (offset), - _bfd_int64_high (info), - _bfd_int64_low (info)); + _bfd_int64_high (inf), + _bfd_int64_low (inf)); #endif } @@ -1355,12 +1355,12 @@ dump_relocations (FILE * file, if (is_rela) { - long offset = (long) (bfd_signed_vma) rels[i].r_addend; + long off = (long) (bfd_signed_vma) rels[i].r_addend; - if (offset < 0) - printf (" - %lx", - offset); + if (off < 0) + printf (" - %lx", - off); else - printf (" + %lx", offset); + printf (" + %lx", off); } } } @@ -1374,15 +1374,15 @@ dump_relocations (FILE * file, if (elf_header.e_machine == EM_SPARCV9 && rtype != NULL && streq (rtype, "R_SPARC_OLO10")) - printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); + printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (inf)); putchar ('\n'); #ifdef BFD64 if (! is_32bit_elf && elf_header.e_machine == EM_MIPS) { - bfd_vma type2 = ELF64_MIPS_R_TYPE2 (info); - bfd_vma type3 = ELF64_MIPS_R_TYPE3 (info); + bfd_vma type2 = ELF64_MIPS_R_TYPE2 (inf); + bfd_vma type3 = ELF64_MIPS_R_TYPE3 (inf); const char * rtype2 = elf_mips_reloc_type (type2); const char * rtype3 = elf_mips_reloc_type (type3); @@ -3368,7 +3368,7 @@ process_file_header (void) static int -get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) +get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) { Elf32_External_Phdr * phdrs; Elf32_External_Phdr * external; @@ -3382,7 +3382,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) if (!phdrs) return 0; - for (i = 0, internal = program_headers, external = phdrs; + for (i = 0, internal = pheaders, external = phdrs; i < elf_header.e_phnum; i++, internal++, external++) { @@ -3402,7 +3402,7 @@ get_32bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) } static int -get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) +get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * pheaders) { Elf64_External_Phdr * phdrs; Elf64_External_Phdr * external; @@ -3416,7 +3416,7 @@ get_64bit_program_headers (FILE * file, Elf_Internal_Phdr * program_headers) if (!phdrs) return 0; - for (i = 0, internal = program_headers, external = phdrs; + for (i = 0, internal = pheaders, external = phdrs; i < elf_header.e_phnum; i++, internal++, external++) { @@ -3959,7 +3959,8 @@ get_elf_section_flags (bfd_vma sh_flags) static char buff[1024]; char * p = buff; int field_size = is_32bit_elf ? 8 : 16; - int index, size = sizeof (buff) - (field_size + 4 + 1); + int sindex; + int size = sizeof (buff) - (field_size + 4 + 1); bfd_vma os_flags = 0; bfd_vma proc_flags = 0; bfd_vma unknown_flags = 0; @@ -4013,36 +4014,36 @@ get_elf_section_flags (bfd_vma sh_flags) { switch (flag) { - case SHF_WRITE: index = 0; break; - case SHF_ALLOC: index = 1; break; - case SHF_EXECINSTR: index = 2; break; - case SHF_MERGE: index = 3; break; - case SHF_STRINGS: index = 4; break; - case SHF_INFO_LINK: index = 5; break; - case SHF_LINK_ORDER: index = 6; break; - case SHF_OS_NONCONFORMING: index = 7; break; - case SHF_GROUP: index = 8; break; - case SHF_TLS: index = 9; break; + case SHF_WRITE: sindex = 0; break; + case SHF_ALLOC: sindex = 1; break; + case SHF_EXECINSTR: sindex = 2; break; + case SHF_MERGE: sindex = 3; break; + case SHF_STRINGS: sindex = 4; break; + case SHF_INFO_LINK: sindex = 5; break; + case SHF_LINK_ORDER: sindex = 6; break; + case SHF_OS_NONCONFORMING: sindex = 7; break; + case SHF_GROUP: sindex = 8; break; + case SHF_TLS: sindex = 9; break; default: - index = -1; + sindex = -1; switch (elf_header.e_machine) { case EM_IA_64: if (flag == SHF_IA_64_SHORT) - index = 10; + sindex = 10; else if (flag == SHF_IA_64_NORECOV) - index = 11; + sindex = 11; #ifdef BFD64 else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_OPENVMS) switch (flag) { - case SHF_IA_64_VMS_GLOBAL: index = 12; break; - case SHF_IA_64_VMS_OVERLAID: index = 13; break; - case SHF_IA_64_VMS_SHARED: index = 14; break; - case SHF_IA_64_VMS_VECTOR: index = 15; break; - case SHF_IA_64_VMS_ALLOC_64BIT: index = 16; break; - case SHF_IA_64_VMS_PROTECTED: index = 17; break; + case SHF_IA_64_VMS_GLOBAL: sindex = 12; break; + case SHF_IA_64_VMS_OVERLAID: sindex = 13; break; + case SHF_IA_64_VMS_SHARED: sindex = 14; break; + case SHF_IA_64_VMS_VECTOR: sindex = 15; break; + case SHF_IA_64_VMS_ALLOC_64BIT: sindex = 16; break; + case SHF_IA_64_VMS_PROTECTED: sindex = 17; break; default: break; } #endif @@ -4056,16 +4057,16 @@ get_elf_section_flags (bfd_vma sh_flags) case EM_SPARCV9: case EM_SPARC: if (flag == SHF_EXCLUDE) - index = 18; + sindex = 18; else if (flag == SHF_ORDERED) - index = 19; + sindex = 19; break; default: break; } } - if (index != -1) + if (sindex != -1) { if (p != buff + field_size + 4) { @@ -4076,8 +4077,8 @@ get_elf_section_flags (bfd_vma sh_flags) *p++ = ' '; } - size -= flags [index].len; - p = stpcpy (p, flags [index].str); + size -= flags [sindex].len; + p = stpcpy (p, flags [sindex].str); } else if (flag & SHF_MASKOS) os_flags |= flag; @@ -5804,8 +5805,8 @@ dynamic_section_mips_val (Elf_Internal_Dyn * entry) char timebuf[20]; struct tm * tmp; - time_t time = entry->d_un.d_val; - tmp = gmtime (&time); + time_t atime = entry->d_un.d_val; + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); @@ -6559,9 +6560,9 @@ process_dynamic_section (FILE * file) if (do_dynamic) { struct tm * tmp; - time_t time = entry->d_un.d_val; + time_t atime = entry->d_un.d_val; - tmp = gmtime (&time); + tmp = gmtime (&atime); printf ("%04u-%02u-%02uT%02u:%02u:%02u\n", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); @@ -7722,9 +7723,9 @@ process_symbol_table (FILE * file) Elf_Internal_Verdef ivd; Elf_Internal_Verdaux ivda; Elf_External_Verdaux evda; - unsigned long offset; + unsigned long off; - offset = offset_from_vma + off = offset_from_vma (file, version_info[DT_VERSIONTAGIDX (DT_VERDEF)], sizeof (Elf_External_Verdef)); @@ -7733,22 +7734,22 @@ process_symbol_table (FILE * file) { Elf_External_Verdef evd; - get_data (&evd, file, offset, sizeof (evd), + get_data (&evd, file, off, sizeof (evd), 1, _("version def")); ivd.vd_ndx = BYTE_GET (evd.vd_ndx); ivd.vd_aux = BYTE_GET (evd.vd_aux); ivd.vd_next = BYTE_GET (evd.vd_next); - offset += ivd.vd_next; + off += ivd.vd_next; } while (ivd.vd_ndx != (vers_data & VERSYM_VERSION) && ivd.vd_next != 0); - offset -= ivd.vd_next; - offset += ivd.vd_aux; + off -= ivd.vd_next; + off += ivd.vd_aux; - get_data (&evda, file, offset, sizeof (evda), + get_data (&evda, file, off, sizeof (evda), 1, _("version def aux")); ivda.vda_name = BYTE_GET (evda.vda_name); @@ -8445,7 +8446,7 @@ apply_relocations (void * file, bfd_vma addend; unsigned int reloc_type; unsigned int reloc_size; - unsigned char * loc; + unsigned char * rloc; reloc_type = get_reloc_type (rp->r_info); @@ -8470,8 +8471,8 @@ apply_relocations (void * file, continue; } - loc = start + rp->r_offset; - if ((loc + reloc_size) > end) + rloc = start + rp->r_offset; + if ((rloc + reloc_size) > end) { warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), (unsigned long) rp->r_offset, @@ -8514,7 +8515,7 @@ apply_relocations (void * file, || ((elf_header.e_machine == EM_PJ || elf_header.e_machine == EM_PJ_OLD) && reloc_type == 1)) - addend += byte_get (loc, reloc_size); + addend += byte_get (rloc, reloc_size); if (is_32bit_pcrel_reloc (reloc_type) || is_64bit_pcrel_reloc (reloc_type)) @@ -8522,11 +8523,11 @@ apply_relocations (void * file, /* On HPPA, all pc-relative relocations are biased by 8. */ if (elf_header.e_machine == EM_PARISC) addend -= 8; - byte_put (loc, (addend + sym->st_value) - rp->r_offset, + byte_put (rloc, (addend + sym->st_value) - rp->r_offset, reloc_size); } else - byte_put (loc, addend + sym->st_value, reloc_size); + byte_put (rloc, addend + sym->st_value, reloc_size); } free (symtab); @@ -9585,10 +9586,10 @@ process_attributes (FILE * file, do_numlist: for (;;) { - unsigned int i; + unsigned int j; - val = read_uleb128 (p, &i); - p += i; + val = read_uleb128 (p, &j); + p += j; if (val == 0) break; printf (" %d", val); @@ -9787,17 +9788,17 @@ process_mips_specific (FILE * file) for (cnt = 0; cnt < liblistno; ++cnt) { Elf32_Lib liblist; - time_t time; + time_t atime; char timebuf[20]; struct tm * tmp; liblist.l_name = BYTE_GET (elib[cnt].l_name); - time = BYTE_GET (elib[cnt].l_time_stamp); + atime = BYTE_GET (elib[cnt].l_time_stamp); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_flags = BYTE_GET (elib[cnt].l_flags); - tmp = gmtime (&time); + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, @@ -10120,12 +10121,12 @@ process_mips_specific (FILE * file) if (pltgot != 0 && local_gotno != 0) { - bfd_vma entry, local_end, global_end; + bfd_vma ent, local_end, global_end; size_t i, offset; unsigned char * data; int addr_size; - entry = pltgot; + ent = pltgot; addr_size = (is_32bit_elf ? 4 : 8); local_end = pltgot + local_gotno * addr_size; global_end = local_end + (symtabno - gotsym) * addr_size; @@ -10142,26 +10143,26 @@ process_mips_specific (FILE * file) printf (_(" %*s %10s %*s Purpose\n"), addr_size * 2, "Address", "Access", addr_size * 2, "Initial"); - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" Lazy resolver\n"); if (data - && (byte_get (data + entry - pltgot, addr_size) + && (byte_get (data + ent - pltgot, addr_size) >> (addr_size * 8 - 1)) != 0) { - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" Module pointer (GNU extension)\n"); } printf ("\n"); - if (entry < local_end) + if (ent < local_end) { printf (_(" Local entries:\n")); printf (_(" %*s %10s %*s\n"), addr_size * 2, "Address", "Access", addr_size * 2, "Initial"); - while (entry < local_end) + while (ent < local_end) { - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf ("\n"); } printf ("\n"); @@ -10182,7 +10183,7 @@ process_mips_specific (FILE * file) Elf_Internal_Sym * psym; psym = dynamic_symbols + i; - entry = print_mips_got_entry (data, pltgot, entry); + ent = print_mips_got_entry (data, pltgot, ent); printf (" "); print_vma (psym->st_value, LONG_HEX); printf (" %-7s %3s ", @@ -10203,7 +10204,7 @@ process_mips_specific (FILE * file) if (mips_pltgot != 0 && jmprel != 0 && pltrel != 0 && pltrelsz != 0) { - bfd_vma entry, end; + bfd_vma ent, end; size_t offset, rel_offset; unsigned long count, i; unsigned char * data; @@ -10222,7 +10223,7 @@ process_mips_specific (FILE * file) return 0; } - entry = mips_pltgot; + ent = mips_pltgot; addr_size = (is_32bit_elf ? 4 : 8); end = mips_pltgot + (2 + count) * addr_size; @@ -10233,9 +10234,9 @@ process_mips_specific (FILE * file) printf (_(" Reserved entries:\n")); printf (_(" %*s %*s Purpose\n"), addr_size * 2, "Address", addr_size * 2, "Initial"); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" PLT lazy resolver\n"); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" Module pointer\n"); printf ("\n"); @@ -10250,7 +10251,7 @@ process_mips_specific (FILE * file) Elf_Internal_Sym * psym; psym = dynamic_symbols + get_reloc_symindex (rels[i].r_info); - entry = print_mips_pltgot_entry (data, mips_pltgot, entry); + ent = print_mips_pltgot_entry (data, mips_pltgot, ent); printf (" "); print_vma (psym->st_value, LONG_HEX); printf (" %-7s %3s ", @@ -10326,17 +10327,17 @@ process_gnu_liblist (FILE * file) ++cnt) { Elf32_Lib liblist; - time_t time; + time_t atime; char timebuf[20]; struct tm * tmp; liblist.l_name = BYTE_GET (elib[cnt].l_name); - time = BYTE_GET (elib[cnt].l_time_stamp); + atime = BYTE_GET (elib[cnt].l_time_stamp); liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum); liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_flags = BYTE_GET (elib[cnt].l_flags); - tmp = gmtime (&time); + tmp = gmtime (&atime); snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, diff --git a/binutils/resbin.c b/binutils/resbin.c index ad819069ed0..1db98d0668e 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -1,5 +1,5 @@ /* resbin.c -- manipulate the Windows binary resource format. - Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007 + Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -227,7 +227,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) { rc_res_resource *r; rc_menu *m; - rc_uint_type version, read; + rc_uint_type version, got; r = (rc_res_resource *) res_alloc (sizeof *r); r->type = RES_TYPE_MENU; @@ -245,7 +245,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) if (length < 4) toosmall (_("menu header")); m->help = 0; - m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &read); + m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &got); } else if (version == 1) { @@ -258,7 +258,7 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) if (offset + 4 >= length) toosmall (_("menuex offset")); m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset, - length - (4 + offset), &read); + length - (4 + offset), &got); } else fatal (_("unsupported menu version %d"), (int) version); @@ -270,14 +270,14 @@ bin_to_res_menu (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length) static rc_menuitem * bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, - rc_uint_type *read) + rc_uint_type *got) { rc_menuitem *first, **pp; first = NULL; pp = &first; - *read = 0; + *got = 0; while (length > 0) { @@ -334,7 +334,7 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len data += itemlen; length -= itemlen; - *read += itemlen; + *got += itemlen; if ((flags & MENUITEM_ENDMENU) != 0) return first; @@ -347,14 +347,14 @@ bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type len static rc_menuitem * bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length, - rc_uint_type *read) + rc_uint_type *got) { rc_menuitem *first, **pp; first = NULL; pp = &first; - *read = 0; + *got = 0; while (length > 0) { @@ -408,7 +408,7 @@ bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type l data += itemlen; length -= itemlen; - *read += itemlen; + *got += itemlen; if ((flags & 0x80) != 0) return first; diff --git a/binutils/resrc.c b/binutils/resrc.c index fcd15c70f86..a72a23f6317 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -1926,7 +1926,7 @@ indent (FILE *e, int c) without the need to store it somewhere externally. */ void -write_rc_file (const char *filename, const rc_res_directory *resources) +write_rc_file (const char *filename, const rc_res_directory *res_dir) { FILE *e; rc_uint_type language; @@ -1941,7 +1941,7 @@ write_rc_file (const char *filename, const rc_res_directory *resources) } language = (rc_uint_type) ((bfd_signed_vma) -1); - write_rc_directory (e, resources, (const rc_res_id *) NULL, + write_rc_directory (e, res_dir, (const rc_res_id *) NULL, (const rc_res_id *) NULL, &language, 1); } diff --git a/binutils/resres.c b/binutils/resres.c index c4eb7227bba..9f90df0a506 100644 --- a/binutils/resres.c +++ b/binutils/resres.c @@ -647,7 +647,7 @@ res_add_resource (rc_res_resource *r, const rc_res_id *type, const rc_res_id *id and modified to add an existing resource. */ static void -res_append_resource (rc_res_directory **resources, rc_res_resource *resource, +res_append_resource (rc_res_directory **res_dirs, rc_res_resource *resource, int cids, const rc_res_id *ids, int dupok) { rc_res_entry *re = NULL; @@ -658,7 +658,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, { rc_res_entry **pp; - if (*resources == NULL) + if (*res_dirs == NULL) { static unsigned long timeval; @@ -667,16 +667,16 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, if (timeval == 0) timeval = time (NULL); - *resources = ((rc_res_directory *) + *res_dirs = ((rc_res_directory *) res_alloc (sizeof (rc_res_directory))); - (*resources)->characteristics = 0; - (*resources)->time = timeval; - (*resources)->major = 0; - (*resources)->minor = 0; - (*resources)->entries = NULL; + (*res_dirs)->characteristics = 0; + (*res_dirs)->time = timeval; + (*res_dirs)->major = 0; + (*res_dirs)->minor = 0; + (*res_dirs)->entries = NULL; } - for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next) + for (pp = &(*res_dirs)->entries; *pp != NULL; pp = &(*pp)->next) if (res_id_cmp ((*pp)->id, ids[i]) == 0) break; @@ -711,7 +711,7 @@ res_append_resource (rc_res_directory **resources, rc_res_resource *resource, xexit (1); } - resources = &re->u.dir; + res_dirs = &re->u.dir; } } diff --git a/binutils/srconv.c b/binutils/srconv.c index efccd664396..c288fd5df85 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -1,6 +1,6 @@ /* srconv.c -- Sysroff conversion program Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2007, 2008 Free Software Foundation, Inc. + 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -158,17 +158,17 @@ strip_suffix (const char *name) /* IT LEN stuff CS */ static void -checksum (FILE *file, unsigned char *ptr, int size, int code) +checksum (FILE *ffile, unsigned char *ptr, int size, int ccode) { int j; int last; int sum = 0; int bytes = size / 8; - last = !(code & 0xff00); + last = !(ccode & 0xff00); if (size & 0x7) abort (); - ptr[0] = code | (last ? 0x80 : 0); + ptr[0] = ccode | (last ? 0x80 : 0); ptr[1] = bytes + 1; for (j = 0; j < bytes; j++) @@ -176,14 +176,14 @@ checksum (FILE *file, unsigned char *ptr, int size, int code) /* Glue on a checksum too. */ ptr[bytes] = ~sum; - if (fwrite (ptr, bytes + 1, 1, file) != 1) + if (fwrite (ptr, bytes + 1, 1, ffile) != 1) /* FIXME: Return error status. */ abort (); } static void -writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) +writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *ffile) { int byte = *idx / 8; @@ -195,7 +195,7 @@ writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) if (byte > 240) { /* Lets write out that record and do another one. */ - checksum (file, ptr, *idx, code | 0x1000); + checksum (ffile, ptr, *idx, code | 0x1000); *idx = 16; byte = *idx / 8; } @@ -242,24 +242,24 @@ writeBITS (int val, unsigned char *ptr, int *idx, int size) static void writeBARRAY (barray data, unsigned char *ptr, int *idx, - int size ATTRIBUTE_UNUSED, FILE *file) + int size ATTRIBUTE_UNUSED, FILE *ffile) { int i; - writeINT (data.len, ptr, idx, 1, file); + writeINT (data.len, ptr, idx, 1, ffile); for (i = 0; i < data.len; i++) - writeINT (data.data[i], ptr, idx, 1, file); + writeINT (data.data[i], ptr, idx, 1, ffile); } static void -writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *file) +writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *ffile) { int i = *idx / 8; if (i > 240) { /* Lets write out that record and do another one. */ - checksum (file, ptr, *idx, code | 0x1000); + checksum (ffile, ptr, *idx, code | 0x1000); *idx = 16; i = *idx / 8; } @@ -1697,21 +1697,22 @@ align (int x) ordinary defs - dunno why, but thats what hitachi does with 'em. */ static void -prescan (struct coff_ofile *tree) +prescan (struct coff_ofile *otree) { struct coff_symbol *s; struct coff_section *common_section; /* Find the common section - always section 3. */ - common_section = tree->sections + 3; + common_section = otree->sections + 3; - for (s = tree->symbol_list_head; + for (s = otree->symbol_list_head; s; s = s->next_in_ofile_list) { if (s->visible->type == coff_vis_common) { struct coff_where *w = s->where; + /* s->visible->type = coff_vis_ext_def; leave it as common */ common_section->size = align (common_section->size); w->offset = common_section->size + common_section->address; @@ -1725,11 +1726,11 @@ prescan (struct coff_ofile *tree) char *program_name; static void -show_usage (FILE *file, int status) +show_usage (FILE *ffile, int status) { - fprintf (file, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); - fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n")); - fprintf (file, _(" The options are:\n\ + fprintf (ffile, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); + fprintf (ffile, _("Convert a COFF object file into a SYSROFF object file\n")); + fprintf (ffile, _(" The options are:\n\ -q --quick (Obsolete - ignored)\n\ -n --noprescan Do not perform a scan to convert commons into defs\n\ -d --debug Display information about what is being done\n\ @@ -1738,7 +1739,7 @@ show_usage (FILE *file, int status) -v --version Print the program's version number\n")); if (REPORT_BUGS_TO[0] && status == 0) - fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); + fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO); exit (status); } diff --git a/binutils/stabs.c b/binutils/stabs.c index c2bb26615de..3089545dc9e 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -3277,26 +3277,26 @@ static debug_type * stab_find_slot (struct stab_handle *info, const int *typenums) { int filenum; - int index; + int tindex; struct stab_types **ps; filenum = typenums[0]; - index = typenums[1]; + tindex = typenums[1]; if (filenum < 0 || (unsigned int) filenum >= info->files) { fprintf (stderr, _("Type file number %d out of range\n"), filenum); return NULL; } - if (index < 0) + if (tindex < 0) { - fprintf (stderr, _("Type index number %d out of range\n"), index); + fprintf (stderr, _("Type index number %d out of range\n"), tindex); return NULL; } ps = info->file_types + filenum; - while (index >= STAB_TYPES_SLOTS) + while (tindex >= STAB_TYPES_SLOTS) { if (*ps == NULL) { @@ -3304,7 +3304,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums) memset (*ps, 0, sizeof **ps); } ps = &(*ps)->next; - index -= STAB_TYPES_SLOTS; + tindex -= STAB_TYPES_SLOTS; } if (*ps == NULL) { @@ -3312,7 +3312,7 @@ stab_find_slot (struct stab_handle *info, const int *typenums) memset (*ps, 0, sizeof **ps); } - return (*ps)->types + index; + return (*ps)->types + tindex; } /* Find a type given a type number. If the type has not been diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 9f50d65684a..b9778a6ddb4 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -211,9 +211,9 @@ getBITS (unsigned char *ptr, int *idx, int size, int max) } static void -itheader (char *name, int code) +itheader (char *name, int icode) { - printf ("\n%s 0x%02x\n", name, code); + printf ("\n%s 0x%02x\n", name, icode); } static int indent; @@ -641,16 +641,16 @@ module (void) char *program_name; static void -show_usage (FILE *file, int status) +show_usage (FILE *ffile, int status) { - fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name); - fprintf (file, _("Print a human readable interpretation of a SYSROFF object file\n")); - fprintf (file, _(" The options are:\n\ + fprintf (ffile, _("Usage: %s [option(s)] in-file\n"), program_name); + fprintf (ffile, _("Print a human readable interpretation of a SYSROFF object file\n")); + fprintf (ffile, _(" The options are:\n\ -h --help Display this information\n\ -v --version Print the program's version number\n")); if (REPORT_BUGS_TO[0] && status == 0) - fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); + fprintf (ffile, _("Report bugs to %s\n"), REPORT_BUGS_TO); exit (status); } @@ -658,7 +658,7 @@ int main (int ac, char **av) { char *input_file = NULL; - int opt; + int option; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -680,9 +680,9 @@ main (int ac, char **av) expandargv (&ac, &av); - while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) + while ((option = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) { - switch (opt) + switch (option) { case 'H': case 'h': diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y index 1e6f75bc8c9..bab635ed749 100644 --- a/binutils/sysinfo.y +++ b/binutils/sysinfo.y @@ -1,4 +1,4 @@ -/* Copyright 2001, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright 2001, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU binutils. @@ -102,45 +102,39 @@ it: case 'd': printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code); printf("struct IT_%s;\n", it); - printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n", + printf("extern void sysroff_swap_%s_in (struct IT_%s *);\n", $2, it); - printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n", + printf("extern void sysroff_swap_%s_out (FILE *, struct IT_%s *);\n", $2, it); - printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n", + printf("extern void sysroff_print_%s_out (struct IT_%s *);\n", $2, it); printf("struct IT_%s { \n", it); break; case 'i': - printf("void sysroff_swap_%s_in(ptr)\n",$2); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_swap_%s_in (struct IT_%s * ptr)\n",$2,it); printf("{\n"); - printf("unsigned char raw[255];\n"); - printf("\tint idx = 0 ;\n"); + printf("\tunsigned char raw[255];\n"); + printf("\tint idx = 0;\n"); printf("\tint size;\n"); - printf("memset(raw,0,255);\n"); - printf("memset(ptr,0,sizeof(*ptr));\n"); - printf("size = fillup(raw);\n"); + printf("\tmemset(raw,0,255);\n"); + printf("\tmemset(ptr,0,sizeof(*ptr));\n"); + printf("\tsize = fillup(raw);\n"); break; case 'g': - printf("void sysroff_swap_%s_out(file,ptr)\n",$2); - printf("FILE * file;\n"); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_swap_%s_out (FILE * ffile, struct IT_%s * ptr)\n",$2,it); printf("{\n"); printf("\tunsigned char raw[255];\n"); - printf("\tint idx = 16 ;\n"); + printf("\tint idx = 16;\n"); printf("\tmemset (raw, 0, 255);\n"); printf("\tcode = IT_%s_CODE;\n", it); break; case 'o': - printf("void sysroff_swap_%s_out(abfd,ptr)\n",$2); - printf("bfd * abfd;\n"); - printf("struct IT_%s *ptr;\n",it); + printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",$2, it); printf("{\n"); - printf("int idx = 0 ;\n"); + printf("\tint idx = 0;\n"); break; case 'c': - printf("void sysroff_print_%s_out(ptr)\n",$2); - printf("struct IT_%s *ptr;\n", it); + printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",$2,it); printf("{\n"); printf("itheader(\"%s\", IT_%s_CODE);\n",$2,$2); break; @@ -158,7 +152,7 @@ it: printf("};\n"); break; case 'g': - printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it); + printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it); case 'i': @@ -274,7 +268,7 @@ char *ptr = pnames[rdepth]; } else { - printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n", + printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n", type, id, names[rdepth],size/8); diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c index 027cad273a0..fd2283f2e2c 100644 --- a/binutils/wrstabs.c +++ b/binutils/wrstabs.c @@ -394,13 +394,13 @@ stab_write_symbol (struct stab_write_handle *info, int type, int desc, static bfd_boolean stab_push_string (struct stab_write_handle *info, const char *string, - long index, bfd_boolean definition, unsigned int size) + long tindex, bfd_boolean definition, unsigned int size) { struct stab_type_stack *s; s = (struct stab_type_stack *) xmalloc (sizeof *s); s->string = xstrdup (string); - s->index = index; + s->index = tindex; s->definition = definition; s->size = size; @@ -418,13 +418,13 @@ stab_push_string (struct stab_write_handle *info, const char *string, /* Push a type index which has already been defined. */ static bfd_boolean -stab_push_defined_type (struct stab_write_handle *info, long index, +stab_push_defined_type (struct stab_write_handle *info, long tindex, unsigned int size) { char buf[20]; - sprintf (buf, "%ld", index); - return stab_push_string (info, buf, index, FALSE, size); + sprintf (buf, "%ld", tindex); + return stab_push_string (info, buf, tindex, FALSE, size); } /* Pop a type off the type stack. The caller is responsible for @@ -586,15 +586,15 @@ stab_empty_type (void *p) return stab_push_defined_type (info, info->type_cache.void_type, 0); else { - long index; + long tindex; char buf[40]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%ld=%ld", index, index); + sprintf (buf, "%ld=%ld", tindex, tindex); - return stab_push_string (info, buf, index, FALSE, 0); + return stab_push_string (info, buf, tindex, FALSE, 0); } } @@ -609,17 +609,17 @@ stab_void_type (void *p) return stab_push_defined_type (info, info->type_cache.void_type, 0); else { - long index; + long tindex; char buf[40]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - info->type_cache.void_type = index; + info->type_cache.void_type = tindex; - sprintf (buf, "%ld=%ld", index, index); + sprintf (buf, "%ld=%ld", tindex, tindex); - return stab_push_string (info, buf, index, TRUE, 0); + return stab_push_string (info, buf, tindex, TRUE, 0); } } @@ -646,15 +646,15 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp) return stab_push_defined_type (info, cache[size - 1], size); else { - long index; + long tindex; char buf[100]; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - cache[size - 1] = index; + cache[size - 1] = tindex; - sprintf (buf, "%ld=r%ld;", index, index); + sprintf (buf, "%ld=r%ld;", tindex, tindex); if (unsignedp) { strcat (buf, "0;"); @@ -679,7 +679,7 @@ stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp) abort (); } - return stab_push_string (info, buf, index, TRUE, size); + return stab_push_string (info, buf, tindex, TRUE, size); } } @@ -699,7 +699,7 @@ stab_float_type (void *p, unsigned int size) size); else { - long index; + long tindex; char *int_type; char buf[50]; @@ -708,19 +708,19 @@ stab_float_type (void *p, unsigned int size) return FALSE; int_type = stab_pop_type (info); - index = info->type_index; + tindex = info->type_index; ++info->type_index; if (size > 0 && size - 1 < (sizeof info->type_cache.float_types / sizeof info->type_cache.float_types[0])) - info->type_cache.float_types[size - 1] = index; + info->type_cache.float_types[size - 1] = tindex; - sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size); + sprintf (buf, "%ld=r%s;%u;0;", tindex, int_type, size); free (int_type); - return stab_push_string (info, buf, index, TRUE, size); + return stab_push_string (info, buf, tindex, TRUE, size); } } @@ -731,14 +731,14 @@ stab_complex_type (void *p, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; char buf[50]; - long index; + long tindex; - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%ld=r%ld;%u;0;", index, index, size); + sprintf (buf, "%ld=r%ld;%u;0;", tindex, tindex, size); - return stab_push_string (info, buf, index, TRUE, size * 2); + return stab_push_string (info, buf, tindex, TRUE, size * 2); } /* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb @@ -748,29 +748,29 @@ static bfd_boolean stab_bool_type (void *p, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; switch (size) { case 1: - index = -21; + tindex = -21; break; case 2: - index = -22; + tindex = -22; break; default: case 4: - index = -16; + tindex = -16; break; case 8: - index = -33; + tindex = -33; break; } - return stab_push_defined_type (info, index, size); + return stab_push_defined_type (info, tindex, size); } /* Push an enum type. */ @@ -783,7 +783,7 @@ stab_enum_type (void *p, const char *tag, const char **names, size_t len; const char **pn; char *buf; - long index = 0; + long tindex = 0; bfd_signed_vma *pv; if (names == NULL) @@ -811,9 +811,9 @@ stab_enum_type (void *p, const char *tag, const char **names, strcpy (buf, "e"); else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%s:T%ld=e", tag, index); + sprintf (buf, "%s:T%ld=e", tag, tindex); } for (pn = names, pv = vals; *pn != NULL; pn++, pv++) @@ -830,7 +830,7 @@ stab_enum_type (void *p, const char *tag, const char **names, { /* FIXME: The size is just a guess. */ if (! stab_write_symbol (info, N_LSYM, 0, 0, buf) - || ! stab_push_defined_type (info, index, 4)) + || ! stab_push_defined_type (info, tindex, 4)) return FALSE; } @@ -847,7 +847,7 @@ stab_modify_type (struct stab_write_handle *info, int mod, unsigned int size, long **cache, size_t *cache_alloc) { long targindex; - long index; + long tindex; char *s, *buf; assert (info->type_stack != NULL); @@ -887,8 +887,8 @@ stab_modify_type (struct stab_write_handle *info, int mod, *cache_alloc = alloc; } - index = (*cache)[targindex]; - if (index != 0 && ! info->type_stack->definition) + tindex = (*cache)[targindex]; + if (tindex != 0 && ! info->type_stack->definition) { /* We have already defined a modification of this type, and the entry on the type stack is not a definition, so we @@ -897,22 +897,22 @@ stab_modify_type (struct stab_write_handle *info, int mod, is a struct which we did not define at the time it was referenced). */ free (stab_pop_type (info)); - if (! stab_push_defined_type (info, index, size)) + if (! stab_push_defined_type (info, tindex, size)) return FALSE; } else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; s = stab_pop_type (info); buf = (char *) xmalloc (strlen (s) + 20); - sprintf (buf, "%ld=%c%s", index, mod, s); + sprintf (buf, "%ld=%c%s", tindex, mod, s); free (s); - (*cache)[targindex] = index; + (*cache)[targindex] = tindex; - if (! stab_push_string (info, buf, index, TRUE, size)) + if (! stab_push_string (info, buf, tindex, TRUE, size)) return FALSE; free (buf); @@ -1019,7 +1019,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, bfd_boolean definition; unsigned int element_size; char *range, *element, *buf; - long index; + long tindex; unsigned int size; definition = info->type_stack->definition; @@ -1033,17 +1033,17 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, if (! stringp) { - index = 0; + tindex = 0; *buf = '\0'; } else { /* We need to define a type in order to include the string attribute. */ - index = info->type_index; + tindex = info->type_index; ++info->type_index; definition = TRUE; - sprintf (buf, "%ld=@S;", index); + sprintf (buf, "%ld=@S;", tindex); } sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s", @@ -1055,7 +1055,7 @@ stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high, size = 0; else size = element_size * ((high - low) + 1); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; free (buf); @@ -1071,7 +1071,7 @@ stab_set_type (void *p, bfd_boolean bitstringp) struct stab_write_handle *info = (struct stab_write_handle *) p; bfd_boolean definition; char *s, *buf; - long index; + long tindex; definition = info->type_stack->definition; @@ -1081,22 +1081,22 @@ stab_set_type (void *p, bfd_boolean bitstringp) if (! bitstringp) { *buf = '\0'; - index = 0; + tindex = 0; } else { /* We need to define a type in order to include the string attribute. */ - index = info->type_index; + tindex = info->type_index; ++info->type_index; definition = TRUE; - sprintf (buf, "%ld=@S;", index); + sprintf (buf, "%ld=@S;", tindex); } sprintf (buf + strlen (buf), "S%s", s); free (s); - if (! stab_push_string (info, buf, index, definition, 0)) + if (! stab_push_string (info, buf, tindex, definition, 0)) return FALSE; free (buf); @@ -1309,7 +1309,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; bfd_boolean definition; char *buf; @@ -1317,17 +1317,17 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, if (id == 0) { - index = 0; + tindex = 0; *buf = '\0'; definition = FALSE; } else { - index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL, + tindex = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL, &size); - if (index < 0) + if (tindex < 0) return FALSE; - sprintf (buf, "%ld=", index); + sprintf (buf, "%ld=", tindex); definition = TRUE; } @@ -1335,7 +1335,7 @@ stab_start_struct_type (void *p, const char *tag, unsigned int id, structp ? 's' : 'u', size); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; info->type_stack->fields = (char *) xmalloc (1); @@ -1414,14 +1414,14 @@ stab_end_struct_type (void *p) { struct stab_write_handle *info = (struct stab_write_handle *) p; bfd_boolean definition; - long index; + long tindex; unsigned int size; char *fields, *first, *buf; assert (info->type_stack != NULL && info->type_stack->fields != NULL); definition = info->type_stack->definition; - index = info->type_stack->index; + tindex = info->type_stack->index; size = info->type_stack->size; fields = info->type_stack->fields; first = stab_pop_type (info); @@ -1431,7 +1431,7 @@ stab_end_struct_type (void *p) free (first); free (fields); - if (! stab_push_string (info, buf, index, definition, size)) + if (! stab_push_string (info, buf, tindex, definition, size)) return FALSE; free (buf); @@ -1867,14 +1867,14 @@ stab_tag_type (void *p, const char *name, unsigned int id, enum debug_type_kind kind) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; unsigned int size = 0; - index = stab_get_struct_index (info, name, id, kind, &size); - if (index < 0) + tindex = stab_get_struct_index (info, name, id, kind, &size); + if (tindex < 0) return FALSE; - return stab_push_defined_type (info, index, size); + return stab_push_defined_type (info, tindex, size); } /* Define a typedef. */ @@ -1883,24 +1883,24 @@ static bfd_boolean stab_typdef (void *p, const char *name) { struct stab_write_handle *info = (struct stab_write_handle *) p; - long index; + long tindex; unsigned int size; char *s, *buf; struct string_hash_entry *h; - index = info->type_stack->index; + tindex = info->type_stack->index; size = info->type_stack->size; s = stab_pop_type (info); buf = (char *) xmalloc (strlen (name) + strlen (s) + 20); - if (index > 0) + if (tindex > 0) sprintf (buf, "%s:t%s", name, s); else { - index = info->type_index; + tindex = info->type_index; ++info->type_index; - sprintf (buf, "%s:t%ld=%s", name, index, s); + sprintf (buf, "%s:t%ld=%s", name, tindex, s); } free (s); @@ -1920,7 +1920,7 @@ stab_typdef (void *p, const char *name) /* I don't think we care about redefinitions. */ - h->index = index; + h->index = tindex; h->size = size; return TRUE; @@ -2050,12 +2050,12 @@ stab_variable (void *p, const char *name, enum debug_var_kind kind, if (! ISDIGIT (*s)) { char *n; - long index; + long tindex; - index = info->type_index; + tindex = info->type_index; ++info->type_index; n = (char *) xmalloc (strlen (s) + 20); - sprintf (n, "%ld=%s", index, s); + sprintf (n, "%ld=%s", tindex, s); free (s); s = n; } |