This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)


On Tuesday, April 24 2012, Pedro Alves wrote:

> On 04/24/2012 06:39 PM, Tom Tromey wrote:
>
>>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>> 
>> Pedro> There's no need to commit all this in one go.  Once you split,
>> Pedro> some of the resulting patches will be dead obvious, and will end up
>> Pedro> reviewed (if even necessary) and checked in quickly, and thus you end up
>> Pedro> making progress faster that way.
>> 
>> It seems to me that a variable that is declared but not initialized and
>> not used is always going to be obviously dead.  I'd be comfortable with
>> pre-approving all such removals; leaving review for the patches to the
>> generators and initialized variables.
>
>
> Yes, that seems like a good cut.

Ok, sorry for taking so long to respond, this patch is huge and I was
doing something else...

Well, here's the "obvious" patch that I came up with.  It contains only
declarations of variables, not assignments to them.

I know it's "obvious", but I prefer to ask than to apologize, so: is it
OK to apply?

Of course, if you really want some rationale to the changes below, I
will need to dive into the code and see why those variables are not
used.

OK to apply?

Thanks,

-- 
Sergio

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 180fadb..534186b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5470,7 +5470,7 @@ advance_wild_match (const char **namep, const char *name0, int target0)
 static int
 wild_match (const char *name, const char *patn)
 {
-  const char *p, *n;
+  const char *p;
   const char *name0 = name;
 
   while (1)
@@ -10821,7 +10821,6 @@ static void
 ada_exception_support_info_sniffer (void)
 {
   struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
-  struct symbol *sym;
 
   /* If the exception info is already known, then no need to recompute it.  */
   if (data->exception_info != NULL)
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 11ad262..0e441fb 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -847,7 +847,6 @@ read_known_tasks_list (struct ada_tasks_inferior_data *data)
 static void
 ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
 {
-  const char *name;
   struct minimal_symbol *msym;
   struct symbol *sym;
 
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 31f80f5..8623876 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -227,7 +227,6 @@ ada_varobj_get_array_number_of_children (struct value *parent_value,
 					 struct type *parent_type)
 {
   LONGEST lo, hi;
-  int len;
 
   if (!get_array_bounds (parent_type, &lo, &hi))
     {
diff --git a/gdb/amd64-darwin-tdep.c b/gdb/amd64-darwin-tdep.c
index 6a5d4a4..9fcee3f 100644
--- a/gdb/amd64-darwin-tdep.c
+++ b/gdb/amd64-darwin-tdep.c
@@ -84,7 +84,6 @@ amd64_darwin_sigcontext_addr (struct frame_info *this_frame)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR rbx;
-  CORE_ADDR si;
   gdb_byte buf[8];
 
   /* A pointer to the ucontext is passed as the fourth argument
diff --git a/gdb/arm-symbian-tdep.c b/gdb/arm-symbian-tdep.c
index cc4a784..69821d3 100644
--- a/gdb/arm-symbian-tdep.c
+++ b/gdb/arm-symbian-tdep.c
@@ -89,7 +89,7 @@ arm_symbian_init_abi (struct gdbarch_info info,
 static enum gdb_osabi
 arm_symbian_osabi_sniffer (bfd *abfd)
 {
-  Elf_Internal_Phdr *phdrs, **segments;
+  Elf_Internal_Phdr *phdrs;
   long phdrs_size;
   int num_phdrs, i;
 
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f83dc0e..91ab411 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -380,7 +380,6 @@ arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
 int
 arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
 {
-  struct obj_section *sec;
   struct minimal_symbol *sym;
   char type;
   struct displaced_step_closure* dsc
@@ -1285,7 +1284,7 @@ static CORE_ADDR
 arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
 {
   enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
-  unsigned int address, basereg;
+  unsigned int basereg;
   struct minimal_symbol *stack_chk_guard;
   int offset;
   int is_thumb = arm_pc_is_thumb (gdbarch, pc);
@@ -1377,7 +1376,6 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   unsigned long inst;
   CORE_ADDR skip_pc;
   CORE_ADDR func_addr, limit_pc;
-  struct symtab_and_line sal;
 
   /* See if we can determine the end of the prologue via the symbol table.
      If so, then return either PC, or the PC after the prologue, whichever
@@ -1536,7 +1534,6 @@ thumb_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR prev_pc,
 {
   CORE_ADDR prologue_start;
   CORE_ADDR prologue_end;
-  CORE_ADDR current_pc;
 
   if (find_pc_partial_function (block_addr, NULL, &prologue_start,
 				&prologue_end))
@@ -5132,7 +5129,7 @@ static gdb_byte *
 extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr,
 		       int old_len, int new_len)
 {
-  gdb_byte *new_buf, *middle;
+  gdb_byte *new_buf;
   int bytes_to_read = new_len - old_len;
 
   new_buf = xmalloc (new_len);
@@ -5165,7 +5162,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
   gdb_byte *buf;
   char map_type;
   CORE_ADDR boundary, func_start;
-  int buf_len, buf2_len;
+  int buf_len;
   enum bfd_endian order = gdbarch_byte_order_for_code (gdbarch);
   int i, any, last_it, last_it_count;
 
@@ -6865,7 +6862,7 @@ cleanup_block_load_pc (struct gdbarch *gdbarch,
 		       struct displaced_step_closure *dsc)
 {
   uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
-  int load_executed = condition_true (dsc->u.block.cond, status), i;
+  int load_executed = condition_true (dsc->u.block.cond, status);
   unsigned int mask = dsc->u.block.regmask, write_reg = ARM_PC_REGNUM;
   unsigned int regs_loaded = bitcount (mask);
   unsigned int num_to_shuffle = regs_loaded, clobbered;
@@ -9573,7 +9566,6 @@ arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache,
 		     int regnum, const gdb_byte *buf)
 {
   char name_buf[4];
-  gdb_byte reg_buf[8];
   int offset, double_regnum;
 
   sprintf (name_buf, "d%d", regnum << 1);
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 34b0baf..ef94604 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -742,7 +742,6 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
 	0xcd, 0xb7,		/* in r28,__SP_L__ */
 	0xde, 0xb7		/* in r29,__SP_H__ */
       };
-      unsigned short insn1;
 
       if (vpc + sizeof (img) < len
 	  && memcmp (prologue + vpc, img, sizeof (img)) == 0)
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 909f282..1bf03df 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2171,7 +2171,6 @@ gen_expr (struct expression *exp, union exp_element **pc,
 
     case OP_THIS:
       {
-	char *this_name;
 	struct symbol *sym, *func;
 	struct block *b;
 	const struct language_defn *lang;
diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c
index 53eb98d..ae6d45c 100644
--- a/gdb/bfin-linux-tdep.c
+++ b/gdb/bfin-linux-tdep.c
@@ -103,7 +103,6 @@ bfin_linux_sigframe_init (const struct tramp_frame *self,
   CORE_ADDR sp = get_frame_sp (this_frame);
   CORE_ADDR pc = get_frame_pc (this_frame);
   CORE_ADDR sigcontext = sp + SIGCONTEXT_OFFSET;
-  struct frame_id this_id;
   const int *reg_offset = bfin_linux_sigcontext_reg_offset;
   int i;
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ab5f324..7574efe 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -749,7 +749,6 @@ static void
 set_condition_evaluation_mode (char *args, int from_tty,
 			       struct cmd_list_element *c)
 {
-  struct breakpoint *b;
   const char *old_mode, *new_mode;
 
   if ((condition_evaluation_mode_1 == condition_evaluation_target)
@@ -7444,7 +7443,6 @@ catch_load_or_unload (char *arg, int from_tty, int is_load,
   struct solib_catchpoint *c;
   struct gdbarch *gdbarch = get_current_arch ();
   int tempflag;
-  regex_t compiled;
   struct cleanup *cleanup;
 
   tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
@@ -7712,7 +7710,6 @@ print_it_catch_syscall (bpstat bs)
   ptid_t ptid;
   struct target_waitstatus last;
   struct syscall s;
-  char *syscall_id;
 
   get_last_target_status (&ptid, &last);
 
@@ -8798,8 +8795,6 @@ decode_static_tracepoint_spec (char **arg_p)
 {
   VEC(static_tracepoint_marker_p) *markers = NULL;
   struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
-  struct symbol *sym;
   struct cleanup *old_chain;
   char *p = &(*arg_p)[3];
   char *endp;
@@ -8868,7 +8863,6 @@ create_breakpoint (struct gdbarch *gdbarch,
   struct linespec_result canonical;
   struct cleanup *old_chain;
   struct cleanup *bkpt_chain = NULL;
-  int i;
   int pending = 0;
   int task = 0;
   int prev_bkpt_count = breakpoint_count;
@@ -13134,7 +13128,6 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
   struct tracepoint *tp = (struct tracepoint *) b;
   struct static_tracepoint_marker marker;
   CORE_ADDR pc;
-  int i;
 
   pc = sal.pc;
   if (sal.line)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 8dfb7e5..e912657 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1419,9 +1419,6 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
 
   if (parsed_float)
     {
-      const char *suffix;
-      int suffix_len;
-
       /* If it ends at "df", "dd" or "dl", take it as type of decimal floating
          point.  Return DECFLOAT.  */
 
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index d1fd56d..6c13c0b 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -145,7 +145,6 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
   struct type *elttype, *unresolved_elttype;
   struct type *unresolved_type = type;
   unsigned eltlen;
-  LONGEST val;
   CORE_ADDR addr;
 
   CHECK_TYPEDEF (type);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2968662..e5fa206 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1425,7 +1425,6 @@ alias_command (char *args, int from_tty)
     }
   else
     {
-      int i;
       dyn_string_t alias_prefix_dyn_string, command_prefix_dyn_string;
       char *alias_prefix, *command_prefix;
       struct cmd_list_element *c_alias, *c_command;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 2a8ee42..56f8a5c 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1306,7 +1306,6 @@ static const char *
 coff_getfilename (union internal_auxent *aux_entry)
 {
   static char buffer[BUFSIZ];
-  char *temp;
   const char *result;
 
   if (aux_entry->x_file.x_n.x_zeroes == 0)
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 025b4de..63f9d3f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1322,12 +1322,9 @@ make_symbol_overload_list_using (const char *func_name,
 static void
 make_symbol_overload_list_qualified (const char *func_name)
 {
-  struct symbol *sym;
   struct symtab *s;
   struct objfile *objfile;
   const struct block *b, *surrounding_static_block = 0;
-  struct dict_iterator iter;
-  const struct dictionary *dict;
 
   /* Look through the partial symtabs for all symbols which begin by
      matching FUNC_NAME.  Make sure we read that symbol table in.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 34a2594..5ee9f63 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -322,8 +322,6 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct cris_unwind_cache *info;
-  CORE_ADDR pc;
-  CORE_ADDR sp;
   CORE_ADDR addr;
   char buf[4];
   int i;
@@ -711,9 +709,7 @@ cris_frame_unwind_cache (struct frame_info *this_frame,
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  CORE_ADDR pc;
   struct cris_unwind_cache *info;
-  int i;
 
   if ((*this_prologue_cache))
     return (*this_prologue_cache);
@@ -823,13 +819,10 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		      int struct_return, CORE_ADDR struct_addr)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int stack_alloc;
   int stack_offset;
   int argreg;
   int argnum;
 
-  CORE_ADDR regval;
-
   /* The function's arguments and memory allocated by gdb for the arguments to
      point at reside in separate areas on the stack.
      Both frame pointers grow toward higher addresses.  */
@@ -2189,9 +2182,6 @@ static unsigned long get_data_from_address (unsigned short *inst,
 static void
 bdap_prefix (unsigned short inst, inst_env_type *inst_env)
 {
-
-  long offset;
-
   /* It's invalid to be in a delay slot.  */
   if (inst_env->slot_needed || inst_env->prefix_found)
     {
diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c
index 912cdf4..fcfeaf4 100644
--- a/gdb/dwarf2-frame-tailcall.c
+++ b/gdb/dwarf2-frame-tailcall.c
@@ -236,7 +236,6 @@ pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache)
 {
   int next_levels = existing_next_levels (this_frame, cache);
   struct call_site_chain *chain = cache->chain;
-  int caller_no;
 
   gdb_assert (chain != NULL);
 
@@ -367,10 +366,9 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
 {
   CORE_ADDR prev_pc = 0, prev_sp = 0;	/* GCC warning.  */
   int prev_sp_p = 0;
-  CORE_ADDR this_pc, pc;
+  CORE_ADDR this_pc;
   struct gdbarch *prev_gdbarch;
   struct call_site_chain *chain = NULL;
-  struct frame_info *fi;
   struct tailcall_cache *cache;
   volatile struct gdb_exception except;
 
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 9ebd4ae..670e26f 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -892,7 +892,7 @@ dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc,
   const int num_regs = gdbarch_num_regs (gdbarch)
 		       + gdbarch_num_pseudo_regs (gdbarch);
   struct dwarf2_fde *fde;
-  CORE_ADDR text_offset, cfa;
+  CORE_ADDR text_offset;
   struct dwarf2_frame_state fs;
   int addr_size;
 
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index e93f648..83d8e04 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -868,7 +868,6 @@ execute_stack_op (struct dwarf_expr_context *ctx,
 
 	case DW_OP_GNU_implicit_pointer:
 	  {
-	    ULONGEST die;
 	    LONGEST len;
 
 	    if (ctx->ref_addr_size == -1)
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index caef546..ad6a0f7 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -651,7 +651,6 @@ static struct call_site_chain *
 call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
 			CORE_ADDR callee_pc)
 {
-  struct func_type *func_specific;
   struct obstack addr_obstack;
   struct cleanup *back_to_retval, *back_to_workdata;
   struct call_site_chain *retval = NULL;
@@ -833,8 +832,6 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame, int dwarf_reg,
   struct frame_info *caller_frame = get_prev_frame (frame);
   struct call_site *call_site;
   int iparams;
-  struct value *val;
-  struct dwarf2_locexpr_baton *dwarf_block;
   /* Initialize it just to avoid a GCC false warning.  */
   struct call_site_parameter *parameter = NULL;
   CORE_ADDR target_addr;
@@ -2695,7 +2692,6 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	  {
 	    const gdb_byte *datastart;
 	    size_t datalen;
-	    unsigned int before_stack_len;
 	    struct block *b;
 	    struct symbol *framefunc;
 	    LONGEST base_offset = 0;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0caa5f9..cef82ec 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2401,7 +2401,6 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
   struct line_header *lh;
   struct attribute *attr;
   int i;
-  unsigned int bytes_read;
   char *name, *comp_dir;
   void **slot;
   struct quick_file_names *qfn;
@@ -4010,7 +4009,6 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   struct dwarf2_cu *cu = reader->cu;
   struct objfile *objfile = cu->objfile;
   struct dwarf2_per_cu_data *per_cu = cu->per_cu;
-  bfd *abfd = objfile->obfd;
   struct attribute *attr;
   CORE_ADDR baseaddr;
   CORE_ADDR best_lowpc = 0, best_highpc = 0;
@@ -5165,7 +5163,6 @@ static void
 psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct dwarf2_per_cu_data *per_cu;
-  struct cleanup *back_to;
   int i;
 
   for (i = 0; i < pst->number_of_dependencies; i++)
@@ -5234,7 +5231,6 @@ load_full_comp_unit_reader (const struct die_reader_specs *reader,
 			    void *data)
 {
   struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
 
   gdb_assert (cu->die_hash == NULL);
   cu->die_hash =
@@ -6664,7 +6660,6 @@ try_open_dwo_file (const char *file_name)
   bfd *sym_bfd;
   int desc;
   char *absolute_name;
-  char *name;
 
   desc = openp (debug_file_directory, OPF_TRY_CWD_FIRST, file_name,
 		O_RDONLY | O_BINARY, &absolute_name);
@@ -6704,7 +6699,6 @@ static bfd *
 open_dwo_file (const char *dwo_name, const char *comp_dir)
 {
   bfd *abfd;
-  char *path_to_try, *debug_dir;
 
   if (IS_ABSOLUTE_PATH (dwo_name))
     return try_open_dwo_file (dwo_name);
@@ -6844,7 +6838,6 @@ lookup_dwo_type_unit (struct signatured_type *this_tu,
 {
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct dwo_file *dwo_file;
-  struct dwo_unit find_dwo_tu, *dwo_tu;
 
   dwo_file = lookup_dwo_file (dwo_name, comp_dir);
   if (dwo_file == NULL)
@@ -7493,7 +7486,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
        child_die && child_die->tag;
        child_die = sibling_die (child_die))
     {
-      struct dwarf2_locexpr_baton *dlbaton;
       struct call_site_parameter *parameter;
 
       if (child_die->tag != DW_TAG_GNU_call_site_parameter)
@@ -15830,7 +15822,6 @@ read_signatured_type_reader (const struct die_reader_specs *reader,
 			     void *data)
 {
   struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
 
   gdb_assert (cu->die_hash == NULL);
   cu->die_hash =
@@ -18167,8 +18158,6 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
 {
   struct addrmap_index_data *data = datap;
   struct partial_symtab *pst = obj;
-  offset_type cu_index;
-  void **slot;
 
   if (data->previous_valid)
     add_address_entry (data->objfile, data->addr_obstack,
@@ -18348,7 +18337,6 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
   struct mapped_symtab *symtab;
   offset_type val, size_of_contents, total_len;
   struct stat st;
-  char buf[8];
   htab_t psyms_seen;
   htab_t cu_index_htab;
   struct psymtab_cu_index_map *psymtab_cu_index_map;
diff --git a/gdb/elfread.c b/gdb/elfread.c
index d825d9a..ada1ec6 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -616,7 +616,6 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
   bfd *obfd = objfile->obfd;
   const struct elf_backend_data *bed = get_elf_backend_data (obfd);
   asection *plt, *relplt, *got_plt;
-  unsigned u;
   int plt_elf_idx;
   bfd_size_type reloc_count, reloc;
   char *string_buffer = NULL;
@@ -655,7 +654,7 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
   reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize;
   for (reloc = 0; reloc < reloc_count; reloc++)
     {
-      const char *name, *name_got_plt;
+      const char *name;
       struct minimal_symbol *msym;
       CORE_ADDR address;
       const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX);
diff --git a/gdb/eval.c b/gdb/eval.c
index de1c4bd..cefccd4 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -793,7 +793,7 @@ evaluate_subexp_standard (struct type *expect_type,
   struct type *type;
   int nargs;
   struct value **argvec;
-  int upper, lower;
+  int lower;
   int code;
   int ix;
   long mem_offset;
diff --git a/gdb/expprint.c b/gdb/expprint.c
index fd1fccb..6915d43 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -136,8 +136,6 @@ print_subexp_standard (struct expression *exp, int *pos,
 
     case OP_VAR_ENTRY_VALUE:
       {
-	struct block *b;
-
 	(*pos) += 2;
 	fprintf_filtered (stream, "%s@entry",
 			  SYMBOL_PRINT_NAME (exp->elts[pc + 1].symbol));
@@ -974,7 +972,6 @@ dump_subexp_body_standard (struct expression *exp,
       break;
     case TYPE_INSTANCE:
       {
-	char *elem_name;
 	LONGEST len;
 
 	len = exp->elts[elt++].longconst;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 62a7136..827fa0f 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -267,7 +267,6 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int i = 0;	/* Number of characters printed.  */
   struct type *elttype;
-  LONGEST val;
   CORE_ADDR addr;
   int index;
 
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 1f2400a..272f2ec 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -136,7 +136,6 @@ new_variant (void)
 {
   struct gdbarch_tdep *var;
   int r;
-  char buf[20];
 
   var = xmalloc (sizeof (*var));
   memset (var, 0, sizeof (*var));
@@ -1099,8 +1098,6 @@ frv_frame_unwind_cache (struct frame_info *this_frame,
 			 void **this_prologue_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  CORE_ADDR pc;
-  ULONGEST this_base;
   struct frv_unwind_cache *info;
 
   if ((*this_prologue_cache))
diff --git a/gdb/gcore.c b/gdb/gcore.c
index aedda41..a7b67c5 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -472,13 +472,12 @@ objfile_find_memory_regions (find_memory_region_ftype func, void *obfd)
   /* Call callback function for each objfile section.  */
   ALL_OBJSECTIONS (objfile, objsec)
     {
-      bfd *ibfd = objfile->obfd;
       asection *isec = objsec->the_bfd_section;
-      flagword flags = bfd_get_section_flags (ibfd, isec);
+      flagword flags = bfd_get_section_flags (objfile->obfd, isec);
 
       if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
 	{
-	  int size = bfd_section_size (ibfd, isec);
+	  int size = bfd_section_size (objfile->obfd, isec);
 	  int ret;
 
 	  ret = (*func) (obj_section_addr (objsec), size, 
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index f720629..86d8db5 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1548,7 +1548,6 @@ yylex (void)
       if (name2.token == NAME)
 	{
 	  /* Ok, we have "name1 . name2".  */
-	  int token;
 	  char *copy;
 
 	  copy = copy_name (current.value.sval);
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index aa056f9..a97422b 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -430,7 +430,6 @@ h8300_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct h8300_frame_cache *cache;
-  char buf[4];
   int i;
   CORE_ADDR current_pc;
 
@@ -783,7 +782,7 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache,
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
-  ULONGEST c, addr;
+  ULONGEST c;
 
   switch (len)
     {
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 89d9e6d..f6dfef2 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -177,7 +177,7 @@ hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
   struct minimal_symbol *minsym;
   asection *sec;
   CORE_ADDR addr;
-  int insn, i;
+  int insn;
 
   minsym = lookup_minimal_symbol_by_pc (pc);
   if (! minsym)
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 7f7fb8e..04d258d 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -543,7 +543,6 @@ hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   unsigned long status;
   unsigned int inst;
   char buf[4];
-  int off;
 
   status = target_read_memory (pc, buf, 4);
   if (status != 0)
@@ -1698,7 +1697,6 @@ after_prologue (CORE_ADDR pc)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
-  struct symbol *f;
 
   /* If we can not find the symbol in the partial symbol table, then
      there is no hope we can determine the function's start address
@@ -1738,10 +1736,7 @@ after_prologue (CORE_ADDR pc)
 static CORE_ADDR
 hppa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  unsigned long inst;
-  int offset;
   CORE_ADDR post_prologue_pc;
-  char buf[4];
 
   /* See if we can determine the end of the prologue via the symbol table.
      If so, then return either PC, or the PC after the prologue, whichever
@@ -1793,7 +1788,6 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct hppa_frame_cache *cache;
   long saved_gr_mask;
   long saved_fr_mask;
-  CORE_ADDR this_sp;
   long frame_size;
   struct unwind_table_entry *u;
   CORE_ADDR prologue_end;
diff --git a/gdb/hppanbsd-tdep.c b/gdb/hppanbsd-tdep.c
index f563289..6c9ba72 100644
--- a/gdb/hppanbsd-tdep.c
+++ b/gdb/hppanbsd-tdep.c
@@ -169,7 +169,6 @@ hppanbsd_supply_gregset (const struct regset *regset,
 			 int regnum, const void *gregs, size_t len)
 {
   const gdb_byte *regs = gregs;
-  size_t offset;
   int i;
 
   gdb_assert (len >= HPPANBSD_SIZEOF_GREGS);
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 4793db5..615297f 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -134,7 +134,6 @@ i386nto_register_area (struct gdbarch *gdbarch,
 		       int regno, int regset, unsigned *off)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  int len;
 
   *off = 0;
   if (regset == NTO_REG_GENERAL)
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 769ef42..5a730d5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1197,7 +1197,6 @@ i386_match_insn_block (CORE_ADDR pc, struct i386_insn *insn_patterns)
 {
   CORE_ADDR current_pc;
   int ix, i;
-  gdb_byte op;
   struct i386_insn *insn;
 
   insn = i386_match_insn (pc, insn_patterns);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 26e4e50..97bd5f6 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -237,9 +237,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
   ULONGEST fop;
   int fop_p;
   int fpreg;
-  int fpreg_p;
   int top;
-  int top_p;
 
   gdb_assert (gdbarch == get_frame_arch (frame));
 
@@ -780,7 +778,6 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
   int i;
   unsigned int clear_bv;
   static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
-  const gdb_byte *p;
   enum
     {
       none = 0x0,
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 460345b..7c05a93 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1041,7 +1041,6 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
          It can be calculated as the bsp - sof (sizeof frame).  */
       ULONGEST bsp, vbsp;
       ULONGEST cfm;
-      CORE_ADDR reg;
       status = regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
       if (status != REG_VALID)
 	return status;
@@ -1060,7 +1059,6 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
       ULONGEST pr;
       ULONGEST cfm;
       ULONGEST prN_val;
-      CORE_ADDR reg;
       status = regcache_cooked_read_unsigned (regcache, IA64_PR_REGNUM, &pr);
       if (status != REG_VALID)
 	return status;
@@ -1098,7 +1096,6 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
     {
       ULONGEST bsp;
       ULONGEST cfm;
-      CORE_ADDR reg;
       regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
       regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
 
@@ -1854,8 +1851,7 @@ ia64_frame_cache (struct frame_info *this_frame, void **this_cache)
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct ia64_frame_cache *cache;
   char buf[8];
-  CORE_ADDR cfm, sof, sol, bsp, psr;
-  int i;
+  CORE_ADDR cfm, psr;
 
   if (*this_cache)
     return *this_cache;
@@ -2242,9 +2238,7 @@ ia64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct ia64_frame_cache *cache;
-  CORE_ADDR addr;
   char buf[8];
-  int i;
 
   if (*this_cache)
     return *this_cache;
diff --git a/gdb/jit.c b/gdb/jit.c
index 24ab016..a0fbb5e 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -200,7 +200,6 @@ static void
 jit_reader_load_command (char *args, int from_tty)
 {
   char *so_name;
-  int len;
   struct cleanup *prev_cleanup;
 
   if (args == NULL)
@@ -280,7 +279,6 @@ get_jit_objfile_data (struct objfile *objf)
 static void
 add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
 {
-  CORE_ADDR *entry_addr_ptr;
   struct jit_objfile_data *objf_data;
 
   objf_data = get_jit_objfile_data (objfile);
@@ -774,7 +772,6 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
 {
   void *gdb_mem;
   int status;
-  struct jit_dbg_reader *i;
   jit_dbg_reader_data priv_data;
   struct gdb_reader_funcs *funcs;
   volatile struct gdb_exception e;
@@ -935,7 +932,6 @@ static struct objfile *
 jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
 {
   struct objfile *objf;
-  CORE_ADDR *objf_entry_addr;
 
   ALL_OBJFILES (objf)
     {
@@ -1095,7 +1091,6 @@ jit_frame_sniffer (const struct frame_unwind *self,
 {
   struct jit_inferior_data *inf_data;
   struct jit_unwind_private *priv_data;
-  struct jit_dbg_reader *iter;
   struct gdb_unwind_callbacks callbacks;
   struct gdb_reader_funcs *funcs;
 
@@ -1237,7 +1232,6 @@ jit_inferior_init (struct gdbarch *gdbarch)
   struct jit_code_entry cur_entry;
   struct jit_inferior_data *inf_data;
   CORE_ADDR cur_entry_addr;
-  struct jit_objfile_data *objf_data;
 
   if (jit_debug)
     fprintf_unfiltered (gdb_stdlog, "jit_inferior_init\n");
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 7cbf1bf..ee91adf 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2671,7 +2671,6 @@ find_method (struct linespec_state *self, VEC (symtab_p) *file_symtabs,
   VEC (typep) *superclass_vec;
   VEC (const_char_ptr) *result_names;
   struct collect_info info;
-  char *name_iter;
 
   /* Sort symbols so that symbols with the same program space are next
      to each other.  */
@@ -3386,8 +3385,6 @@ add_matching_symbols_to_info (const char *name,
 
   for (ix = 0; VEC_iterate (symtab_p, info->file_symtabs, ix, elt); ++ix)
     {
-      struct symbol *sym;
-
       if (elt == NULL)
 	{
 	  iterate_over_all_matching_symtabs (info->state, name, VAR_DOMAIN,
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index d94cf6e..6198d00 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -402,7 +402,6 @@ linux_info_proc (struct gdbarch *gdbarch, char *args,
 	{
 	  struct cleanup *cleanup = make_cleanup (xfree, data);
 	  const char *p = data;
-	  ULONGEST val;
 
 	  printf_filtered (_("Process: %s\n"),
 			   pulongest (strtoulst (p, &p, 10)));
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 4f67542..00633fe 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -188,7 +188,6 @@ static CORE_ADDR
 lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   CORE_ADDR func_addr, limit_pc;
-  struct symtab_and_line sal;
   struct lm32_frame_cache frame_info;
   struct trad_frame_saved_reg saved_regs[SIM_LM32_NUM_REGS];
 
@@ -263,8 +262,6 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *arg_type = check_typedef (value_type (arg));
       gdb_byte *contents;
       int len;
-      int j;
-      int reg;
       ULONGEST val;
 
       /* Promote small integer types to int.  */
@@ -315,7 +312,6 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache,
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int offset;
   ULONGEST l;
   CORE_ADDR return_buffer;
 
@@ -422,17 +418,11 @@ lm32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 static struct lm32_frame_cache *
 lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache)
 {
-  CORE_ADDR prologue_pc;
   CORE_ADDR current_pc;
   ULONGEST prev_sp;
   ULONGEST this_base;
   struct lm32_frame_cache *info;
-  int prefixed;
-  unsigned long instruction;
-  int op;
-  int offsets[32];
   int i;
-  long immediate;
 
   if ((*this_prologue_cache))
     return (*this_prologue_cache);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 9e1c1ff..27b5290 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -314,7 +314,6 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
   unsigned len;
   struct type *elttype;
   unsigned eltlen;
-  LONGEST val;
   CORE_ADDR addr;
 
   CHECK_TYPEDEF (type);
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 1211624..0c0fadf 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2587,7 +2587,7 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
 			    LONGEST *frame_offset)
 {
   const char *name;
-  CORE_ADDR func_addr, func_end, sal_end;
+  CORE_ADDR func_addr, func_end;
   struct m32c_prologue p;
 
   struct regcache *regcache = get_current_regcache ();
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index b079b94..1618ad0 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -122,8 +122,7 @@ static void
 m32r_load (char *filename, int from_tty)
 {
   bfd *abfd;
-  asection *s;
-  unsigned int i, data_count = 0;
+  unsigned int data_count = 0;
   struct timeval start_time, end_time;
 
   if (filename == NULL || filename[0] == 0)
@@ -238,8 +237,12 @@ m32r_supply_register (struct regcache *regcache, char *regname,
       monitor_supply_register (regcache, regno, val);
       if (regno == PSW_REGNUM)
 	{
+#if defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
+    || defined BIE_REGNUM || defined COND_REGNUM  || defined CBR_REGNUM \
+    || defined BPC_REGNUM || defined BCARRY_REGNUM
 	  unsigned long psw = strtoul (val, NULL, 16);
 	  char *zero = "00000000", *one = "00000001";
+#endif
 
 #ifdef SM_REGNUM
 	  /* Stack mode bit */
@@ -533,7 +536,6 @@ m32r_upload_command (char *args, int from_tty)
 	  {
 	    bfd_size_type section_size = bfd_section_size (abfd, s);
 	    bfd_vma section_base = bfd_section_lma (abfd, s);
-	    unsigned int buffer;
 
 	    data_count += section_size;
 
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index d504eb3..4c95470 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -537,7 +537,7 @@ m32r_frame_unwind_cache (struct frame_info *this_frame,
   CORE_ADDR pc, scan_limit;
   ULONGEST prev_sp;
   ULONGEST this_base;
-  unsigned long op, op2;
+  unsigned long op;
   int i;
   struct m32r_unwind_cache *info;
 
@@ -697,7 +697,6 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   gdb_byte *val;
   gdb_byte valbuf[MAX_REGISTER_SIZE];
   int len;
-  int odd_sized_struct;
 
   /* First force sp to a 4-byte alignment.  */
   sp = sp & ~3;
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index ee72026..10bd02b 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -854,7 +854,6 @@ m68k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
 {
   struct m68k_frame_cache cache;
   CORE_ADDR pc;
-  int op;
 
   cache.locals = -1;
   pc = m68k_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache);
diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c
index 6f9a34a..d6dc3ee 100644
--- a/gdb/m68klinux-tdep.c
+++ b/gdb/m68klinux-tdep.c
@@ -68,7 +68,6 @@ m68k_linux_pc_in_sigtramp (struct frame_info *this_frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  CORE_ADDR sp;
   gdb_byte buf[12];
   unsigned long insn0, insn1, insn2;
   CORE_ADDR pc = get_frame_pc (this_frame);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 90fb624..d1754f8 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1131,8 +1131,6 @@ get_register (struct frame_info *frame, int regnum, int format)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct ui_out *uiout = current_uiout;
-  CORE_ADDR addr;
-  enum lval_type lval;
   struct value *val;
 
   if (format == 'N')
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 3ce3d1c..2f08c5e 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -173,7 +173,6 @@ static struct microblaze_frame_cache *
 microblaze_alloc_frame_cache (void)
 {
   struct microblaze_frame_cache *cache;
-  int i;
 
   cache = FRAME_OBSTACK_ZALLOC (struct microblaze_frame_cache);
 
@@ -231,7 +230,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
   const char *name;
   CORE_ADDR func_addr, func_end, addr, stop, prologue_end_addr = 0;
   unsigned long insn;
-  int rn, rd, ra, rb, imm;
+  int rd, ra, rb, imm;
   enum microblaze_instr op;
   int flags = 0;
   int save_hidden_pointer_found = 0;
@@ -461,7 +460,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
 {
   struct microblaze_frame_cache *cache;
   struct gdbarch *gdbarch = get_frame_arch (next_frame);
-  CORE_ADDR func, pc, fp;
+  CORE_ADDR func;
   int rn;
 
   if (*this_cache)
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 47af572..7fcf3df 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -246,7 +246,7 @@ mips_fill_fpregset (const struct regcache *regcache,
 		    mips_elf_fpregset_t *fpregsetp, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  char *from, *to;
+  char *to;
 
   if ((regno >= gdbarch_fp0_regnum (gdbarch))
       && (regno < gdbarch_fp0_regnum (gdbarch) + 32))
@@ -936,7 +936,7 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
 			      CORE_ADDR func)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  int ireg, reg_position;
+  int ireg;
   CORE_ADDR frame_sp = get_frame_sp (this_frame);
   CORE_ADDR sigcontext_base;
   const struct mips_regnum *regs = mips_regnum (gdbarch);
@@ -1102,7 +1102,7 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
 				 CORE_ADDR func)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  int ireg, reg_position;
+  int ireg;
   CORE_ADDR frame_sp = get_frame_sp (this_frame);
   CORE_ADDR sigcontext_base;
   const struct mips_regnum *regs = mips_regnum (gdbarch);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 9a3c7fb..e151bee 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1573,7 +1573,6 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
     {
     case 2:			/* Branch */
       {
-	CORE_ADDR offset;
 	struct upk_mips16 upk;
 	unpack_mips16 (gdbarch, pc, extension, insn, itype, &upk);
 	pc += (upk.offset << 1) + 2;
@@ -4822,7 +4821,6 @@ mips_print_register (struct ui_file *file, struct frame_info *frame,
 		     int regnum)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
-  int offset;
   struct value_print_options opts;
   struct value *val;
 
@@ -5559,7 +5557,7 @@ mips_segment_boundary (CORE_ADDR bpaddr)
 static CORE_ADDR
 mips_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
 {
-  CORE_ADDR prev_addr, next_addr;
+  CORE_ADDR prev_addr;
   CORE_ADDR boundary;
   CORE_ADDR func_addr;
 
@@ -5613,7 +5611,6 @@ mips_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
     }
   else
     {
-      struct minimal_symbol *sym;
       CORE_ADDR addr, jmpaddr;
       int i;
 
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 116a03e..cb0e568 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -387,7 +387,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
                           struct mn10300_prologue *result)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  CORE_ADDR pc, next_pc;
+  CORE_ADDR pc;
   int rn;
   pv_t regs[MN10300_MAX_NUM_REGS];
   struct pv_area *stack;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1f4913a..da18c15 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1169,9 +1169,6 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
 	      struct objfile *const objf1 = sect1->objfile;
 	      struct objfile *const objf2 = sect2->objfile;
 
-	      const struct bfd *const abfd1 = objf1->obfd;
-	      const struct bfd *const abfd2 = objf2->obfd;
-
 	      const struct bfd_section *const bfds1 = sect1->the_bfd_section;
 	      const struct bfd_section *const bfds2 = sect2->the_bfd_section;
 
@@ -1184,10 +1181,10 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
 			   " (A) section `%s' from `%s' [%s, %s)\n"
 			   " (B) section `%s' from `%s' [%s, %s).\n"
 			   "Will ignore section B"),
-			 bfd_section_name (abfd1, bfds1), objf1->name,
+			 bfd_section_name (objf1->obfd, bfds1), objf1->name,
 			 paddress (gdbarch, sect1_addr),
 			 paddress (gdbarch, sect1_endaddr),
-			 bfd_section_name (abfd2, bfds2), objf2->name,
+			 bfd_section_name (objf2->obfd, bfds2), objf2->name,
 			 paddress (gdbarch, sect2_addr),
 			 paddress (gdbarch, sect2_endaddr));
 	    }
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index d6373ae..6fef183 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -72,7 +72,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   unsigned eltlen;
   int length_pos, length_size, string_pos;
   struct type *char_type;
-  LONGEST val;
   CORE_ADDR addr;
 
   CHECK_TYPEDEF (type);
diff --git a/gdb/parse.c b/gdb/parse.c
index 79b2e21..f54c6f2 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1298,7 +1298,6 @@ int
 parse_float (const char *p, int len, DOUBLEST *d, const char **suffix)
 {
   char *copy;
-  char *s;
   int n, num;
 
   copy = xmalloc (len + 1);
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 3392e67..7701d4f 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -639,7 +639,6 @@ static struct insn_pattern powerpc32_plt_stub_so[] =
 static int
 powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
 {
-  struct objfile *objfile;
   struct minimal_symbol *sym;
 
   /* Check whether PC is in the dynamic linker.  This also checks
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 20598d0..1d9628c 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1077,7 +1077,6 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr)
   struct obj_section *dot_fn_section;
   struct minimal_symbol *dot_fn;
   struct minimal_symbol *fn;
-  CORE_ADDR toc;
   /* Find the minimal symbol that corresponds to CODE_ADDR (should
      have a name of the form ".FN").  */
   dot_fn = lookup_minimal_symbol_by_pc (code_addr);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d441dfe..266b138 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1594,7 +1594,6 @@ map_display_numbers (char *args,
 		     void *data)
 {
   struct get_number_or_range_state state;
-  struct display *b, *tmp;
   int num;
 
   if (args == NULL)
@@ -1637,9 +1636,6 @@ do_delete_display (struct display *d, void *data)
 static void
 undisplay_command (char *args, int from_tty)
 {
-  int num;
-  struct get_number_or_range_state state;
-
   if (args == NULL)
     {
       if (query (_("Delete all auto-display expressions? ")))
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index b67b163..0d5646b 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -313,7 +313,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 static void
 bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
 {
-  volatile struct gdb_exception except;
   breakpoint_object *bp_obj = (breakpoint_object *) bpfinish_obj;
   PyObject *py_obj = (PyObject *) bp_obj;
 
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 06d3272..86b478d 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -180,7 +180,6 @@ inferior_to_inferior_object (struct inferior *inferior)
 PyObject *
 find_inferior_object (int pid)
 {
-  struct inflist_entry *p;
   struct inferior *inf = find_inferior_pid (pid);
 
   if (inf)
@@ -257,7 +256,6 @@ delete_thread_object (struct thread_info *tp, int ignore)
 {
   struct cleanup *cleanup;
   inferior_object *inf_obj;
-  thread_object *thread_obj;
   struct threadlist_entry **entry, *tmp;
   
   cleanup = ensure_python_env (python_gdbarch, python_language);
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 3a37ef7..8821f20 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -162,7 +162,6 @@ static PyObject *
 thpy_switch (PyObject *self, PyObject *args)
 {
   thread_object *thread_obj = (thread_object *) self;
-  struct cleanup *cleanup;
   volatile struct gdb_exception except;
 
   THPY_REQUIRE_VALID (thread_obj);
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 5c1d8e6..98030a6 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -1072,7 +1072,6 @@ check_types_equal (struct type *type1, struct type *type2,
   if (TYPE_TARGET_TYPE (type1) != NULL)
     {
       struct type_equality_entry entry;
-      int added;
 
       if (TYPE_TARGET_TYPE (type2) == NULL)
 	return Py_NE;
@@ -1272,7 +1271,6 @@ typy_getitem (PyObject *self, PyObject *key)
   struct type *type = ((type_object *) self)->type;
   char *field;
   int i;
-  volatile struct gdb_exception except;
 
   field = python_string_to_host_string (key);
   if (field == NULL)
@@ -1334,7 +1332,6 @@ typy_has_key (PyObject *self, PyObject *args)
   struct type *type = ((type_object *) self)->type;
   const char *field;
   int i;
-  volatile struct gdb_exception except;
 
   if (!PyArg_ParseTuple (args, "s", &field))
     return NULL;
@@ -1431,7 +1428,6 @@ typy_iterator_iternext (PyObject *self)
 {
   typy_iterator_object *iter_obj = (typy_iterator_object *) self;
   struct type *type = iter_obj->source->type;
-  int i;
   PyObject *result;
   
   if (iter_obj->field < TYPE_NFIELDS (type))
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 938275a..4bd8496 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -556,7 +556,6 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
       for (i = 0; i < sals.nelts; ++i)
 	{
 	  PyObject *obj;
-	  char *str;
 
 	  obj = symtab_and_line_to_sal_object (sals.sals[i]);
 	  if (! obj)
@@ -676,7 +675,6 @@ static void
 gdbpy_run_events (struct serial *scb, void *context)
 {
   struct cleanup *cleanup;
-  int r;
 
   cleanup = ensure_python_env (get_current_arch (), current_language);
 
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index ee43dd6..0e3d533 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -682,7 +682,7 @@ remote_fileio_func_read (char *buf)
   long target_fd, num;
   LONGEST lnum;
   CORE_ADDR ptrval;
-  int fd, ret, retlength;
+  int fd, ret;
   gdb_byte *buffer;
   size_t length;
   off_t old_offset, new_offset;
@@ -1133,7 +1133,7 @@ static void
 remote_fileio_func_fstat (char *buf)
 {
   CORE_ADDR ptrval;
-  int fd, ret, retlength;
+  int fd, ret;
   long target_fd;
   LONGEST lnum;
   struct stat st;
@@ -1212,7 +1212,7 @@ remote_fileio_func_gettimeofday (char *buf)
 {
   LONGEST lnum;
   CORE_ADDR ptrval;
-  int ret, retlength;
+  int ret;
   struct timeval tv;
   struct fio_timeval ftv;
 
@@ -1281,7 +1281,7 @@ static void
 remote_fileio_func_system (char *buf)
 {
   CORE_ADDR ptrval;
-  int ret, length, retlength;
+  int ret, length;
   char *cmdline = NULL;
 
   /* Parameter: Ptr to commandline / length incl. trailing zero */
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index ff4ba71..becd5d5 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -181,8 +181,6 @@ get_ack (void)
 static int
 send_data (void *buf, int len)
 {
-  int ret;
-
   if (!sdi_desc)
     return -1;
 
@@ -707,7 +705,6 @@ m32r_wait (struct target_ops *ops,
   int ib_breakpoints;
   long i;
   unsigned char buf[13];
-  unsigned long val;
   int ret, c;
 
   if (remote_debug)
@@ -1225,7 +1222,6 @@ m32r_load (char *args, int from_tty)
   int nostart;
   struct timeval start_time, end_time;
   unsigned long data_count;	/* Number of bytes transferred to memory.  */
-  int ret;
   static RETSIGTYPE (*prev_sigint) ();
 
   /* for direct tcp connections, we can do a fast binary download.  */
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index a20fc2c..1313a7f 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1537,7 +1537,6 @@ common_open (struct target_ops *ops, char *name, int from_tty,
 	     enum mips_monitor_type new_monitor,
 	     const char *new_monitor_prompt)
 {
-  char *ptype;
   char *serial_port_name;
   char *remote_name = 0;
   char *local_name = 0;
@@ -1828,7 +1827,6 @@ mips_wait (struct target_ops *ops,
   ULONGEST rpc, rfp, rsp;
   char pc_string[17], fp_string[17], sp_string[17], flags[20];
   int nfields;
-  int i;
 
   interrupt_count = 0;
   hit_watchpoint = 0;
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 042296e..07c7de4 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -216,7 +216,6 @@ delete_all_bookmarks (void)
 static void
 delete_bookmark_command (char *args, int from_tty)
 {
-  struct bookmark *b;
   int num;
   struct get_number_or_range_state state;
 
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 7a84769..2d10f36 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1021,7 +1021,6 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *value_type = value_enclosing_type (args[i]);
       int len = TYPE_LENGTH (value_type);
       int container_len = (len + 1) & ~1;
-      int offset;
 
       sp -= container_len;
       write_memory (rl78_make_data_address (sp),
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 5531326..993ed6d 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -430,7 +430,6 @@ rs6000_return_value (struct gdbarch *gdbarch, struct type *func_type,
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  gdb_byte buf[8];
 
   /* The calling convention this function implements assumes the
      processor has floating-point registers.  We shouldn't be using it
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 2b1a0a5..1797cc5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3552,7 +3552,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   enum bfd_architecture arch;
   unsigned long mach;
   bfd abfd;
-  asection *sect;
   enum auto_boolean soft_float_flag = powerpc_soft_float_global;
   int soft_float;
   enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global;
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 038a3ce..f755f21 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1166,7 +1166,6 @@ s390_load (struct s390_prologue_data *data,
 	   
 {
   pv_t addr = s390_addr (data, d2, x2, b2);
-  pv_t offset;
 
   /* If it's a load from an in-line constant pool, then we can
      simulate that, under the assumption that the code isn't
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 90ef610..5d751c0 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -221,7 +221,6 @@ score3_adjust_pc_and_fetch_inst (CORE_ADDR *pcptr, int *lenptr,
 
 #define EXTRACT_LEN 2
   CORE_ADDR adjust_pc = *pcptr & ~0x1;
-  int inst_len;
   gdb_byte buf[5][EXTRACT_LEN] =
     {
       {'\0', '\0'},
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 2e5d8bd..9991e09 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -858,7 +858,6 @@ sh64_analyze_prologue (struct gdbarch *gdbarch,
 		       CORE_ADDR func_pc,
 		       CORE_ADDR current_pc)
 {
-  int reg_nr;
   int pc;
   int opc;
   int insn;
@@ -1070,7 +1069,6 @@ sh64_push_dummy_call (struct gdbarch *gdbarch,
   CORE_ADDR regval;
   char *val;
   char valbuf[8];
-  char valbuf_tmp[8];
   int len;
   int argreg_size;
   int fp_args[12];
diff --git a/gdb/skip.c b/gdb/skip.c
index da748e7..8e19652 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -155,9 +155,6 @@ skip_function_command (char *arg, int from_tty)
       /* Decode arg.  We set funfirstline=1 so decode_line_1 will give us the
 	 first line of the function specified, if it can, and so that we'll
 	 reject variable names and the like.  */
-
-      int i;
-      int pending = 0;
       char *orig_arg = arg; /* decode_line_1 modifies the arg pointer.  */
       volatile struct gdb_exception decode_exception;
       struct symtabs_and_lines sals = { 0 };
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 4f2cda6..ccb5af8 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -214,7 +214,6 @@ darwin_current_sos (void)
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
   int ptr_len = TYPE_LENGTH (ptr_type);
   unsigned int image_info_size;
-  CORE_ADDR lm;
   struct so_list *head = NULL;
   struct so_list *tail = NULL;
   int i;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 7bbd49e..2500c1f 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -232,7 +232,7 @@ decode_loadmap (gdb_byte *buf)
   struct int_elf32_dsbt_loadmap *int_ldmbuf;
 
   int version, seg, nsegs;
-  int ext_ldmbuf_size, int_ldmbuf_size;
+  int int_ldmbuf_size;
 
   ext_ldmbuf = (struct ext_elf32_dsbt_loadmap *) buf;
 
@@ -841,8 +841,7 @@ enable_break2 (void)
       unsigned int interp_sect_size;
       gdb_byte *buf;
       bfd *tmp_bfd = NULL;
-      int status;
-      CORE_ADDR addr, interp_loadmap_addr;
+      CORE_ADDR addr;
       gdb_byte addr_buf[TIC6X_PTR_SIZE];
       struct int_elf32_dsbt_loadmap *ldm;
       volatile struct gdb_exception ex;
@@ -1029,8 +1028,6 @@ dsbt_special_symbol_handling (void)
 static void
 dsbt_relocate_main_executable (void)
 {
-  int status;
-  CORE_ADDR exec_addr, interp_addr;
   struct int_elf32_dsbt_loadmap *ldm;
   struct cleanup *old_chain;
   struct section_offsets *new_offsets;
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index ce4943c..2f2c8b0 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -975,8 +975,6 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
   CORE_ADDR got_value;
   struct int_elf32_fdpic_loadmap *ldm = 0;
   struct symbol *sym;
-  int status;
-  CORE_ADDR exec_loadmap_addr;
 
   /* Fetch the corresponding global pointer for the entry point.  */
   got_value = frv_fdpic_find_global_pointer (entry_point);
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 00bca01..33c946f 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -602,7 +602,6 @@ static struct sparc_frame_cache *
 sparc_alloc_frame_cache (void)
 {
   struct sparc_frame_cache *cache;
-  int i;
 
   cache = FRAME_OBSTACK_ZALLOC (struct sparc_frame_cache);
 
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index 313fddc..8d4ef57 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -61,7 +61,6 @@ parse_spufs_run (ptid_t ptid, int *fd, CORE_ADDR *addr)
   struct gdbarch_tdep *tdep;
   struct regcache *regcache;
   char buf[4];
-  CORE_ADDR pc;
   ULONGEST regval;
 
   /* If we're not on PPU, there's nothing to detect.  */
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 78ba007..b3e133c 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -849,7 +849,7 @@ spu_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end;
   bfd_byte buf[4];
   unsigned int insn;
-  int rt, ra, rb, rc, immed;
+  int rt, ra, rb, immed;
 
   /* Find the search limits based on function boundaries and hard limit.
      We assume the epilogue can be up to 64 instructions long.  */
@@ -1877,14 +1877,15 @@ spu_overlay_new_objfile (struct objfile *objfile)
   /* Now go and fiddle with all the LMAs.  */
   ALL_OBJFILE_OSECTIONS (objfile, osect)
     {
-      bfd *obfd = objfile->obfd;
       asection *bsect = osect->the_bfd_section;
       int ndx = osect - objfile->sections;
 
       if (ovly_table[ndx].mapped_ptr == 0)
-	bfd_section_lma (obfd, bsect) = bfd_section_vma (obfd, bsect);
+	bfd_section_lma (objfile->obfd, bsect)
+	  = bfd_section_vma (objfile->obfd, bsect);
       else
-	bfd_section_lma (obfd, bsect) = SPU_OVERLAY_LMA + bsect->filepos;
+	bfd_section_lma (objfile->obfd, bsect)
+	  = SPU_OVERLAY_LMA + bsect->filepos;
     }
 }
 
@@ -2030,7 +2031,7 @@ info_spu_event_command (char *args, int from_tty)
   gdb_byte buf[100];
   char annex[32];
   LONGEST len;
-  int rc, id;
+  int id;
 
   if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
     error (_("\"info spu\" is only supported on the SPU architecture."));
@@ -2087,7 +2088,7 @@ info_spu_signal_command (char *args, int from_tty)
   char annex[32];
   gdb_byte buf[100];
   LONGEST len;
-  int rc, id;
+  int id;
 
   if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
     error (_("\"info spu\" is only supported on the SPU architecture."));
@@ -2208,7 +2209,7 @@ info_spu_mailbox_command (char *args, int from_tty)
   char annex[32];
   gdb_byte buf[1024];
   LONGEST len;
-  int i, id;
+  int id;
 
   if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
     error (_("\"info spu\" is only supported on the SPU architecture."));
@@ -2356,7 +2357,7 @@ info_spu_dma_cmdlist (gdb_byte *buf, int nr, enum bfd_endian byte_order)
       ULONGEST mfc_cq_dw1;
       ULONGEST mfc_cq_dw2;
       int mfc_cmd_opcode, mfc_cmd_tag, rclass_id, tclass_id;
-      int lsa, size, list_lsa, list_size, mfc_lsa, mfc_size;
+      int list_lsa, list_size, mfc_lsa, mfc_size;
       ULONGEST mfc_ea;
       int list_valid_p, noop_valid_p, qw_valid_p, ea_valid_p, cmd_error_p;
 
@@ -2450,7 +2451,7 @@ info_spu_dma_command (char *args, int from_tty)
   char annex[32];
   gdb_byte buf[1024];
   LONGEST len;
-  int i, id;
+  int id;
 
   if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
     error (_("\"info spu\" is only supported on the SPU architecture."));
@@ -2529,7 +2530,7 @@ info_spu_proxydma_command (char *args, int from_tty)
   char annex[32];
   gdb_byte buf[1024];
   LONGEST len;
-  int i, id;
+  int id;
 
   if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
     error (_("\"info spu\" is only supported on the SPU architecture."));
diff --git a/gdb/stack.c b/gdb/stack.c
index bbd6b7f..6a78c25 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -499,7 +499,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
   long highest_offset = -1;
   /* Number of ints of arguments that we have printed so far.  */
   int args_printed = 0;
-  struct cleanup *old_chain, *list_chain;
+  struct cleanup *old_chain;
   struct ui_file *stb;
   /* True if we should print arguments, false otherwise.  */
   int print_args = strcmp (print_frame_arguments, "none");
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 79453d3..0de5dc4 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -544,7 +544,7 @@ addrs_section_compar (const void *ap, const void *bp)
 {
   const struct other_sections *a = *((struct other_sections **) ap);
   const struct other_sections *b = *((struct other_sections **) bp);
-  int retval, a_idx, b_idx;
+  int retval;
 
   retval = strcmp (addr_section_name (a->name), addr_section_name (b->name));
   if (retval)
@@ -2976,12 +2976,11 @@ section_is_overlay (struct obj_section *section)
 {
   if (overlay_debugging && section)
     {
-      bfd *abfd = section->objfile->obfd;
       asection *bfd_section = section->the_bfd_section;
 
-      if (bfd_section_lma (abfd, bfd_section) != 0
-	  && bfd_section_lma (abfd, bfd_section)
-	     != bfd_section_vma (abfd, bfd_section))
+      if (bfd_section_lma (section->objfile->obfd, bfd_section) != 0
+	  && bfd_section_lma (section->objfile->obfd, bfd_section)
+	     != bfd_section_vma (section->objfile->obfd, bfd_section))
 	return 1;
     }
 
@@ -3052,15 +3051,16 @@ pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
 {
   if (section_is_overlay (section))
     {
-      bfd *abfd = section->objfile->obfd;
       asection *bfd_section = section->the_bfd_section;
 
       /* We assume the LMA is relocated by the same offset as the VMA.  */
       bfd_vma size = bfd_get_section_size (bfd_section);
       CORE_ADDR offset = obj_section_offset (section);
 
-      if (bfd_get_section_lma (abfd, bfd_section) + offset <= pc
-	  && pc < bfd_get_section_lma (abfd, bfd_section) + offset + size)
+      if (bfd_get_section_lma (section->objfile->obfd,
+			       bfd_section) + offset <= pc
+	  && pc < bfd_get_section_lma (section->objfile->obfd,
+				       bfd_section) + offset + size)
 	return 1;
     }
 
@@ -3106,11 +3106,10 @@ overlay_unmapped_address (CORE_ADDR pc, struct obj_section *section)
 {
   if (section_is_overlay (section) && pc_in_mapped_range (pc, section))
     {
-      bfd *abfd = section->objfile->obfd;
       asection *bfd_section = section->the_bfd_section;
 
-      return pc + bfd_section_lma (abfd, bfd_section)
-		- bfd_section_vma (abfd, bfd_section);
+      return pc + bfd_section_lma (section->objfile->obfd, bfd_section)
+		- bfd_section_vma (section->objfile->obfd, bfd_section);
     }
 
   return pc;
@@ -3125,11 +3124,10 @@ overlay_mapped_address (CORE_ADDR pc, struct obj_section *section)
 {
   if (section_is_overlay (section) && pc_in_unmapped_range (pc, section))
     {
-      bfd *abfd = section->objfile->obfd;
       asection *bfd_section = section->the_bfd_section;
 
-      return pc + bfd_section_vma (abfd, bfd_section)
-		- bfd_section_lma (abfd, bfd_section);
+      return pc + bfd_section_vma (section->objfile->obfd, bfd_section)
+		- bfd_section_lma (section->objfile->obfd, bfd_section);
     }
 
   return pc;
@@ -3515,7 +3513,6 @@ static int
 simple_overlay_update_1 (struct obj_section *osect)
 {
   int i, size;
-  bfd *obfd = osect->objfile->obfd;
   asection *bsect = osect->the_bfd_section;
   struct gdbarch *gdbarch = get_objfile_arch (osect->objfile);
   int word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
@@ -3523,15 +3520,19 @@ simple_overlay_update_1 (struct obj_section *osect)
 
   size = bfd_get_section_size (osect->the_bfd_section);
   for (i = 0; i < cache_novlys; i++)
-    if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
-	&& cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
+    if (cache_ovly_table[i][VMA] == bfd_section_vma (osect->objfile->obfd,
+						     bsect)
+	&& cache_ovly_table[i][LMA] == bfd_section_lma (osect->objfile->obfd,
+							bsect)
 	/* && cache_ovly_table[i][SIZE] == size */ )
       {
 	read_target_long_array (cache_ovly_table_base + i * word_size,
 				(unsigned int *) cache_ovly_table[i],
 				4, word_size, byte_order);
-	if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
-	    && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
+	if (cache_ovly_table[i][VMA] == bfd_section_vma (osect->objfile->obfd,
+							 bsect)
+	    && cache_ovly_table[i][LMA]
+	    == bfd_section_lma (osect->objfile->obfd, bsect)
 	    /* && cache_ovly_table[i][SIZE] == size */ )
 	  {
 	    osect->ovly_mapped = cache_ovly_table[i][MAPPED];
@@ -3591,13 +3592,14 @@ simple_overlay_update (struct obj_section *osect)
     if (section_is_overlay (osect))
     {
       int i, size;
-      bfd *obfd = osect->objfile->obfd;
       asection *bsect = osect->the_bfd_section;
 
       size = bfd_get_section_size (bsect);
       for (i = 0; i < cache_novlys; i++)
-	if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
-	    && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)
+	if (cache_ovly_table[i][VMA] == bfd_section_vma (osect->objfile->obfd,
+							 bsect)
+	    && cache_ovly_table[i][LMA]
+	    == bfd_section_lma (osect->objfile->obfd, bsect)
 	    /* && cache_ovly_table[i][SIZE] == size */ )
 	  { /* obj_section matches i'th entry in ovly_table.  */
 	    osect->ovly_mapped = cache_ovly_table[i][MAPPED];
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d68e542..c62fda0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -155,7 +155,6 @@ compare_filenames_for_search (const char *filename, const char *search_name,
 			      int search_len)
 {
   int len = strlen (filename);
-  int offset;
 
   if (len < search_len)
     return 0;
@@ -195,7 +194,6 @@ iterate_over_some_symtabs (const char *name,
 			   struct symtab *after_last)
 {
   struct symtab *s = NULL;
-  struct cleanup *cleanup;
   const char* base_name = lbasename (name);
   int name_len = strlen (name);
   int is_abs = IS_ABSOLUTE_PATH (name);
@@ -3289,7 +3287,6 @@ search_symbols (char *regexp, enum search_domain kind,
   struct symbol *sym;
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
-  char *val;
   int found_misc = 0;
   static const enum minimal_symbol_type types[]
     = {mst_data, mst_text, mst_abs};
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 2dce8da..6d63c8d 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -301,7 +301,6 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
 static CORE_ADDR
 tic6x_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
 {
-  CORE_ADDR limit_pc;
   CORE_ADDR func_addr;
   struct tic6x_unwind_cache cache;
 
@@ -405,7 +404,6 @@ tic6x_frame_unwind_cache (struct frame_info *this_frame,
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR current_pc;
   struct tic6x_unwind_cache *cache;
-  int i;
 
   if (*this_prologue_cache)
     return *this_prologue_cache;
@@ -606,7 +604,6 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   unsigned long inst;
-  int offset;
   int register_number;
   int last = 0;
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 6e47a0a..4ecb006 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4421,9 +4421,7 @@ tfile_fetch_registers (struct target_ops *ops,
 		       struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  char block_type;
-  int pos, offset, regn, regsize, pc_regno;
-  unsigned short mlen;
+  int offset, regn, regsize, pc_regno;
   char *regs;
 
   /* An uninitialized reg size says we're not going to be
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 240a154..ce1de96 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -593,7 +593,6 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
   CORE_ADDR prologue_end, current_pc;
   struct pifsr pifsrs[E_NUM_REGS + 1];
   struct pifsr *pifsr, *pifsr_tmp;
-  int fp_used;
   int ep_used;
   int reg;
   CORE_ADDR save_pc, save_end;
@@ -958,7 +957,6 @@ static struct v850_frame_cache *
 v850_alloc_frame_cache (struct frame_info *this_frame)
 {
   struct v850_frame_cache *cache;
-  int i;
 
   cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache);
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index a17c91a..0225339 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1390,7 +1390,7 @@ static struct value *
 vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
 {
   struct value *val, *tmp, *mark;
-  struct type *type1, *type2, *eltype1, *eltype2, *result_type;
+  struct type *type1, *type2, *eltype1, *eltype2;
   int t1_is_vec, t2_is_vec, elsize, i;
   LONGEST low_bound1, high_bound1, low_bound2, high_bound2;
 
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 25b62bc..b50b4d9 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -329,7 +329,6 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
   unsigned len;
   struct type *elttype, *unresolved_elttype;
   struct type *unresolved_type = type;
-  unsigned eltlen;
   LONGEST val;
   CORE_ADDR addr;
 
diff --git a/gdb/value.c b/gdb/value.c
index d498289..66905bb 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -841,7 +841,6 @@ value_actual_type (struct value *value, int resolve_simple_types,
 		   int *real_type_found)
 {
   struct value_print_options opts;
-  struct value *target;
   struct type *result;
 
   get_user_print_options (&opts);
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index d469445..af93a43 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -912,7 +912,6 @@ record_minimal_symbol (const char *name, CORE_ADDR address,
 		       int n_scnum,
 		       struct objfile *objfile)
 {
-  struct find_targ_sec_arg args;
   int secnum;
   asection *bfd_sect;
 
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 78d8888..314b3c1 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -665,7 +665,6 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
       gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
-      unsigned int wb;
 
       regcache_raw_read (regcache,
 			 gdbarch_tdep (gdbarch)->wb_regnum, buf);
@@ -2816,7 +2815,6 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
   void (*func) (struct gdbarch *, int, int, int, CORE_ADDR);
 
   int at, as, offset;
-  int num_operands;
 
   /* WindowUnderflow12 = true, when inside _WindowUnderflow12.  */ 
   int WindowUnderflow12 = (current_pc & 0x1ff) >= 0x140; 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]