Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
@ 2012-04-23 23:05 Sergio Durigan Junior
  2012-04-24  3:33 ` Doug Evans
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-23 23:05 UTC (permalink / raw)
  To: gdb-patches

Hi,

This patch is a followup of the discussion in:

    http://sourceware.org/ml/gdb/2012-04/msg00171.html

First of all, I am sorry for the size of this patch, but I couldn't
think of a good way of splitting it, and also I thought it would be
useless since these changes are all logically related.

I regtested the patch on a Fedora 16 x86{,_64}, without regressions.  I
also built the patch using `--enable-targets=all --enable-plugins
--enable-gold', and everything succeeded.

I'd like to apply it, but I have a couple of questions before:

a) How's the ChangeLog for this patch supposed to be?  Can I make a
"generic" ChangeLog, saying something like `Remove unused variables from
files'?

b) I'd like someone to take a look at the `observer.sh' change, please.

Thank you,

-- 
Sergio

---
 gdb/ada-lang.c                           |    3 +-
 gdb/ada-tasks.c                          |    1 -
 gdb/ada-varobj.c                         |    1 -
 gdb/alpha-mdebug-tdep.c                  |    2 -
 gdb/alpha-tdep.c                         |    2 -
 gdb/amd64-darwin-tdep.c                  |    1 -
 gdb/amd64-dicos-tdep.c                   |    2 -
 gdb/arm-symbian-tdep.c                   |    4 +--
 gdb/arm-tdep.c                           |   54 +++++++----------------------
 gdb/auto-load.c                          |    1 -
 gdb/avr-tdep.c                           |    3 --
 gdb/ax-gdb.c                             |    1 -
 gdb/bfin-linux-tdep.c                    |    2 -
 gdb/bfin-tdep.c                          |    5 ---
 gdb/breakpoint.c                         |   14 --------
 gdb/c-exp.y                              |    3 --
 gdb/c-lang.c                             |   12 -------
 gdb/c-valprint.c                         |    1 -
 gdb/cli/cli-cmds.c                       |    2 -
 gdb/coffread.c                           |    1 -
 gdb/continuations.c                      |    2 -
 gdb/cp-namespace.c                       |    4 --
 gdb/cp-support.c                         |    3 --
 gdb/cris-tdep.c                          |   22 ------------
 gdb/dicos-tdep.c                         |    2 -
 gdb/dwarf2-frame-tailcall.c              |    4 +--
 gdb/dwarf2-frame.c                       |    4 +--
 gdb/dwarf2expr.c                         |    1 -
 gdb/dwarf2loc.c                          |    7 +---
 gdb/dwarf2read.c                         |   12 -------
 gdb/elfread.c                            |    3 +-
 gdb/eval.c                               |    2 +-
 gdb/expprint.c                           |    3 --
 gdb/f-valprint.c                         |    2 -
 gdb/features/arm-with-m-fpa-layout.c     |    1 -
 gdb/features/arm-with-m.c                |    1 -
 gdb/features/arm-with-neon.c             |    1 -
 gdb/features/arm-with-vfpv2.c            |    1 -
 gdb/features/arm-with-vfpv3.c            |    1 -
 gdb/features/i386/i386-mmx-linux.c       |    2 +-
 gdb/features/rs6000/powerpc-32.c         |    1 -
 gdb/features/rs6000/powerpc-32l.c        |    1 -
 gdb/features/rs6000/powerpc-403.c        |    1 -
 gdb/features/rs6000/powerpc-403gc.c      |    1 -
 gdb/features/rs6000/powerpc-405.c        |    1 -
 gdb/features/rs6000/powerpc-505.c        |    1 -
 gdb/features/rs6000/powerpc-601.c        |    1 -
 gdb/features/rs6000/powerpc-602.c        |    1 -
 gdb/features/rs6000/powerpc-603.c        |    1 -
 gdb/features/rs6000/powerpc-604.c        |    1 -
 gdb/features/rs6000/powerpc-64.c         |    1 -
 gdb/features/rs6000/powerpc-64l.c        |    1 -
 gdb/features/rs6000/powerpc-750.c        |    1 -
 gdb/features/rs6000/powerpc-860.c        |    1 -
 gdb/features/rs6000/powerpc-e500.c       |    1 -
 gdb/features/rs6000/powerpc-e500l.c      |    1 -
 gdb/features/rs6000/powerpc-isa205-32l.c |    1 -
 gdb/features/rs6000/powerpc-isa205-64l.c |    1 -
 gdb/features/rs6000/rs6000.c             |    1 -
 gdb/features/s390-linux32.c              |    1 -
 gdb/features/s390-linux32v1.c            |    1 -
 gdb/features/s390-linux32v2.c            |    1 -
 gdb/features/s390-linux64.c              |    1 -
 gdb/features/s390-linux64v1.c            |    1 -
 gdb/features/s390-linux64v2.c            |    1 -
 gdb/features/s390x-linux64.c             |    1 -
 gdb/features/s390x-linux64v1.c           |    1 -
 gdb/features/s390x-linux64v2.c           |    1 -
 gdb/features/tic6x-c62x-linux.c          |    1 -
 gdb/features/tic6x-c62x.c                |    1 -
 gdb/features/tic6x-c64x-linux.c          |    1 -
 gdb/features/tic6x-c64x.c                |    1 -
 gdb/features/tic6x-c64xp-linux.c         |    1 -
 gdb/features/tic6x-c64xp.c               |    1 -
 gdb/frv-linux-tdep.c                     |    1 -
 gdb/frv-tdep.c                           |    3 --
 gdb/gcore.c                              |    5 +--
 gdb/gnu-v3-abi.c                         |    1 -
 gdb/h8300-tdep.c                         |   12 +------
 gdb/hppa-hpux-tdep.c                     |    2 +-
 gdb/hppa-tdep.c                          |   25 --------------
 gdb/hppanbsd-tdep.c                      |    3 --
 gdb/hppaobsd-tdep.c                      |    1 -
 gdb/i386-dicos-tdep.c                    |    2 -
 gdb/i386-nto-tdep.c                      |    1 -
 gdb/i386-tdep.c                          |    1 -
 gdb/i386nbsd-tdep.c                      |    1 -
 gdb/i386obsd-tdep.c                      |    2 -
 gdb/i387-tdep.c                          |    3 --
 gdb/ia64-tdep.c                          |   13 +------
 gdb/infcmd.c                             |    1 -
 gdb/jit.c                                |   10 +-----
 gdb/jv-valprint.c                        |    1 -
 gdb/linespec.c                           |    5 ---
 gdb/linux-nat.c                          |    2 -
 gdb/linux-tdep.c                         |    1 -
 gdb/linux-thread-db.c                    |    1 -
 gdb/lm32-tdep.c                          |   10 -----
 gdb/m2-valprint.c                        |    2 -
 gdb/m32c-tdep.c                          |   27 +--------------
 gdb/m32r-linux-tdep.c                    |    3 --
 gdb/m32r-rom.c                           |    8 +++--
 gdb/m32r-tdep.c                          |    3 +-
 gdb/m68k-tdep.c                          |    1 -
 gdb/m68klinux-tdep.c                     |    2 -
 gdb/mep-tdep.c                           |    4 --
 gdb/mi/mi-main.c                         |    2 -
 gdb/microblaze-linux-tdep.c              |    4 --
 gdb/microblaze-tdep.c                    |    5 +--
 gdb/mips-linux-tdep.c                    |    6 ++--
 gdb/mips-tdep.c                          |   13 +-------
 gdb/mn10300-tdep.c                       |    4 +--
 gdb/objc-lang.c                          |    2 -
 gdb/objfiles.c                           |    7 +---
 gdb/observer.sh                          |   11 +++++-
 gdb/p-valprint.c                         |    1 -
 gdb/parse.c                              |    1 -
 gdb/ppc-linux-tdep.c                     |    1 -
 gdb/ppc-sysv-tdep.c                      |    1 -
 gdb/printcmd.c                           |    4 --
 gdb/python/py-finishbreakpoint.c         |    3 --
 gdb/python/py-inferior.c                 |    2 -
 gdb/python/py-infthread.c                |    1 -
 gdb/python/py-type.c                     |    4 --
 gdb/python/python.c                      |    5 ---
 gdb/regcache.c                           |    2 -
 gdb/remote-fileio.c                      |    8 ++--
 gdb/remote-m32r-sdi.c                    |   10 +-----
 gdb/remote-mips.c                        |    5 ---
 gdb/remote.c                             |    7 ----
 gdb/reverse.c                            |    1 -
 gdb/rl78-tdep.c                          |    1 -
 gdb/rs6000-aix-tdep.c                    |    3 --
 gdb/rs6000-tdep.c                        |    6 ---
 gdb/rx-tdep.c                            |    1 -
 gdb/s390-tdep.c                          |    4 --
 gdb/score-tdep.c                         |    3 --
 gdb/sh-tdep.c                            |    8 ----
 gdb/sh64-tdep.c                          |    6 ---
 gdb/skip.c                               |    3 --
 gdb/solib-darwin.c                       |    1 -
 gdb/solib-dsbt.c                         |    9 +----
 gdb/solib-frv.c                          |    5 ---
 gdb/solib-svr4.c                         |    1 -
 gdb/solib-target.c                       |    1 -
 gdb/sparc-tdep.c                         |    2 -
 gdb/sparcobsd-tdep.c                     |    2 -
 gdb/spu-multiarch.c                      |    1 -
 gdb/spu-tdep.c                           |   23 ++++++-------
 gdb/stack.c                              |    4 +--
 gdb/symfile.c                            |   46 +++++++++++++------------
 gdb/symtab.c                             |    7 +---
 gdb/thread.c                             |    1 -
 gdb/tic6x-tdep.c                         |    8 ----
 gdb/tracepoint.c                         |    8 +----
 gdb/v850-tdep.c                          |    2 -
 gdb/valarith.c                           |    2 +-
 gdb/valops.c                             |    1 -
 gdb/valprint.c                           |    2 -
 gdb/value.c                              |    1 -
 gdb/varobj.c                             |    1 -
 gdb/xcoffread.c                          |    2 -
 gdb/xtensa-tdep.c                        |    6 ---
 163 files changed, 100 insertions(+), 565 deletions(-)

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/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index 4b46a3c..7b299bb 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -403,8 +403,6 @@ alpha_mdebug_frame_base_sniffer (struct frame_info *this_frame)
 void
 alpha_mdebug_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   frame_unwind_append_unwinder (gdbarch, &alpha_mdebug_frame_unwind);
   frame_base_append_sniffer (gdbarch, alpha_mdebug_frame_base_sniffer);
 }
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 856aa0d..6c55a8f 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1868,8 +1868,6 @@ extern initialize_file_ftype _initialize_alpha_tdep; /* -Wmissing-prototypes */
 void
 _initialize_alpha_tdep (void)
 {
-  struct cmd_list_element *c;
-
   gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, NULL);
 
   /* Let the user set the fence post for heuristic_proc_start.  */
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/amd64-dicos-tdep.c b/gdb/amd64-dicos-tdep.c
index a262284..0f279ab 100644
--- a/gdb/amd64-dicos-tdep.c
+++ b/gdb/amd64-dicos-tdep.c
@@ -44,8 +44,6 @@ amd64_dicos_push_dummy_code (struct gdbarch *gdbarch,
 static void
 amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   amd64_init_abi (info, gdbarch);
 
   dicos_init_abi (gdbarch);
diff --git a/gdb/arm-symbian-tdep.c b/gdb/arm-symbian-tdep.c
index cc4a784..15a0e67 100644
--- a/gdb/arm-symbian-tdep.c
+++ b/gdb/arm-symbian-tdep.c
@@ -63,8 +63,6 @@ static void
 arm_symbian_init_abi (struct gdbarch_info info,
 		      struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   /* Shared library handling.  */
   set_gdbarch_skip_trampoline_code (gdbarch, arm_symbian_skip_trampoline_code);
 
@@ -89,7 +87,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 b14b944..46b8be3 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -379,7 +379,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
@@ -1284,7 +1283,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);
@@ -1376,7 +1375,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
@@ -1535,7 +1533,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))
@@ -1664,7 +1661,6 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
 		      CORE_ADDR prologue_start, CORE_ADDR prologue_end,
 		      struct arm_prologue_cache *cache)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
   int regno;
   CORE_ADDR offset, current_pc;
@@ -1911,14 +1907,9 @@ arm_scan_prologue (struct frame_info *this_frame,
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int regno;
-  CORE_ADDR prologue_start, prologue_end, current_pc;
+  CORE_ADDR prologue_start, prologue_end;
   CORE_ADDR prev_pc = get_frame_pc (this_frame);
   CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
-  pv_t regs[ARM_FPS_REGNUM];
-  struct pv_area *stack;
-  struct cleanup *back_to;
-  CORE_ADDR offset;
 
   /* Assume there is no frame until proven otherwise.  */
   cache->framereg = ARM_SP_REGNUM;
@@ -5131,7 +5122,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);
@@ -5164,7 +5155,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;
 
@@ -6864,7 +6855,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;
@@ -6998,8 +6989,8 @@ arm_copy_block_xfer (struct gdbarch *gdbarch, uint32_t insn,
 	     contiguous chunk r0...rX before doing the transfer, then shuffling
 	     registers into the correct places in the cleanup routine.  */
 	  unsigned int regmask = insn & 0xffff;
-	  unsigned int num_in_list = bitcount (regmask), new_regmask, bit = 1;
-	  unsigned int to = 0, from = 0, i, new_rn;
+	  unsigned int num_in_list = bitcount (regmask), new_regmask;
+	  unsigned int i;
 
 	  for (i = 0; i < num_in_list; i++)
 	    dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
@@ -7100,8 +7091,8 @@ thumb2_copy_block_xfer (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
       else
 	{
 	  unsigned int regmask = dsc->u.block.regmask;
-	  unsigned int num_in_list = bitcount (regmask), new_regmask, bit = 1;
-	  unsigned int to = 0, from = 0, i, new_rn;
+	  unsigned int num_in_list = bitcount (regmask), new_regmask;
+	  unsigned int i;
 
 	  for (i = 0; i < num_in_list; i++)
 	    dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
@@ -7406,7 +7397,6 @@ arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn,
 {
   unsigned int op2 = bits (insn, 4, 6);
   unsigned int op = bits (insn, 21, 22);
-  unsigned int op1 = bits (insn, 16, 19);
 
   switch (op2)
     {
@@ -7503,7 +7493,6 @@ arm_decode_ld_st_word_ubyte (struct gdbarch *gdbarch, uint32_t insn,
 {
   int a = bit (insn, 25), b = bit (insn, 4);
   uint32_t op1 = bits (insn, 20, 24);
-  int rn_f = bits (insn, 16, 19) == 0xf;
 
   if ((!a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02)
       || (a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02 && !b))
@@ -7698,7 +7687,6 @@ arm_decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn, CORE_ADDR to,
   unsigned int op1 = bits (insn, 20, 25);
   int op = bit (insn, 4);
   unsigned int coproc = bits (insn, 8, 11);
-  unsigned int rn = bits (insn, 16, 19);
 
   if ((op1 & 0x20) == 0x00 && (op1 & 0x3a) != 0x00 && (coproc & 0xe) == 0xa)
     return arm_decode_ext_reg_ld_st (gdbarch, insn, regs, dsc);
@@ -7743,11 +7731,9 @@ thumb2_decode_svc_copro (struct gdbarch *gdbarch, uint16_t insn1,
 			 struct displaced_step_closure *dsc)
 {
   unsigned int coproc = bits (insn2, 8, 11);
-  unsigned int op1 = bits (insn1, 4, 9);
   unsigned int bit_5_8 = bits (insn1, 5, 8);
   unsigned int bit_9 = bit (insn1, 9);
   unsigned int bit_4 = bit (insn1, 4);
-  unsigned int rn = bits (insn1, 0, 3);
 
   if (bit_9 == 0)
     {
@@ -7873,7 +7859,6 @@ thumb_copy_16bit_ldr_literal (struct gdbarch *gdbarch, unsigned short insn1,
   unsigned int rt = bits (insn1, 8, 10);
   unsigned int pc;
   int imm8 = (bits (insn1, 0, 7) << 2);
-  CORE_ADDR from = dsc->insn_addr;
 
   /* LDR Rd, #imm8
 
@@ -8062,8 +8047,8 @@ thumb_copy_pop_pc_16bit (struct gdbarch *gdbarch, unsigned short insn1,
   else
     {
       unsigned int num_in_list = bitcount (dsc->u.block.regmask);
-      unsigned int new_regmask, bit = 1;
-      unsigned int to = 0, from = 0, i, new_rn;
+      unsigned int new_regmask;
+      unsigned int i;
 
       for (i = 0; i < num_in_list + 1; i++)
 	dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
@@ -8200,7 +8185,6 @@ decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
   int rt = bits (insn2, 12, 15);
   int rn = bits (insn1, 0, 3);
   int op1 = bits (insn1, 7, 8);
-  int err = 0;
 
   switch (bits (insn1, 5, 6))
     {
@@ -8706,8 +8690,6 @@ static void
 arm_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
 			       int *kindptr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   arm_breakpoint_from_pc (gdbarch, pcptr, kindptr);
 
   if (arm_pc_is_thumb (gdbarch, *pcptr) && *kindptr == 4)
@@ -9281,8 +9263,6 @@ static void
 arm_show_fallback_mode (struct ui_file *file, int from_tty,
 			struct cmd_list_element *c, const char *value)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
-
   fprintf_filtered (file,
 		    _("The current execution mode assumed "
 		      "(when symbols are unavailable) is \"%s\".\n"),
@@ -9293,8 +9273,6 @@ static void
 arm_show_force_mode (struct ui_file *file, int from_tty,
 		     struct cmd_list_element *c, const char *value)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
-
   fprintf_filtered (file,
 		    _("The current execution mode assumed "
 		      "(even when symbols are available) is \"%s\".\n"),
@@ -9572,7 +9550,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);
@@ -10306,11 +10283,10 @@ _initialize_arm_tdep (void)
 {
   struct ui_file *stb;
   long length;
-  struct cmd_list_element *new_set, *new_show;
   const char *setname;
   const char *setdesc;
   const char *const *regnames;
-  int numregs, i, j;
+  int numregs, i;
   static char *helptext;
   char regdesc[1024], *rdptr = regdesc;
   size_t rest = sizeof (regdesc);
@@ -10729,7 +10705,6 @@ arm_record_extension_space (insn_decode_record *arm_insn_r)
   uint32_t opcode1 = 0, opcode2 = 0, insn_op1 = 0;
   uint32_t record_buf[8], record_buf_mem[8];
   uint32_t reg_src1 = 0;
-  uint32_t immed_high = 0, immed_low = 0,offset_8 = 0, tgt_mem_addr = 0;
   struct regcache *reg_cache = arm_insn_r->regcache;
   ULONGEST u_regval = 0;
 
@@ -11010,8 +10985,7 @@ arm_record_data_proc_misc_ld_str (insn_decode_record *arm_insn_r)
   uint32_t record_buf[8], record_buf_mem[8];
   ULONGEST u_regval[2] = {0};
 
-  uint32_t reg_src1 = 0, reg_src2 = 0, reg_dest = 0;
-  uint32_t immed_high = 0, immed_low = 0, offset_8 = 0, tgt_mem_addr = 0;
+  uint32_t reg_src1 = 0, reg_dest = 0;
   uint32_t opcode1 = 0;
 
   arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
@@ -12408,8 +12382,6 @@ int
 arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache, 
                         CORE_ADDR insn_addr)
 {
-
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   uint32_t no_of_rec = 0;
   uint32_t ret = 0;  /* return value: -1:record failure ;  0:success  */
   ULONGEST t_bit = 0, insn_id = 0;
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 9d19179..016d8a1 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -122,7 +122,6 @@ static VEC (char_ptr) *auto_load_safe_path_vec;
 static void
 auto_load_safe_path_vec_update (void)
 {
-  VEC (char_ptr) *dir_vec = NULL;
   unsigned len;
   int ix;
 
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 34b0baf..b107217 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)
@@ -1081,8 +1080,6 @@ static struct value *
 avr_frame_prev_register (struct frame_info *this_frame,
 			 void **this_prologue_cache, int regnum)
 {
-  struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct avr_unwind_cache *info
     = avr_frame_unwind_cache (this_frame, this_prologue_cache);
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index aaefed6..3d98fc0 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2174,7 +2174,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..81b4de1 100644
--- a/gdb/bfin-linux-tdep.c
+++ b/gdb/bfin-linux-tdep.c
@@ -99,11 +99,9 @@ bfin_linux_sigframe_init (const struct tramp_frame *self,
 			  struct trad_frame_cache *this_cache,
 			  CORE_ADDR func)
 {
-  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   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/bfin-tdep.c b/gdb/bfin-tdep.c
index a48758d..c564a7f 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -502,13 +502,9 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
 		      CORE_ADDR struct_addr)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  char buf[4];
   int i;
   long reg_r0, reg_r1, reg_r2;
   int total_len = 0;
-  enum bfin_abi abi = bfin_abi (gdbarch);
-  CORE_ADDR func_addr = find_function_addr (function, NULL);
 
   for (i = nargs - 1; i >= 0; i--)
     {
@@ -530,7 +526,6 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
   for (i = nargs - 1; i >= 0; i--)
     {
       struct type *value_type = value_enclosing_type (args[i]);
-      struct type *arg_type = check_typedef (value_type);
       int len = TYPE_LENGTH (value_type);
       int container_len = (len + 3) & ~3;
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index be536bc..2bb6ae5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -746,7 +746,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)
@@ -1945,7 +1944,6 @@ static struct agent_expr *
 parse_cond_to_aexpr (CORE_ADDR scope, struct expression *cond)
 {
   struct agent_expr *aexpr = NULL;
-  struct cleanup *old_chain = NULL;
   volatile struct gdb_exception ex;
 
   if (!cond)
@@ -7342,7 +7340,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;
@@ -7610,7 +7607,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);
 
@@ -8513,8 +8509,6 @@ static void
 parse_breakpoint_sals (char **address,
 		       struct linespec_result *canonical)
 {
-  char *addr_start = *address;
-
   /* If no arg given, or if first arg is 'if ', use the default
      breakpoint.  */
   if ((*address) == NULL
@@ -8694,8 +8688,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;
@@ -8764,7 +8756,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;
@@ -11892,7 +11883,6 @@ bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
 static void
 say_where (struct breakpoint *b)
 {
-  struct ui_out *uiout = current_uiout;
   struct value_print_options opts;
 
   get_user_print_options (&opts);
@@ -12150,8 +12140,6 @@ bkpt_breakpoint_hit (const struct bp_location *bl,
 		     struct address_space *aspace, CORE_ADDR bp_addr,
 		     const struct target_waitstatus *ws)
 {
-  struct breakpoint *b = bl->owner;
-
   if (ws->kind != TARGET_WAITKIND_STOPPED
       || ws->value.sig != TARGET_SIGNAL_TRAP)
     return 0;
@@ -12340,7 +12328,6 @@ internal_bkpt_check_status (bpstat bs)
 static enum print_stop_action
 internal_bkpt_print_it (bpstat bs)
 {
-  struct ui_out *uiout = current_uiout;
   struct breakpoint *b;
 
   b = bs->breakpoint_at;
@@ -12947,7 +12934,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-lang.c b/gdb/c-lang.c
index 28dce8d..0a17e49 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -197,18 +197,6 @@ c_printstr (struct ui_file *stream, struct type *type,
   const char *type_encoding;
   const char *encoding;
 
-  enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
-  unsigned int i;
-  unsigned int things_printed = 0;
-  int in_quotes = 0;
-  int need_comma = 0;
-  int width = TYPE_LENGTH (type);
-  struct obstack wchar_buf, output;
-  struct cleanup *cleanup;
-  struct wchar_iterator *iter;
-  int finished = 0;
-  int need_escape = 0;
-
   str_type = (classify_type (type, get_type_arch (type), &type_encoding)
 	      & ~C_CHAR);
   switch (str_type)
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 7513ee4..76b94dd 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1343,7 +1343,6 @@ alias_command (char *args, int from_tty)
   char *args2, *equals, *alias, *command;
   char **alias_argv, **command_argv;
   dyn_string_t alias_dyn_string, command_dyn_string;
-  struct cmd_list_element *c;
   static const char usage[] = N_("Usage: alias [-a] [--] ALIAS = COMMAND");
 
   if (args == NULL || strchr (args, '=') == NULL)
@@ -1425,7 +1424,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 7c59535..6e99b48 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/continuations.c b/gdb/continuations.c
index 95e934e..581ee9a 100644
--- a/gdb/continuations.c
+++ b/gdb/continuations.c
@@ -100,8 +100,6 @@ discard_my_continuations_1 (struct continuation **pmy_chain)
 static void
 discard_my_continuations (struct continuation **list)
 {
-  struct continuation *continuation_ptr = *list;
-
   discard_my_continuations_1 (list);
   *list = NULL;
 }
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 170dd5f..9e7cac9 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -473,10 +473,6 @@ cp_lookup_symbol_imports_or_template (const char *scope,
 
   if (function != NULL && SYMBOL_LANGUAGE (function) == language_cplus)
     {
-      int i;
-      struct cplus_specific *cps
-	= function->ginfo.language_specific.cplus_specific;
-
       /* Search the function's template parameters.  */
       if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function))
 	{
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..87ed2aa 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,18 +819,13 @@ 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.  */
-  CORE_ADDR fp_arg;
-  CORE_ADDR fp_mem;
 
   struct stack_item *si = NULL;
 
@@ -1056,9 +1047,6 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
   unsigned short insn_next; 
   int regno;
 
-  /* Is there a push fp?  */
-  int have_fp; 
-
   /* Number of byte on stack used for local variables and movem.  */
   int val; 
 
@@ -1487,7 +1475,6 @@ cris_spec_reg_applicable (struct gdbarch *gdbarch,
 static int
 cris_register_size (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
   int spec_regno;
   
@@ -2189,9 +2176,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)
     {
@@ -3848,7 +3832,6 @@ cris_supply_gregset (struct regcache *regcache, elf_gregset_t *gregsetp)
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int i;
   elf_greg_t *regp = *gregsetp;
-  static char zerobuf[4] = {0};
 
   /* The kernel dumps all 32 registers as unsigned longs, but supply_register
      knows about the actual size of each register so that's no problem.  */
@@ -3916,11 +3899,6 @@ extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */
 void
 _initialize_cris_tdep (void)
 {
-  static struct cmd_list_element *cris_set_cmdlist;
-  static struct cmd_list_element *cris_show_cmdlist;
-
-  struct cmd_list_element *c;
-
   gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
   
   /* CRIS-specific user-commands.  */
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 5763561..a94fba5 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -28,8 +28,6 @@
 void
 dicos_init_abi (struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   set_solib_ops (gdbarch, &solib_target_so_ops);
 
   /* Every process, although has its own address space, sees the same
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 5870079..e516ac4 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -888,10 +888,8 @@ dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc,
 			  CORE_ADDR pc,
 			  struct dwarf2_per_cu_data *data)
 {
-  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 700d8cc..001166b 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -862,7 +862,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 863a5fa..7286229 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;
@@ -2673,10 +2670,8 @@ 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;
 
 	    b = block_for_pc (expr->scope);
 
@@ -3816,7 +3811,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
   struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
   CORE_ADDR low, high;
   const gdb_byte *loc_ptr, *buf_end;
-  int length, first = 1;
+  int length;
   struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index c737d41..27ae0b8 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2248,7 +2248,6 @@ dw2_get_file_names (struct objfile *objfile,
   gdb_byte *info_ptr;
   int has_children, i;
   struct dwarf2_cu cu;
-  unsigned int bytes_read;
   struct die_reader_specs reader_specs;
   char *name, *comp_dir;
   void **slot;
@@ -3437,7 +3436,6 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
   gdb_byte *buffer = section->buffer;
   gdb_byte *info_ptr = buffer + this_cu->offset.sect_off;
   unsigned int buffer_size = section->size;
-  gdb_byte *beg_of_comp_unit = info_ptr;
   struct die_info *comp_unit_die;
   struct partial_symtab *pst;
   CORE_ADDR baseaddr;
@@ -4657,7 +4655,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++)
@@ -6383,7 +6380,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)
@@ -7181,11 +7177,8 @@ static void
 dwarf2_add_typedef (struct field_info *fip, struct die_info *die,
 		    struct dwarf2_cu *cu)
 {
-  struct objfile *objfile = cu->objfile;
   struct typedef_field_list *new_field;
-  struct attribute *attr;
   struct typedef_field *fp;
-  char *fieldname = "";
 
   /* Allocate a new field list entry and link it in.  */
   new_field = xzalloc (sizeof (*new_field));
@@ -12182,7 +12175,6 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
 		    struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
-  struct comp_unit_head *cu_header = &cu->header;
   LONGEST value;
   gdb_byte *bytes;
   struct dwarf2_locexpr_baton *baton;
@@ -12314,7 +12306,6 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
   else if (attr->form == DW_FORM_ref_sig8)
     {
       struct signatured_type *sig_type = DW_SIGNATURED_TYPE (attr);
-      struct dwarf2_cu *sig_cu;
       sect_offset offset;
 
       /* sig_type will be NULL if the signatured type is missing from
@@ -16821,8 +16812,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,
@@ -17001,7 +16990,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 117e674..3cf1d24 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -610,7 +610,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;
@@ -649,7 +648,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..2d3f758 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -264,10 +264,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	     const struct value_print_options *options)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
-  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/features/arm-with-m-fpa-layout.c b/gdb/features/arm-with-m-fpa-layout.c
index ad9b75d..6531c3d 100644
--- a/gdb/features/arm-with-m-fpa-layout.c
+++ b/gdb/features/arm-with-m-fpa-layout.c
@@ -10,7 +10,6 @@ initialize_tdesc_arm_with_m_fpa_layout (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arm.m-profile");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
diff --git a/gdb/features/arm-with-m.c b/gdb/features/arm-with-m.c
index b188f57..2ac3df9 100644
--- a/gdb/features/arm-with-m.c
+++ b/gdb/features/arm-with-m.c
@@ -10,7 +10,6 @@ initialize_tdesc_arm_with_m (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arm.m-profile");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
diff --git a/gdb/features/arm-with-neon.c b/gdb/features/arm-with-neon.c
index c1eeb0b..d7df4e9 100644
--- a/gdb/features/arm-with-neon.c
+++ b/gdb/features/arm-with-neon.c
@@ -10,7 +10,6 @@ initialize_tdesc_arm_with_neon (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arm.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/arm-with-vfpv2.c b/gdb/features/arm-with-vfpv2.c
index ad872f8..7b014cd 100644
--- a/gdb/features/arm-with-vfpv2.c
+++ b/gdb/features/arm-with-vfpv2.c
@@ -10,7 +10,6 @@ initialize_tdesc_arm_with_vfpv2 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arm.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/arm-with-vfpv3.c b/gdb/features/arm-with-vfpv3.c
index 2d5b5a8..f66524c 100644
--- a/gdb/features/arm-with-vfpv3.c
+++ b/gdb/features/arm-with-vfpv3.c
@@ -10,7 +10,6 @@ initialize_tdesc_arm_with_vfpv3 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.arm.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/i386/i386-mmx-linux.c b/gdb/features/i386/i386-mmx-linux.c
index 364ade4..872826a 100644
--- a/gdb/features/i386/i386-mmx-linux.c
+++ b/gdb/features/i386/i386-mmx-linux.c
@@ -10,7 +10,7 @@ initialize_tdesc_i386_mmx_linux (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
+  struct tdesc_type *field_type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("i386"));
 
diff --git a/gdb/features/rs6000/powerpc-32.c b/gdb/features/rs6000/powerpc-32.c
index 1f503cd..1a1bdaa 100644
--- a/gdb/features/rs6000/powerpc-32.c
+++ b/gdb/features/rs6000/powerpc-32.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_32 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
 
diff --git a/gdb/features/rs6000/powerpc-32l.c b/gdb/features/rs6000/powerpc-32l.c
index c954200..d562189 100644
--- a/gdb/features/rs6000/powerpc-32l.c
+++ b/gdb/features/rs6000/powerpc-32l.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_32l (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
 
diff --git a/gdb/features/rs6000/powerpc-403.c b/gdb/features/rs6000/powerpc-403.c
index 5260450..990ed76 100644
--- a/gdb/features/rs6000/powerpc-403.c
+++ b/gdb/features/rs6000/powerpc-403.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_403 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-403gc.c b/gdb/features/rs6000/powerpc-403gc.c
index 1b51b9a..315b9ff 100644
--- a/gdb/features/rs6000/powerpc-403gc.c
+++ b/gdb/features/rs6000/powerpc-403gc.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_403gc (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-405.c b/gdb/features/rs6000/powerpc-405.c
index 7a6e476..3330535 100644
--- a/gdb/features/rs6000/powerpc-405.c
+++ b/gdb/features/rs6000/powerpc-405.c
@@ -10,7 +10,6 @@ initialize_tdesc_powerpc_405 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-505.c b/gdb/features/rs6000/powerpc-505.c
index bb4fafb..4974505 100644
--- a/gdb/features/rs6000/powerpc-505.c
+++ b/gdb/features/rs6000/powerpc-505.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_505 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-601.c b/gdb/features/rs6000/powerpc-601.c
index 7a68315..7d7e440 100644
--- a/gdb/features/rs6000/powerpc-601.c
+++ b/gdb/features/rs6000/powerpc-601.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_601 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
diff --git a/gdb/features/rs6000/powerpc-602.c b/gdb/features/rs6000/powerpc-602.c
index e4dfe88..c71e45a 100644
--- a/gdb/features/rs6000/powerpc-602.c
+++ b/gdb/features/rs6000/powerpc-602.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_602 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-603.c b/gdb/features/rs6000/powerpc-603.c
index 10c13d6..e2e3275 100644
--- a/gdb/features/rs6000/powerpc-603.c
+++ b/gdb/features/rs6000/powerpc-603.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_603 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-604.c b/gdb/features/rs6000/powerpc-604.c
index 5623277..24f2f14 100644
--- a/gdb/features/rs6000/powerpc-604.c
+++ b/gdb/features/rs6000/powerpc-604.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_604 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-64.c b/gdb/features/rs6000/powerpc-64.c
index 05b80a4..826af38 100644
--- a/gdb/features/rs6000/powerpc-64.c
+++ b/gdb/features/rs6000/powerpc-64.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_64 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
 
diff --git a/gdb/features/rs6000/powerpc-64l.c b/gdb/features/rs6000/powerpc-64l.c
index 58e8476..7b83a70 100644
--- a/gdb/features/rs6000/powerpc-64l.c
+++ b/gdb/features/rs6000/powerpc-64l.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_64l (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
 
diff --git a/gdb/features/rs6000/powerpc-750.c b/gdb/features/rs6000/powerpc-750.c
index 60d671f..8af9e80 100644
--- a/gdb/features/rs6000/powerpc-750.c
+++ b/gdb/features/rs6000/powerpc-750.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_750 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-860.c b/gdb/features/rs6000/powerpc-860.c
index 189062a..c259397 100644
--- a/gdb/features/rs6000/powerpc-860.c
+++ b/gdb/features/rs6000/powerpc-860.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_860 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.power.core");
   tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32");
diff --git a/gdb/features/rs6000/powerpc-e500.c b/gdb/features/rs6000/powerpc-e500.c
index 28235ba..db54f6a 100644
--- a/gdb/features/rs6000/powerpc-e500.c
+++ b/gdb/features/rs6000/powerpc-e500.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_e500 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:e500"));
 
diff --git a/gdb/features/rs6000/powerpc-e500l.c b/gdb/features/rs6000/powerpc-e500l.c
index d5facd4..479578c 100644
--- a/gdb/features/rs6000/powerpc-e500l.c
+++ b/gdb/features/rs6000/powerpc-e500l.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_e500l (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:e500"));
 
diff --git a/gdb/features/rs6000/powerpc-isa205-32l.c b/gdb/features/rs6000/powerpc-isa205-32l.c
index 1cbbab9..5d1006c 100644
--- a/gdb/features/rs6000/powerpc-isa205-32l.c
+++ b/gdb/features/rs6000/powerpc-isa205-32l.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_isa205_32l (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common"));
 
diff --git a/gdb/features/rs6000/powerpc-isa205-64l.c b/gdb/features/rs6000/powerpc-isa205-64l.c
index 9b7e01b..c0a851d 100644
--- a/gdb/features/rs6000/powerpc-isa205-64l.c
+++ b/gdb/features/rs6000/powerpc-isa205-64l.c
@@ -9,7 +9,6 @@ initialize_tdesc_powerpc_isa205_64l (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64"));
 
diff --git a/gdb/features/rs6000/rs6000.c b/gdb/features/rs6000/rs6000.c
index e499d16..9793059 100644
--- a/gdb/features/rs6000/rs6000.c
+++ b/gdb/features/rs6000/rs6000.c
@@ -9,7 +9,6 @@ initialize_tdesc_rs6000 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("rs6000:6000"));
 
diff --git a/gdb/features/s390-linux32.c b/gdb/features/s390-linux32.c
index 0c5069f..57ade3b 100644
--- a/gdb/features/s390-linux32.c
+++ b/gdb/features/s390-linux32.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux32 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390-linux32v1.c b/gdb/features/s390-linux32v1.c
index d04641d..f1637cb 100644
--- a/gdb/features/s390-linux32v1.c
+++ b/gdb/features/s390-linux32v1.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux32v1 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390-linux32v2.c b/gdb/features/s390-linux32v2.c
index 76620f0..75db548 100644
--- a/gdb/features/s390-linux32v2.c
+++ b/gdb/features/s390-linux32v2.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux32v2 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390-linux64.c b/gdb/features/s390-linux64.c
index b8c4b16..bd6972e 100644
--- a/gdb/features/s390-linux64.c
+++ b/gdb/features/s390-linux64.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux64 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390-linux64v1.c b/gdb/features/s390-linux64v1.c
index 0e6865f..4936a7f 100644
--- a/gdb/features/s390-linux64v1.c
+++ b/gdb/features/s390-linux64v1.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux64v1 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390-linux64v2.c b/gdb/features/s390-linux64v2.c
index 13a6587..955b635 100644
--- a/gdb/features/s390-linux64v2.c
+++ b/gdb/features/s390-linux64v2.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390_linux64v2 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
 
diff --git a/gdb/features/s390x-linux64.c b/gdb/features/s390x-linux64.c
index 9f95619..9cb8958 100644
--- a/gdb/features/s390x-linux64.c
+++ b/gdb/features/s390x-linux64.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390x_linux64 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit"));
 
diff --git a/gdb/features/s390x-linux64v1.c b/gdb/features/s390x-linux64v1.c
index b838c34..c41ff76 100644
--- a/gdb/features/s390x-linux64v1.c
+++ b/gdb/features/s390x-linux64v1.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390x_linux64v1 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit"));
 
diff --git a/gdb/features/s390x-linux64v2.c b/gdb/features/s390x-linux64v2.c
index 90a25d8..fb93d68 100644
--- a/gdb/features/s390x-linux64v2.c
+++ b/gdb/features/s390x-linux64v2.c
@@ -10,7 +10,6 @@ initialize_tdesc_s390x_linux64v2 (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit"));
 
diff --git a/gdb/features/tic6x-c62x-linux.c b/gdb/features/tic6x-c62x-linux.c
index df82fc2..288309f 100644
--- a/gdb/features/tic6x-c62x-linux.c
+++ b/gdb/features/tic6x-c62x-linux.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c62x_linux (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/features/tic6x-c62x.c b/gdb/features/tic6x-c62x.c
index 6e3a9c8..0a2f958 100644
--- a/gdb/features/tic6x-c62x.c
+++ b/gdb/features/tic6x-c62x.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c62x (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/features/tic6x-c64x-linux.c b/gdb/features/tic6x-c64x-linux.c
index 39f9e95..59e1ced 100644
--- a/gdb/features/tic6x-c64x-linux.c
+++ b/gdb/features/tic6x-c64x-linux.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c64x_linux (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/features/tic6x-c64x.c b/gdb/features/tic6x-c64x.c
index 90f1785..f0fcdce 100644
--- a/gdb/features/tic6x-c64x.c
+++ b/gdb/features/tic6x-c64x.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c64x (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/features/tic6x-c64xp-linux.c b/gdb/features/tic6x-c64xp-linux.c
index a959ec6..927f8da 100644
--- a/gdb/features/tic6x-c64xp-linux.c
+++ b/gdb/features/tic6x-c64xp-linux.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c64xp_linux (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/features/tic6x-c64xp.c b/gdb/features/tic6x-c64xp.c
index 90cacb9..cd4de3a 100644
--- a/gdb/features/tic6x-c64xp.c
+++ b/gdb/features/tic6x-c64xp.c
@@ -10,7 +10,6 @@ initialize_tdesc_tic6x_c64xp (void)
 {
   struct target_desc *result = allocate_target_description ();
   struct tdesc_feature *feature;
-  struct tdesc_type *field_type, *type;
 
   set_tdesc_architecture (result, bfd_scan_arch ("tic6x"));
 
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index dd41883..7028d56 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -262,7 +262,6 @@ frv_linux_sigtramp_frame_cache (struct frame_info *this_frame,
 				void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct trad_frame_cache *cache;
   CORE_ADDR addr;
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/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index ed94b84..6e45c33 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -798,7 +798,6 @@ compute_vtable_size (htab_t offset_hash,
   struct type *type = check_typedef (value_type (value));
   void **slot;
   struct value_and_voffset search_vo, *current_vo;
-  CORE_ADDR addr = value_address (value) + value_embedded_offset (value);
 
   /* If the object is not dynamic, then we are done; as it cannot have
      dynamic base types either.  */
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index aa056f9..b2a277f 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -238,8 +238,6 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
 	}
       else if (IS_MOVL_EXT (w2))
 	{
-	  int w3 = read_memory_integer (pc + 4, 2, byte_order);
-
 	  if (IS_MOVL_Rn24_SP (read_memory_integer (pc + 4, 2, byte_order)))
 	    {
 	      LONGEST disp = read_memory_integer (pc + 6, 4, byte_order);
@@ -430,7 +428,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 +780,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)
     {
@@ -938,8 +935,6 @@ h8300h_return_value (struct gdbarch *gdbarch, struct type *func_type,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static struct cmd_list_element *setmachinelist;
-
 static const char *
 h8300_register_name (struct gdbarch *gdbarch, int regno)
 {
@@ -1215,17 +1210,12 @@ No floating-point info available for this processor.\n");
 static struct gdbarch *
 h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
-  struct gdbarch_tdep *tdep = NULL;
   struct gdbarch *gdbarch;
 
   arches = gdbarch_list_lookup_by_info (arches, &info);
   if (arches != NULL)
     return arches->gdbarch;
 
-#if 0
-  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
-#endif
-
   if (info.bfd_arch_info->arch != bfd_arch_h8300)
     return NULL;
 
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..d459549 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)
@@ -698,10 +697,6 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Stack base address at which the first parameter is stored.  */
   CORE_ADDR param_end = 0;
 
-  /* The inner most end of the stack after all the parameters have
-     been pushed.  */
-  CORE_ADDR new_sp = 0;
-
   /* Two passes.  First pass computes the location of everything,
      second pass writes the bytes out.  */
   int write_pass;
@@ -1698,7 +1693,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 +1732,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 +1784,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;
@@ -2192,7 +2182,6 @@ hppa_frame_this_id (struct frame_info *this_frame, void **this_cache,
 		    struct frame_id *this_id)
 {
   struct hppa_frame_cache *info;
-  CORE_ADDR pc = get_frame_pc (this_frame);
   struct unwind_table_entry *u;
 
   info = hppa_frame_cache (this_frame, this_cache);
@@ -2782,18 +2771,6 @@ static struct insn_pattern hppa_plt_stub[] = {
   { 0, 0 }
 };
 
-static struct insn_pattern hppa_sigtramp[] = {
-  /* ldi 0, %r25 or ldi 1, %r25 */
-  { 0x34190000, 0xfffffffd },
-  /* ldi __NR_rt_sigreturn, %r20 */
-  { 0x3414015a, 0xffffffff },
-  /* be,l 0x100(%sr2, %r0), %sr0, %r31 */
-  { 0xe4008200, 0xffffffff },
-  /* nop */
-  { 0x08000240, 0xffffffff },
-  { 0, 0 }
-};
-
 /* Maximum number of instructions on the patterns above.  */
 #define HPPA_MAX_INSN_PATTERN_LEN	4
 
@@ -3145,8 +3122,6 @@ extern initialize_file_ftype _initialize_hppa_tdep;
 void
 _initialize_hppa_tdep (void)
 {
-  struct cmd_list_element *c;
-
   gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
 
   hppa_objfile_priv_data = register_objfile_data ();
diff --git a/gdb/hppanbsd-tdep.c b/gdb/hppanbsd-tdep.c
index f563289..4f7f401 100644
--- a/gdb/hppanbsd-tdep.c
+++ b/gdb/hppanbsd-tdep.c
@@ -104,8 +104,6 @@ hppanbsd_sigtramp_cache_init (const struct tramp_frame *self,
                              struct trad_frame_cache *this_cache,
                              CORE_ADDR func)
 {
-  struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   CORE_ADDR sp = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
   CORE_ADDR base;
   int *reg_offset;
@@ -169,7 +167,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/hppaobsd-tdep.c b/gdb/hppaobsd-tdep.c
index 0b6572a..8e0db1a 100644
--- a/gdb/hppaobsd-tdep.c
+++ b/gdb/hppaobsd-tdep.c
@@ -74,7 +74,6 @@ hppaobsd_supply_fpregset (const struct regset *regset,
 			  struct regcache *regcache,
 			  int regnum, const void *fpregs, size_t len)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   const gdb_byte *regs = fpregs;
   int i;
 
diff --git a/gdb/i386-dicos-tdep.c b/gdb/i386-dicos-tdep.c
index 8039c90..16e8223 100644
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -43,8 +43,6 @@ i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
 static void
 i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   dicos_init_abi (gdbarch);
 
   set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
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 d18aa99..7f7d427 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1190,7 +1190,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/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c
index 2eb5553..cef2607 100644
--- a/gdb/i386nbsd-tdep.c
+++ b/gdb/i386nbsd-tdep.c
@@ -233,7 +233,6 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
 			      CORE_ADDR func)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
   CORE_ADDR base;
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 9005304..b06cd45 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -492,8 +492,6 @@ i386obsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 static void
 i386obsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   /* It's still OpenBSD.  */
   i386obsd_init_abi (info, gdbarch);
 
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..c564869 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -127,8 +127,6 @@ static CORE_ADDR ia64_find_global_pointer (struct gdbarch *gdbarch,
 #define NUM_IA64_RAW_REGS 462
 
 static int sp_regnum = IA64_GR12_REGNUM;
-static int fp_regnum = IA64_VFP_REGNUM;
-static int lr_regnum = IA64_VRAP_REGNUM;
 
 /* NOTE: we treat the register stack registers r32-r127 as
    pseudo-registers because they may not be accessible via the ptrace
@@ -1041,7 +1039,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 +1057,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 +1094,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);
 
@@ -1403,7 +1398,6 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
       && it == M && ((instr & 0x1ee0000003fLL) == 0x02c00000000LL))
     {
       /* alloc - start of a regular function.  */
-      int sor = (int) ((instr & 0x00078000000LL) >> 27);
       int sol = (int) ((instr & 0x00007f00000LL) >> 20);
       int sof = (int) ((instr & 0x000000fe000LL) >> 13);
       int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
@@ -1854,8 +1848,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 +2235,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;
@@ -3729,7 +3720,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int nslots, rseslots, memslots, slotnum, nfuncargs;
   int floatreg;
   ULONGEST bsp;
-  CORE_ADDR funcdescaddr, pc, global_pointer;
+  CORE_ADDR funcdescaddr, global_pointer;
   CORE_ADDR func_addr = find_function_addr (function, NULL);
 
   nslots = 0;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 6a841e5..dc61a1c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1421,7 +1421,6 @@ get_return_value (struct type *func_type, struct type *value_type)
   struct regcache *stop_regs = stop_registers;
   struct gdbarch *gdbarch;
   struct value *value;
-  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
 
   /* If stop_registers were not saved, use the current registers.  */
diff --git a/gdb/jit.c b/gdb/jit.c
index 24ab016..520abfb 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;
@@ -903,9 +900,7 @@ static void
 jit_register_code (struct gdbarch *gdbarch,
                    CORE_ADDR entry_addr, struct jit_code_entry *code_entry)
 {
-  int i, success;
-  const struct bfd_arch_info *b;
-  struct jit_inferior_data *inf_data = get_jit_inferior_data ();
+  int success;
 
   if (jit_debug)
     fprintf_unfiltered (gdb_stdlog,
@@ -935,7 +930,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 +1089,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 +1230,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/jv-valprint.c b/gdb/jv-valprint.c
index 12a960f..f93bdec 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -488,7 +488,6 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
 		const struct value_print_options *options)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
-  unsigned int i = 0;	/* Number of characters printed.  */
   struct type *target_type;
   CORE_ADDR addr;
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 7cbf1bf..b61533a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1048,7 +1048,6 @@ find_methods (struct type *t, const char *name,
 	      VEC (const_char_ptr) **result_names,
 	      VEC (typep) **superclasses)
 {
-  int i1 = 0;
   int ibase;
   const char *class_name = type_name_no_tag (t);
 
@@ -1058,7 +1057,6 @@ find_methods (struct type *t, const char *name,
   if (class_name)
     {
       int method_counter;
-      int name_len = strlen (name);
 
       CHECK_TYPEDEF (t);
 
@@ -2671,7 +2669,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 +3383,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-nat.c b/gdb/linux-nat.c
index ac1a0ea..5e026bf 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -5089,8 +5089,6 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
 {
   if (!lwp->stopped)
     {
-      ptid_t ptid = lwp->ptid;
-
       if (debug_linux_nat)
 	fprintf_unfiltered (gdb_stdlog,
 			    "LNSL: running -> suspending %s\n",
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/linux-thread-db.c b/gdb/linux-thread-db.c
index f78f662..7ff12be 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1614,7 +1614,6 @@ thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
 {
   td_err_e err;
   struct thread_db_info *info;
-  int pid = ptid_get_pid (ptid);
   int i, loop;
 
   info = get_thread_db_info (GET_PID (ptid));
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..995d76a 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -309,12 +309,10 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	      const struct value *original_value,
 	      const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
   unsigned int i = 0;	/* Number of characters printed.  */
   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..4314038 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -699,15 +699,6 @@ mark_general (struct m32c_reg *reg)
 }
 
 
-/* Mark REG as a DMA register, and return it.  */
-static struct m32c_reg *
-mark_dma (struct m32c_reg *reg)
-{
-  reg->dma_p = 1;
-  return reg;
-}
-
-
 /* Mark REG as a SYSTEM register, and return it.  */
 static struct m32c_reg *
 mark_system (struct m32c_reg *reg)
@@ -801,7 +792,6 @@ mark_save_restore (struct m32c_reg *reg)
 /* Abbreviations for marking register group membership.  */
 #define G(reg)   (mark_general (reg))
 #define S(reg)   (mark_system  (reg))
-#define DMA(reg) (mark_dma     (reg))
 
 
 /* Construct the register set for ARCH.  */
@@ -852,20 +842,6 @@ make_regs (struct gdbarch *arch)
   struct m32c_reg *pc          = G (RC (pc));
   struct m32c_reg *flg         = G (R16U (flg));
 
-  if (mach == bfd_mach_m32c)
-    {
-      struct m32c_reg *svf     = S (R16U (svf));
-      struct m32c_reg *svp     = S (RC (svp));
-      struct m32c_reg *vct     = S (RC (vct));
-
-      struct m32c_reg *dmd01   = DMA (RP (dmd, tdep->uint8));
-      struct m32c_reg *dct01   = DMA (RP (dct, tdep->uint16));
-      struct m32c_reg *drc01   = DMA (RP (drc, tdep->uint16));
-      struct m32c_reg *dma01   = DMA (RP (dma, tdep->data_addr_reg_type));
-      struct m32c_reg *dsa01   = DMA (RP (dsa, tdep->data_addr_reg_type));
-      struct m32c_reg *dra01   = DMA (RP (dra, tdep->data_addr_reg_type));
-    }
-
   num_raw_regs = tdep->num_regs;
 
   r0 	      = G (CB (r0, raw_r0_pair));
@@ -1940,7 +1916,6 @@ m32c_prev_register (struct frame_info *this_frame,
   struct m32c_prologue *p
     = m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
   CORE_ADDR frame_base = m32c_frame_base (this_frame, this_prologue_cache);
-  int reg_size = register_size (get_frame_arch (this_frame), regnum);
 
   if (regnum == tdep->sp->num)
     return frame_unwind_got_constant (this_frame, regnum, frame_base);
@@ -2587,7 +2562,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-linux-tdep.c b/gdb/m32r-linux-tdep.c
index dce1a88..7bc7e0c 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -396,7 +396,6 @@ static const struct regset *
 m32r_linux_regset_from_core_section (struct gdbarch *core_arch,
 				     const char *sect_name, size_t sect_size)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch);
   if (strcmp (sect_name, ".reg") == 0)
     return &m32r_linux_gregset;
   return NULL;
@@ -405,8 +404,6 @@ m32r_linux_regset_from_core_section (struct gdbarch *core_arch,
 static void
 m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   linux_init_abi (info, gdbarch);
 
   /* Since EVB register is not available for native debug, we reduce
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..aa28185 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);
@@ -264,7 +263,6 @@ m68k_linux_sigtramp_frame_cache (struct frame_info *this_frame,
   struct frame_id this_id;
   struct trad_frame_cache *cache;
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct m68k_linux_sigtramp_info info;
   gdb_byte buf[4];
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index fea14bf..1b57787 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -929,8 +929,6 @@ current_ccr_names (void)
 static const char *
 mep_register_name (struct gdbarch *gdbarch, int regnr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);  
-
   /* General-purpose registers.  */
   static const char *gpr_names[] = {
     "r0",   "r1",   "r2",   "r3",   /* 0 */
@@ -1686,7 +1684,6 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
   CORE_ADDR pc;
   unsigned long insn;
   int rn;
-  int found_lp = 0;
   pv_t reg[MEP_NUM_REGS];
   struct pv_area *stack;
   struct cleanup *back_to;
@@ -2304,7 +2301,6 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR *copy = (CORE_ADDR *) alloca (argc * sizeof (copy[0]));
-  CORE_ADDR func_addr = find_function_addr (function, NULL);
   int i;
 
   /* The number of the next register available to hold an argument.  */
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 94e580f..5af8b41 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-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 6935ba5..3b45489 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -72,8 +72,6 @@ microblaze_linux_sigtramp_cache (struct frame_info *next_frame,
   CORE_ADDR base;
   CORE_ADDR gpregs;
   int regnum;
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   base = frame_unwind_register_unsigned (next_frame, MICROBLAZE_SP_REGNUM);
   if (bias > 0 && get_frame_address_in_block (next_frame) != func)
@@ -121,8 +119,6 @@ static void
 microblaze_linux_init_abi (struct gdbarch_info info,
 			   struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   linux_init_abi (info, gdbarch);
 
   set_gdbarch_memory_remove_breakpoint (gdbarch,
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 74cdb3b..162418b 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -910,7 +910,6 @@ static struct type *
 mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 {
   const int num_regs = gdbarch_num_regs (gdbarch);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int rawnum = regnum % num_regs;
   struct type *rawtype;
 
@@ -1515,7 +1514,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;
@@ -2962,7 +2960,6 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int argnum;
   int len = 0;
   int stack_offset = 0;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR func_addr = find_function_addr (function, NULL);
   int regsize = mips_abi_regsize (gdbarch);
@@ -3370,7 +3367,6 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int argnum;
   int len = 0;
   int stack_offset = 0;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR func_addr = find_function_addr (function, NULL);
 
@@ -3813,7 +3809,6 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int argnum;
   int len = 0;
   int stack_offset = 0;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR func_addr = find_function_addr (function, NULL);
 
@@ -4281,7 +4276,6 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   int argnum;
   int len = 0;
   int stack_offset = 0;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR func_addr = find_function_addr (function, NULL);
 
@@ -4525,8 +4519,6 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct type *func_type,
 		       struct type *type, struct regcache *regcache,
 		       gdb_byte *readbuf, const gdb_byte *writebuf)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT
       || TYPE_CODE (type) == TYPE_CODE_UNION
       || TYPE_CODE (type) == TYPE_CODE_ARRAY)
@@ -4764,7 +4756,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;
 
@@ -5501,7 +5492,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;
 
@@ -5555,7 +5546,6 @@ mips_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
     }
   else
     {
-      struct minimal_symbol *sym;
       CORE_ADDR addr, jmpaddr;
       int i;
 
@@ -6833,7 +6823,6 @@ void
 _initialize_mips_tdep (void)
 {
   static struct cmd_list_element *mipsfpulist = NULL;
-  struct cmd_list_element *c;
 
   mips_abi_string = mips_abi_strings[MIPS_ABI_UNKNOWN];
   if (MIPS_ABI_LAST + 1
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 116a03e..c6b953d 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;
@@ -1151,11 +1151,9 @@ static struct value *
 mn10300_frame_prev_register (struct frame_info *this_frame,
 		             void **this_prologue_cache, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
   struct mn10300_prologue *p
     = mn10300_analyze_frame_prologue (this_frame, this_prologue_cache);
   CORE_ADDR frame_base = mn10300_frame_base (this_frame, this_prologue_cache);
-  int reg_size = register_size (get_frame_arch (this_frame), regnum);
 
   if (regnum == E_SP_REGNUM)
     return frame_unwind_got_constant (this_frame, regnum, frame_base);
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 15bf792..428b4c5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1151,8 +1151,6 @@ find_methods (char type, const char *class, const char *category,
 
       ALL_OBJFILE_MSYMBOLS (objfile, msymbol)
 	{
-	  struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
 	  QUIT;
 
 	  /* Check the symbol name first as this can be done entirely without
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index e29b3a7..52c8845 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1164,9 +1164,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;
 
@@ -1179,10 +1176,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/observer.sh b/gdb/observer.sh
index b5c49ac..2ff8b64 100755
--- a/gdb/observer.sh
+++ b/gdb/observer.sh
@@ -136,8 +136,17 @@ static void
 observer_${event}_notification_stub (const void *data, const void *args_data)
 {
   observer_${event}_ftype *notify = (observer_${event}_ftype *) data;
+EOF
+
+	notify_args=`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`
+
+	if test ! -z ${notify_args}; then
+	    cat<<EOF >>${otmp}
   const struct ${event}_args *args = args_data;
-  notify (`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`);
+EOF
+	fi
+	cat <<EOF >>${otmp}
+  notify (${notify_args});
 }
 
 struct observer *
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 32a3bd6..37ca467 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1310,7 +1310,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 b94dea2..297c9af 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -631,7 +631,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..df584a3 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -154,7 +154,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
   static char *keywords[] = { "frame", "internal", NULL };
   struct finish_breakpoint_object *self_bpfinish =
       (struct finish_breakpoint_object *) self;
-  int type = bp_breakpoint;
   PyObject *frame_obj = NULL;
   int thread;
   struct frame_info *frame, *prev_frame = NULL;
@@ -313,7 +312,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;
 
@@ -336,7 +334,6 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
   volatile struct gdb_exception except;
   struct breakpoint *bp_stopped = (struct breakpoint *) args;
   PyObject *py_bp = (PyObject *) b->py_bp_object;
-  struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
   
   /* Trigger out_of_scope if this is a FinishBreakpoint and its frame is
      not anymore in the current callstack.  */
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..4438dab 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);
 
@@ -1148,9 +1146,6 @@ extern initialize_file_ftype _initialize_python;
 void
 _initialize_python (void)
 {
-  char *cmd_name;
-  struct cmd_list_element *cmd;
-
   add_com ("python", class_obscure, python_command,
 #ifdef HAVE_PYTHON
 	   _("\
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c716280..592bbad 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -707,8 +707,6 @@ regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
     {
       /* Read-only register cache, perhaps the cooked value was
 	 cached?  */
-      struct gdbarch *gdbarch = regcache->descr->gdbarch;
-
       if (regcache->register_status[regnum] == REG_VALID)
 	memcpy (buf, register_buffer (regcache, regnum),
 		regcache->descr->sizeof_register[regnum]);
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..612c78e 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;
 
@@ -362,12 +360,8 @@ m32r_create_inferior (struct target_ops *ops, char *execfile,
 static void
 m32r_open (char *args, int from_tty)
 {
-  struct hostent *host_ent;
-  struct sockaddr_in server_addr;
   char *port_str, hostname[256];
-  int port;
-  int i, n;
-  int yes = 1;
+  int i;
 
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_open(%d)\n", from_tty);
@@ -707,7 +701,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 +1218,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..858b4fa 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;
@@ -2010,7 +2008,6 @@ mips_fetch_registers (struct target_ops *ops,
 		      struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST val;
   int err;
 
@@ -3270,8 +3267,6 @@ pmon_check_total (int bintotal)
 static void
 pmon_end_download (int final, int bintotal)
 {
-  char hexnumber[9];		/* Includes '\0' space.  */
-
   if (tftp_in_use)
     {
       static char *load_cmd_prefix = "load -b -s ";
diff --git a/gdb/remote.c b/gdb/remote.c
index 68864d1..a13bed8 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3367,10 +3367,6 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
 
   if (!non_stop)
     {
-      ptid_t ptid;
-      int fake_pid_p = 0;
-      struct inferior *inf;
-
       if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
 	{
 	  if (!extended_p)
@@ -7821,8 +7817,6 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
 {
   struct agent_expr *aexpr = NULL;
   int i, ix;
-  char *pkt;
-  char *buf_start = buf;
 
   if (VEC_empty (agent_expr_p, bp_tgt->conditions))
     return 0;
@@ -7866,7 +7860,6 @@ remote_insert_breakpoint (struct gdbarch *gdbarch,
       struct remote_state *rs;
       char *p, *endbuf;
       int bpsize;
-      struct condition_list *cond = NULL;
 
       gdbarch_remote_breakpoint_from_pc (gdbarch, &addr, &bpsize);
 
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..baf4b5d 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -296,8 +296,6 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       else
 	{
 	  /* Argument can fit in one register.  No problem.  */
-	  int adj = gdbarch_byte_order (gdbarch)
-		    == BFD_ENDIAN_BIG ? reg_size - len : 0;
 	  gdb_byte word[MAX_REGISTER_SIZE];
 
 	  memset (word, 0, reg_size);
@@ -430,7 +428,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..a6050bb 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1095,7 +1095,6 @@ ppc_deal_with_atomic_sequence (struct frame_info *frame)
   int index;
   int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed).  */  
   const int atomic_sequence_length = 16; /* Instruction sequence length.  */
-  int opcode; /* Branch instruction's OPcode.  */
   int bc_insn_count = 0; /* Conditional branch instruction count.  */
 
   /* Assume all atomic sequences start with a lwarx/ldarx instruction.  */
@@ -3552,7 +3551,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;
@@ -3652,10 +3650,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 	"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
 	"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
       };
-      static const char *const segment_regs[] = {
-	"sr0", "sr1", "sr2", "sr3", "sr4", "sr5", "sr6", "sr7",
-	"sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15"
-      };
       const struct tdesc_feature *feature;
       int i, valid_p;
       static const char *const msr_names[] = { "msr", "ps" };
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 95d9e3d..b25f68a 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -436,7 +436,6 @@ rx_frame_prev_register (struct frame_info *this_frame,
   struct rx_prologue *p
     = rx_analyze_frame_prologue (this_frame, this_prologue_cache);
   CORE_ADDR frame_base = rx_frame_base (this_frame, this_prologue_cache);
-  int reg_size = register_size (get_frame_arch (this_frame), regnum);
 
   if (regnum == RX_SP_REGNUM)
     return frame_unwind_got_constant (this_frame, regnum, frame_base);
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index ac0c526..5e503f2 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1160,7 +1160,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
@@ -2024,7 +2023,6 @@ static struct value *
 s390_frame_prev_register (struct frame_info *this_frame,
 			  void **this_prologue_cache, int regnum)
 {
-  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct s390_unwind_cache *info
     = s390_frame_unwind_cache (this_frame, this_prologue_cache);
 
@@ -2346,8 +2344,6 @@ s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
                             struct dwarf2_frame_state_reg *reg,
 			    struct frame_info *this_frame)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   /* The condition code (and thus PSW mask) is call-clobbered.  */
   if (regnum == S390_PSWM_REGNUM)
     reg->how = DWARF2_FRAME_REG_UNDEFINED;
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 90ef610..9d3437f 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'},
@@ -1179,7 +1178,6 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
               /* addi! r2, offset */
               if (pc - cur_pc >= 2)
                 {
-		  unsigned int save_v = inst->v;
 		  inst_t *inst2;
 		  
 		  cur_pc += inst->len;
@@ -1265,7 +1263,6 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
               /* addi r2, offset */
               if (pc - cur_pc >= 2)
                 {
-		  unsigned int save_v = inst->v;
 		  inst_t *inst2;
 		  
 		  cur_pc += inst->len;
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 7f15191..38ffc34 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1034,8 +1034,6 @@ sh_next_flt_argreg (struct gdbarch *gdbarch, int len, struct type *func_type)
 static int
 sh_treat_as_flt_p (struct type *type)
 {
-  int len = TYPE_LENGTH (type);
-
   /* Ordinary float types are obviously treated as float.  */
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     return 1;
@@ -1309,8 +1307,6 @@ sh_extract_return_value_nofpu (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);
-  int return_register = R0_REGNUM;
-  int offset;
 
   if (len <= 4)
     {
@@ -1715,8 +1711,6 @@ sh2a_show_regs (struct frame_info *frame)
 static void
 sh2a_nofpu_show_regs (struct frame_info *frame)
 {
-  int pr = get_frame_register_unsigned (frame, FPSCR_REGNUM) & 0x80000;
-
   printf_filtered
     ("      PC %s       SR %08lx       PR %08lx     MACH %08lx\n",
      phex (get_frame_register_unsigned (frame,
@@ -3158,8 +3152,6 @@ extern initialize_file_ftype _initialize_sh_tdep;  /* -Wmissing-prototypes */
 void
 _initialize_sh_tdep (void)
 {
-  struct cmd_list_element *c;
-
   gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
 
   add_com ("regs", class_vars, sh_show_regs_command, _("Print all registers"));
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 2e5d8bd..71349f5 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -858,15 +858,11 @@ sh64_analyze_prologue (struct gdbarch *gdbarch,
 		       CORE_ADDR func_pc,
 		       CORE_ADDR current_pc)
 {
-  int reg_nr;
   int pc;
   int opc;
   int insn;
   int r0_val = 0;
   int insn_size;
-  int gdb_register_number;
-  int register_number;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   
   cache->sp_offset = 0;
@@ -1070,7 +1066,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];
@@ -1229,7 +1224,6 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache,
 			   void *valbuf)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
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..b3e53f2 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;
 
@@ -814,8 +814,6 @@ static int
 enable_break2 (void)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
-  int success = 0;
-  char **bkpt_namep;
   asection *interp_sect;
   struct dsbt_info *info = get_dsbt_info ();
 
@@ -841,8 +839,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 +1026,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..9a03df9 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -518,8 +518,6 @@ static int
 enable_break2 (void)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
-  int success = 0;
-  char **bkpt_namep;
   asection *interp_sect;
 
   if (enable_break2_done)
@@ -973,10 +971,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
   const char *name;
   CORE_ADDR addr;
   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/solib-svr4.c b/gdb/solib-svr4.c
index 69d3cb5..a38f7f5 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1175,7 +1175,6 @@ svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr,
 
   for (; lm != 0; prev_lm = lm, lm = next_lm)
     {
-      struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
       struct so_list *new;
       struct cleanup *old_chain;
       int errcode;
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 0f3f850..abc7e91 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -325,7 +325,6 @@ static void
 solib_target_relocate_section_addresses (struct so_list *so,
 					 struct target_section *sec)
 {
-  int flags = bfd_get_section_flags (sec->bfd, sec->the_bfd_section);
   CORE_ADDR offset;
 
   /* Build the offset table only once per object file.  We can not do
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 00bca01..7ba380c 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);
 
@@ -630,7 +629,6 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
 {
   CORE_ADDR pc = start_pc;
   unsigned long insn;
-  int offset_stack_checking_sequence = 0;
   int probing_loop = 0;
 
   /* With GCC, all stack checking sequences begin with the same two
diff --git a/gdb/sparcobsd-tdep.c b/gdb/sparcobsd-tdep.c
index a8824cd..2a130d1 100644
--- a/gdb/sparcobsd-tdep.c
+++ b/gdb/sparcobsd-tdep.c
@@ -236,8 +236,6 @@ sparc32obsd_collect_uthread(const struct regcache *regcache,
 static void
 sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   /* OpenBSD/sparc is very similar to NetBSD/sparc ELF.  */
   sparc32nbsd_elf_init_abi (info, gdbarch);
 
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..02fda38 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.  */
@@ -1781,8 +1781,6 @@ spu_get_overlay_table (struct objfile *objfile)
     {
       CORE_ADDR vma  = extract_unsigned_integer (ovly_table + 16*i + 0,
 						 4, byte_order);
-      CORE_ADDR size = extract_unsigned_integer (ovly_table + 16*i + 4,
-						 4, byte_order);
       CORE_ADDR pos  = extract_unsigned_integer (ovly_table + 16*i + 8,
 						 4, byte_order);
       CORE_ADDR buf  = extract_unsigned_integer (ovly_table + 16*i + 12,
@@ -1877,14 +1875,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 +2029,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 +2086,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 +2207,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 +2355,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 +2449,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 +2528,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..181ad76 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -499,12 +499,10 @@ 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");
-  /* True in "summary" mode, false otherwise.  */
-  int summary = !strcmp (print_frame_arguments, "scalars");
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index cbdaa25..9e9bd7f 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 af115cd..2bd9b1e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -154,7 +154,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;
@@ -194,7 +193,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);
@@ -281,7 +279,6 @@ iterate_over_symtabs (const char *name,
 				       void *data),
 		      void *data)
 {
-  struct symtab *s = NULL;
   struct objfile *objfile;
   char *real_path = NULL;
   char *full_path = NULL;
@@ -2437,8 +2434,7 @@ VEC (CORE_ADDR) *
 find_pcs_for_symtab_line (struct symtab *symtab, int line,
 			  struct linetable_entry **best_item)
 {
-  int start = 0, ix;
-  struct symbol *previous_function = NULL;
+  int start = 0;
   VEC (CORE_ADDR) *result = NULL;
 
   /* First, collect all the PCs that are at this line.  */
@@ -3255,7 +3251,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/thread.c b/gdb/thread.c
index 97f283c..98166f7 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1235,7 +1235,6 @@ thread_apply_command (char *tidlist, int from_tty)
     {
       struct thread_info *tp;
       int start;
-      char *p = tidlist;
 
       start = get_number_or_range (&state);
 
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 2dce8da..ff2c70c 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -152,7 +152,6 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
 			struct tic6x_unwind_cache *cache,
 			struct frame_info *this_frame)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned long inst;
   unsigned int src_reg, base_reg, dst_reg;
   int i;
@@ -176,8 +175,6 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
      2nd one is optional.  */
   while (pc < current_pc)
     {
-      int offset = 0;
-
       unsigned long inst = tic6x_fetch_instruction (gdbarch, pc);
 
       if ((inst & 0x1ffc) == 0x1dc0 || (inst & 0x1ffc) == 0x1bc0
@@ -301,7 +298,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 +401,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 +601,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;
 
@@ -906,10 +900,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 {
   int argreg = 0;
   int argnum;
-  int len = 0;
   int stack_offset = 4;
   int references_offset = 4;
-  CORE_ADDR func_addr = find_function_addr (function, NULL);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   struct type *func_type = value_type (function);
   /* The first arg passed on stack.  Mostly the first 10 args are passed by
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 86b6cfa..45b9582 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1716,8 +1716,6 @@ start_tracing (char *notes)
 
   for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
     {
-      struct tracepoint *t = (struct tracepoint *) b;
-
       if (b->enable_state == bp_enabled)
 	any_enabled = 1;
 
@@ -4389,9 +4387,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
@@ -4772,9 +4768,7 @@ static void
 print_one_static_tracepoint_marker (int count,
 				    struct static_tracepoint_marker *marker)
 {
-  struct command_line *l;
   struct symbol *sym;
-
   char wrap_indent[80];
   char extra_field_indent[80];
   struct ui_out *uiout = current_uiout;
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/valops.c b/gdb/valops.c
index ee450e3..07ee240 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2209,7 +2209,6 @@ search_struct_method (const char *name, struct value **arg1p,
   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
     {
       int base_offset;
-      int skip = 0;
       int this_offset;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 25b62bc..38be557 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -324,12 +324,10 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
 		   const struct generic_val_print_decorations *decorations)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   unsigned int i = 0;	/* Number of characters printed.  */
   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 eae3e2d..9fe3f6d 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/varobj.c b/gdb/varobj.c
index 3086499..0542479 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1965,7 +1965,6 @@ varobj_value_has_mutated (struct varobj *var, struct value *new_value,
 VEC(varobj_update_result) *
 varobj_update (struct varobj **varp, int explicit)
 {
-  int changed = 0;
   int type_changed = 0;
   int i;
   struct value *new;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 1a1b5de..41f8ef3 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -911,7 +911,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;
 
@@ -2202,7 +2201,6 @@ scan_xcoff_symtab (struct objfile *objfile)
   const char *filestring = NULL;
 
   const char *namestring;
-  int past_first_source_file = 0;
   bfd *abfd;
   asection *bfd_sect;
   unsigned int nsyms;
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 78d8888..3d1eb20 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);
@@ -2812,11 +2811,9 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
   int ilen, islots, is;
   xtensa_opcode opc;
   int insn_num = 0;
-  int fail = 0;
   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; 
@@ -3209,7 +3206,6 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
-  struct xtensa_abi_handler *abi_handler;
 
   DEBUGTRACE ("gdbarch_init()\n");
 
@@ -3305,8 +3301,6 @@ extern initialize_file_ftype _initialize_xtensa_tdep;
 void
 _initialize_xtensa_tdep (void)
 {
-  struct cmd_list_element *c;
-
   gdbarch_register (bfd_arch_xtensa, xtensa_gdbarch_init, xtensa_dump_tdep);
   xtensa_init_reggroups ();
 
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
@ 2012-04-24  3:33 ` Doug Evans
  2012-04-24 18:02   ` Sergio Durigan Junior
  2012-04-24 12:16 ` Pedro Alves
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-04-24  3:33 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

On Mon, Apr 23, 2012 at 3:51 PM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> Hi,
>
> This patch is a followup of the discussion in:
>
>    http://sourceware.org/ml/gdb/2012-04/msg00171.html
>
> First of all, I am sorry for the size of this patch, but I couldn't
> think of a good way of splitting it, and also I thought it would be
> useless since these changes are all logically related.
>
> I regtested the patch on a Fedora 16 x86{,_64}, without regressions.  I
> also built the patch using `--enable-targets=all --enable-plugins
> --enable-gold', and everything succeeded.
>
> I'd like to apply it, but I have a couple of questions before:
>
> a) How's the ChangeLog for this patch supposed to be?  Can I make a
> "generic" ChangeLog, saying something like `Remove unused variables from
> files'?
>
> b) I'd like someone to take a look at the `observer.sh' change, please.
>
> Thank you,

Hi.  Can we hold off these kinds of changes to dwarf2read.c?

ref: Fission patch set


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
  2012-04-24  3:33 ` Doug Evans
@ 2012-04-24 12:16 ` Pedro Alves
  2012-04-24 17:38   ` Jan Kratochvil
                     ` (2 more replies)
  2012-04-24 17:49 ` Tom Tromey
  2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
  3 siblings, 3 replies; 24+ messages in thread
From: Pedro Alves @ 2012-04-24 12:16 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

Hi Sérgio,

First off, thanks for doing this.

On 04/23/2012 11:51 PM, Sergio Durigan Junior wrote:

> Hi,
> 
> This patch is a followup of the discussion in:
> 
>     http://sourceware.org/ml/gdb/2012-04/msg00171.html
> 
> First of all, I am sorry for the size of this patch, but I couldn't
> think of a good way of splitting it, and also I thought it would be
> useless since these changes are all logically related.


It's not useless at all.  This warning points at two classes of problems:

 - variables that are no longer necessary, and can be garbage collected.
 - variables that actually should be being used, but they're not due to
   some latent bug.

I skimmed the patch, and noted several places, mostly in tdep code, where
you end up removing more than the unsuspecting auxiliary and obviously-left-
-behind-by-accident variable.  Some of those removed bits could well be latent
bugs.  Some hunks seem to remove used variables and expand what they were
initialized from at the used sites.  What's up with that?  Please give rationale
for any change that requires more than idle brain power to understand.  :-)

Splitting the patch e.g., by architecture (one for arm, one for x86, etc.)
should make it easier for the people in charge of those bits to take a proper
look.  There's no need to commit all this in one go.  Once you split,
some of the resulting patches will be dead obvious, and will end up
reviewed (if even necessary) and checked in quickly, and thus you end up
making progress faster that way.

> I regtested the patch on a Fedora 16 x86{,_64}, without regressions.  I
> also built the patch using `--enable-targets=all --enable-plugins
> --enable-gold', and everything succeeded.


"--enable-plugins --enable-gold" don't mean anything for GDB, AFAIK.

> 
> I'd like to apply it, but I have a couple of questions before:
> 
> a) How's the ChangeLog for this patch supposed to be?  Can I make a
> "generic" ChangeLog, saying something like `Remove unused variables from
> files'?
> 
> b) I'd like someone to take a look at the `observer.sh' change, please.


Please sent it as a separate patch, along with a rationale.
Also, the .c files under features/ are generated files.  We'll need to fix
the generator instead, again, best done as a separate patch.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 12:16 ` Pedro Alves
@ 2012-04-24 17:38   ` Jan Kratochvil
  2012-04-24 17:42   ` Tom Tromey
  2012-04-24 18:10   ` Sergio Durigan Junior
  2 siblings, 0 replies; 24+ messages in thread
From: Jan Kratochvil @ 2012-04-24 17:38 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Sergio Durigan Junior, gdb-patches

On Tue, 24 Apr 2012 13:15:25 +0200, Pedro Alves wrote:
> On 04/23/2012 11:51 PM, Sergio Durigan Junior wrote:
> > I regtested the patch on a Fedora 16 x86{,_64}, without regressions.  I
> > also built the patch using `--enable-targets=all --enable-plugins
> > --enable-gold', and everything succeeded.
> 
> "--enable-plugins --enable-gold" don't mean anything for GDB, AFAIK.

I suggested it together with --enable-targets=all as I was not sure if Sergio
also will not address something more global outside of gdb/ .
(--enable-plugins has effect on configure but no new files get compiled.)


Thanks,
Jan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 12:16 ` Pedro Alves
  2012-04-24 17:38   ` Jan Kratochvil
@ 2012-04-24 17:42   ` Tom Tromey
  2012-04-24 17:51     ` Pedro Alves
  2012-04-24 17:53     ` Sergio Durigan Junior
  2012-04-24 18:10   ` Sergio Durigan Junior
  2 siblings, 2 replies; 24+ messages in thread
From: Tom Tromey @ 2012-04-24 17:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Sergio Durigan Junior, gdb-patches

>>>>> "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.

Tom


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
  2012-04-24  3:33 ` Doug Evans
  2012-04-24 12:16 ` Pedro Alves
@ 2012-04-24 17:49 ` Tom Tromey
  2012-04-24 18:11   ` Doug Evans
  2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
  3 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2012-04-24 17:49 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> a) How's the ChangeLog for this patch supposed to be?  Can I make a
Sergio> "generic" ChangeLog, saying something like `Remove unused variables from
Sergio> files'?

I'm afraid I will leave that question for someone who cares a bit more.
Sorry about that.

Sergio>  gdb/features/rs6000/powerpc-32.c         |    1 -

All these files are generated by some code in gdb/target-descriptions.c.
gdb/features/Makefile uses 'maint print c-tdesc' to create them.
So, you'll have to fix the generator instead.

Tom


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 17:42   ` Tom Tromey
@ 2012-04-24 17:51     ` Pedro Alves
  2012-05-02  5:30       ` Sergio Durigan Junior
  2012-04-24 17:53     ` Sergio Durigan Junior
  1 sibling, 1 reply; 24+ messages in thread
From: Pedro Alves @ 2012-04-24 17:51 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, Sergio Durigan Junior, gdb-patches

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.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 17:42   ` Tom Tromey
  2012-04-24 17:51     ` Pedro Alves
@ 2012-04-24 17:53     ` Sergio Durigan Junior
  2012-04-24 20:07       ` Tom Tromey
  1 sibling, 1 reply; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-24 17:53 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

On Tuesday, April 24 2012, 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.

Thanks for the reviews, guys.  If you approve the obvious
non-initialized bits, I'll gladly commit it (except for dwarf2read.c
changes, as Doug asked).

-- 
Sergio


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag))
  2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
                   ` (2 preceding siblings ...)
  2012-04-24 17:49 ` Tom Tromey
@ 2012-04-24 17:58 ` Sergio Durigan Junior
  2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
                     ` (2 more replies)
  3 siblings, 3 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-24 17:58 UTC (permalink / raw)
  To: gdb-patches

Hi,

As requested by Pedro, this is the change to `observer.sh' made to
cleanup the unused variable `args'.  I noticed that the variable is only
used as an argument for calling `notify', and in some cases `notify'
doesn't take arguments, thus leading to an unused `args' hanging
around.  This patch removes it by conditionally declaring the variable.

OK to apply?

-- 
Sergio

2012-04-24  Sergio Durigan Junior  <sergiodj@redhat.com>

	* observer.sh: Conditionally declare `args', thus cleaning up
	unused cases.

diff --git a/gdb/observer.sh b/gdb/observer.sh
index b5c49ac..2ff8b64 100755
--- a/gdb/observer.sh
+++ b/gdb/observer.sh
@@ -136,8 +136,17 @@ static void
 observer_${event}_notification_stub (const void *data, const void *args_data)
 {
   observer_${event}_ftype *notify = (observer_${event}_ftype *) data;
+EOF
+
+	notify_args=`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`
+
+	if test ! -z ${notify_args}; then
+	    cat<<EOF >>${otmp}
   const struct ${event}_args *args = args_data;
-  notify (`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`);
+EOF
+	fi
+	cat <<EOF >>${otmp}
+  notify (${notify_args});
 }
 
 struct observer *


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Refactor observer.sh to cleanup unused vars
  2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
@ 2012-04-24 17:59   ` Tom Tromey
  2012-04-24 18:11     ` Sergio Durigan Junior
  2012-04-24 18:04   ` Pedro Alves
  2012-05-14 11:37   ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Jan Kratochvil
  2 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2012-04-24 17:59 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> +	if test ! -z ${notify_args}; then

I think there should be double quotes here, like "${notify_args}".

Ok with that change.

Tom


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24  3:33 ` Doug Evans
@ 2012-04-24 18:02   ` Sergio Durigan Junior
  0 siblings, 0 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-24 18:02 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Tuesday, April 24 2012, Doug Evans wrote:

> Hi.  Can we hold off these kinds of changes to dwarf2read.c?
>
> ref: Fission patch set

Yes, sure.  I will put the dwarf2read.c on hold until you're done with
the Fission patch set.

-- 
Sergio


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Refactor observer.sh to cleanup unused vars
  2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
  2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
@ 2012-04-24 18:04   ` Pedro Alves
  2012-05-14 11:37   ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Jan Kratochvil
  2 siblings, 0 replies; 24+ messages in thread
From: Pedro Alves @ 2012-04-24 18:04 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

On 04/24/2012 06:53 PM, Sergio Durigan Junior wrote:

> Hi,
> 
> As requested by Pedro, this is the change to `observer.sh' made to
> cleanup the unused variable `args'.  


Thanks.

> I noticed that the variable is only

> used as an argument for calling `notify', and in some cases `notify'
> doesn't take arguments, thus leading to an unused `args' hanging
> around.  This patch removes it by conditionally declaring the variable.
> 
> OK to apply?


Okay.

> 2012-04-24  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	* observer.sh: Conditionally declare `args', thus cleaning up
> 	unused cases.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 12:16 ` Pedro Alves
  2012-04-24 17:38   ` Jan Kratochvil
  2012-04-24 17:42   ` Tom Tromey
@ 2012-04-24 18:10   ` Sergio Durigan Junior
  2 siblings, 0 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-24 18:10 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Tuesday, April 24 2012, Pedro Alves wrote:

> Hi Sérgio,
>
> First off, thanks for doing this.

Thanks for reviewing.

> On 04/23/2012 11:51 PM, Sergio Durigan Junior wrote:
>
>> Hi,
>> 
>> This patch is a followup of the discussion in:
>> 
>>     http://sourceware.org/ml/gdb/2012-04/msg00171.html> 
>> First of all, I am sorry for the size of this patch, but I couldn't
>> think of a good way of splitting it, and also I thought it would be
>> useless since these changes are all logically related.
>
>
> It's not useless at all.  This warning points at two classes of problems:
>
>  - variables that are no longer necessary, and can be garbage collected.
>  - variables that actually should be being used, but they're not due to
>    some latent bug.
>
> I skimmed the patch, and noted several places, mostly in tdep code, where
> you end up removing more than the unsuspecting auxiliary and obviously-left-
> -behind-by-accident variable.  Some of those removed bits could well be latent
> bugs.  Some hunks seem to remove used variables and expand what they were
> initialized from at the used sites.  What's up with that?  Please give rationale
> for any change that requires more than idle brain power to understand.
> :-)

We already talked on IRC, but I'm replying this message for the sake of
keep the record.  As I said, initially I thought that those
initialized-but-not-used cases were copy-and-paste mistakes.  But thanks
for pointing that.  Here's what I'm going to do:

- Split these cases by arch, and resubmit it so that the maintainers of
  each arch will get a chance to review and see if the case is a latent
  bug or not

- Split and commit the obvious bits, as approved by Tromey and you in
  the other message in this thread.

>> I'd like to apply it, but I have a couple of questions before:
>> 
>> a) How's the ChangeLog for this patch supposed to be?  Can I make a
>> "generic" ChangeLog, saying something like `Remove unused variables from
>> files'?
>> 
>> b) I'd like someone to take a look at the `observer.sh' change, please.
>
>
> Please sent it as a separate patch, along with a rationale.
> Also, the .c files under features/ are generated files.  We'll need to fix
> the generator instead, again, best done as a separate patch.

Thanks, I totally forgot about this fact!  And I can't believe I didn't
read the header comment on the top of those files :-).  Anyway, this
change will go as a separate patch as well.

-- 
Sergio


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 17:49 ` Tom Tromey
@ 2012-04-24 18:11   ` Doug Evans
  2012-04-24 20:30     ` Joel Brobecker
  0 siblings, 1 reply; 24+ messages in thread
From: Doug Evans @ 2012-04-24 18:11 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Sergio Durigan Junior, gdb-patches

On Tue, Apr 24, 2012 at 10:42 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
> Sergio> a) How's the ChangeLog for this patch supposed to be?  Can I make a
> Sergio> "generic" ChangeLog, saying something like `Remove unused variables from
> Sergio> files'?
>
> I'm afraid I will leave that question for someone who cares a bit more.
> Sorry about that.

fwiw, I'm all for not having to follow the rules that would impose
excessive typing in such cases.
There is precedent for, at least in whitespace cases, just listing the files.
I'm happy with that.  So while you would have to list the files
touched, at least you wouldn't have to document the functions!

[One doesn't always have to list the files that are touched.  A common
case is when you change the signature of a function and then say "All
callers updated."
However, that feels different enough that I have a preference for
listing the files touched in global cleanup operations.]

E.g.
        * foo.c: Mumble.
        * bar.c: Likewise.
        * baz.c: Likewise.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Refactor observer.sh to cleanup unused vars
  2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
@ 2012-04-24 18:11     ` Sergio Durigan Junior
  0 siblings, 0 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-04-24 18:11 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tuesday, April 24 2012, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
> Sergio> +	if test ! -z ${notify_args}; then
>
> I think there should be double quotes here, like "${notify_args}".
>
> Ok with that change.

Thanks.  Committed with that change.

    http://sourceware.org/ml/gdb-cvs/2012-04/msg00194.html

-- 
Sergio


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 17:53     ` Sergio Durigan Junior
@ 2012-04-24 20:07       ` Tom Tromey
  0 siblings, 0 replies; 24+ messages in thread
From: Tom Tromey @ 2012-04-24 20:07 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Pedro Alves, gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> Thanks for the reviews, guys.  If you approve the obvious
Sergio> non-initialized bits, I'll gladly commit it (except for dwarf2read.c
Sergio> changes, as Doug asked).

Yeah, please do.

Tom


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 18:11   ` Doug Evans
@ 2012-04-24 20:30     ` Joel Brobecker
  0 siblings, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2012-04-24 20:30 UTC (permalink / raw)
  To: Doug Evans; +Cc: Tom Tromey, Sergio Durigan Junior, gdb-patches

> fwiw, I'm all for not having to follow the rules that would impose
> excessive typing in such cases.
> There is precedent for, at least in whitespace cases, just listing the files.
> I'm happy with that.  So while you would have to list the files
> touched, at least you wouldn't have to document the functions!

Agreed.

-- 
Joel


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-04-24 17:51     ` Pedro Alves
@ 2012-05-02  5:30       ` Sergio Durigan Junior
  2012-05-02  6:17         ` Michael Eager
  2012-05-02 10:55         ` Pedro Alves
  0 siblings, 2 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-05-02  5:30 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

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; 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-05-02  5:30       ` Sergio Durigan Junior
@ 2012-05-02  6:17         ` Michael Eager
  2012-05-02 10:55         ` Pedro Alves
  1 sibling, 0 replies; 24+ messages in thread
From: Michael Eager @ 2012-05-02  6:17 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Pedro Alves, Tom Tromey, gdb-patches

On 05/01/2012 10:30 PM, Sergio Durigan Junior wrote:
> 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?

OK (obvious) for Microblaze.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-05-02  5:30       ` Sergio Durigan Junior
  2012-05-02  6:17         ` Michael Eager
@ 2012-05-02 10:55         ` Pedro Alves
  2012-05-18 18:46           ` Sergio Durigan Junior
  1 sibling, 1 reply; 24+ messages in thread
From: Pedro Alves @ 2012-05-02 10:55 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Tom Tromey, gdb-patches

On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:

> 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.


No it doesn't.  ;-)

> 
> 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?


> 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,

As I've pointed out before, this needs a rationale.  (IMO, we should fix
the macro).  Several other places in the patch do this.

On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:
> @@ -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

This doesn't fit in the category, but okay.  :-)

Could you wrap the multiline predicate in parenthesis though, please?

#if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
    || defined ...)


The rest looked good to me.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag))
  2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
  2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
  2012-04-24 18:04   ` Pedro Alves
@ 2012-05-14 11:37   ` Jan Kratochvil
  2 siblings, 0 replies; 24+ messages in thread
From: Jan Kratochvil @ 2012-05-14 11:37 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: gdb-patches

On Tue, 24 Apr 2012 19:53:06 +0200, Sergio Durigan Junior wrote:
> --- a/gdb/observer.sh
> +++ b/gdb/observer.sh
> +	if test ! -z ${notify_args}; then

'test ! -z' is the same as 'test -n'.

Sure no need for a commit.


Jan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-05-02 10:55         ` Pedro Alves
@ 2012-05-18 18:46           ` Sergio Durigan Junior
  2012-05-18 19:13             ` Tom Tromey
  0 siblings, 1 reply; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-05-18 18:46 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

On Wednesday, May 02 2012, Pedro Alves wrote:

> On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:

>> 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,
>
> As I've pointed out before, this needs a rationale.  (IMO, we should fix
> the macro).  Several other places in the patch do this.

Well, the BFD macros are fixed now.  So here is the updated patch,
addressing your comment below.

> On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:
>> @@ -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
>
> This doesn't fit in the category, but okay.  :-)
>
> Could you wrap the multiline predicate in parenthesis though, please?
>
> #if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
>     || defined ...)
>
>
> The rest looked good to me.

OK to apply, then?

Thanks,

-- 
Sergio

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ad17cb4..72d4768 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)
@@ -10819,7 +10819,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 7ebd8b7..df5dea7 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;
@@ -8707,8 +8704,6 @@ static void
 arm_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
 			       int *kindptr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   arm_breakpoint_from_pc (gdbarch, pcptr, kindptr);
 
   if (arm_pc_is_thumb (gdbarch, *pcptr) && *kindptr == 4)
@@ -9283,8 +9278,6 @@ static void
 arm_show_fallback_mode (struct ui_file *file, int from_tty,
 			struct cmd_list_element *c, const char *value)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
-
   fprintf_filtered (file,
 		    _("The current execution mode assumed "
 		      "(when symbols are unavailable) is \"%s\".\n"),
@@ -9574,7 +9567,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 6901fc9..864d288 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 333c54f..1324ce5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -752,7 +752,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)
@@ -7460,7 +7459,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;
@@ -7728,7 +7726,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);
 
@@ -8957,8 +8954,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;
@@ -9028,7 +9023,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;
@@ -13340,7 +13334,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 8b05f8f..7a1bb02 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 f4e7974..b0a8b82 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 8419a19..bafdb86 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1320,12 +1320,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 91eefb4..6739037 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 a536bbb..c251b70 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 1514e13..9729173 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2432,7 +2432,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;
@@ -4069,7 +4068,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;
@@ -5292,7 +5290,6 @@ static void
 psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct dwarf2_per_cu_data *per_cu;
-  struct cleanup *back_to;
   int i;
 
   if (pst->readin)
@@ -5365,7 +5362,6 @@ load_full_comp_unit_reader (const struct die_reader_specs *reader,
 			    void *data)
 {
   struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
   enum language *language_ptr = data;
 
   gdb_assert (cu->die_hash == NULL);
@@ -6942,7 +6938,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);
@@ -6982,7 +6977,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);
@@ -7122,7 +7116,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)
@@ -7771,7 +7764,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)
@@ -15182,7 +15174,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 =
@@ -17527,8 +17518,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,
@@ -17737,7 +17726,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 8e64247..4639367 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 dba174d..59d8bff 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 dc81383..8b84b5a 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 9e884a4..9262b10 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/go-exp.y b/gdb/go-exp.y
index e73b561..c3171c3 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1554,7 +1554,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 7ec50b3..237f4a3 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 07b8015..581ffc7 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 b3abba2..5b04505 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 27a4938..a7a802a 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 a76cca1..f172e41 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);
@@ -781,7 +779,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;
@@ -942,7 +939,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)
     {
@@ -1102,7 +1098,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;
 
@@ -1244,7 +1239,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 09c2cc0..57d73b5 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 ea3f296..e92679f 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -321,7 +321,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 3957f8c..b680fa0 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..76e4bf1 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 720e8b6..150b9de 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 90feaaf..cc1df34 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 d3e2cae..ca59213 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 69cffc3..6e24a8e 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 6d31b39..cd6891a 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1576,7 +1576,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;
@@ -4959,7 +4958,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;
 
@@ -5696,7 +5694,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;
 
@@ -5750,7 +5748,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 33fa227..e292613 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/p-valprint.c b/gdb/p-valprint.c
index 77d9721..b8434ed 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;
   int want_space = 0;
 
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 878d3f8..98704c1 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 a4521ab..a221b70 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1079,7 +1079,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 3c2d28c..030a4f2 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1613,7 +1613,6 @@ map_display_numbers (char *args,
 		     void *data)
 {
   struct get_number_or_range_state state;
-  struct display *b, *tmp;
   int num;
 
   if (args == NULL)
@@ -1656,9 +1655,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 761ad32..56ab775 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -319,7 +319,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 57ef643..19eb7b5 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)
@@ -694,7 +693,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 d178a1f..acd36c2 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 c99273e..59cfa73 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -430,7 +430,6 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
 {
   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 f03c13a..620eaea 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 daaa518..fb25806 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 66b57e3..c8b1c04 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 f185d41..6da2297 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 9bc9522..f05a26b 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.  */
@@ -2032,7 +2032,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."));
@@ -2089,7 +2089,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."));
@@ -2210,7 +2210,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."));
@@ -2358,7 +2358,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;
 
@@ -2452,7 +2452,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."));
@@ -2531,7 +2531,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 3c983ff..02e36ca 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..416d35d 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)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d4555d9..46c365c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -156,7 +156,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;
@@ -196,7 +195,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);
@@ -3333,7 +3331,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 ca95947..8573222 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 88fd01c..b4269c6 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 c0d2281..e374df8 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 1384396..fc5942d 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -340,7 +340,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 c5b50c2..c64e55b 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 13397f2..b2a0617 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; 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-05-18 18:46           ` Sergio Durigan Junior
@ 2012-05-18 19:13             ` Tom Tromey
  2012-05-18 21:05               ` Sergio Durigan Junior
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2012-05-18 19:13 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Pedro Alves, gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> OK to apply, then?

This is ok.  Thanks.

Tom


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
  2012-05-18 19:13             ` Tom Tromey
@ 2012-05-18 21:05               ` Sergio Durigan Junior
  0 siblings, 0 replies; 24+ messages in thread
From: Sergio Durigan Junior @ 2012-05-18 21:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

On Friday, May 18 2012, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
> Sergio> OK to apply, then?
>
> This is ok.  Thanks.

Thanks.

Checked in: http://sourceware.org/ml/gdb-cvs/2012-05/msg00137.html

-- 
Sergio

2012-05-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c:
	* avr-tdep.c:
	* ax-gdb.c:
	* bfin-linux-tdep.c:
	* breakpoint.c:
	* c-valprint.c:
	* cli/cli-cmds.c:
	* coffread.c:
	* cp-support.c:
	* cris-tdep.c:
	* dwarf2-frame-tailcall.c:
	* dwarf2-frame.c:
	* dwarf2expr.c:
	* dwarf2loc.c:
	* dwarf2read.c:
	* elfread.c:
	* eval.c:
	* expprint.c:
	* f-valprint.c:
	* frv-tdep.c:
	* h8300-tdep.c:
	* hppa-hpux-tdep.c:
	* hppa-tdep.c:
	* hppanbsd-tdep.c:
	* i386-nto-tdep.c:
	* i386-tdep.c:
	* i387-tdep.c:
	* ia64-tdep.c:
	* jit.c:
	* linespec.c:
	* linux-tdep.c:
	* lm32-tdep.c:
	* m2-valprint.c:
	* m32c-tdep.c:
	* m32r-rom.c:
	* m32r-tdep.c:
	* m68k-tdep.c:
	* m68klinux-tdep.c:
	* mi/mi-main.c:
	* microblaze-tdep.c:
	* mips-linux-tdep.c:
	* mips-tdep.c:
	* mn10300-tdep.c:
	* p-valprint.c:
	* parse.c:
	* ppc-linux-tdep.c:
	* ppc-sysv-tdep.c:
	* printcmd.c:
	* python/py-finishbreakpoint.c:
	* python/py-inferior.c:
	* python/py-infthread.c:
	* python/py-type.c:
	* python/python.c:
	* remote-fileio.c:
	* remote-m32r-sdi.c:
	* remote-mips.c:
	* reverse.c:
	* rl78-tdep.c:
	* rs6000-aix-tdep.c:
	* rs6000-tdep.c:
	* s390-tdep.c:
	* score-tdep.c:
	* sh64-tdep.c:
	* skip.c:
	* solib-darwin.c:
	* solib-dsbt.c:
	* solib-frv.c:
	* sparc-tdep.c:
	* spu-multiarch.c:
	* spu-tdep.c:
	* stack.c:
	* symfile.c:
	* symtab.c:
	* tic6x-tdep.c:
	* tracepoint.c:
	* v850-tdep.c:
	* valarith.c:
	* valprint.c:
	* value.c:
	* xcoffread.c:
	* xtensa-tdep.c:
	* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c: Delete unused variables.

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ad17cb4..72d4768 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)
@@ -10819,7 +10819,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 7ebd8b7..df5dea7 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;
@@ -8707,8 +8704,6 @@ static void
 arm_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
 			       int *kindptr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   arm_breakpoint_from_pc (gdbarch, pcptr, kindptr);
 
   if (arm_pc_is_thumb (gdbarch, *pcptr) && *kindptr == 4)
@@ -9283,8 +9278,6 @@ static void
 arm_show_fallback_mode (struct ui_file *file, int from_tty,
 			struct cmd_list_element *c, const char *value)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
-
   fprintf_filtered (file,
 		    _("The current execution mode assumed "
 		      "(when symbols are unavailable) is \"%s\".\n"),
@@ -9574,7 +9567,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 6901fc9..864d288 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 333c54f..1324ce5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -752,7 +752,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)
@@ -7460,7 +7459,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;
@@ -7728,7 +7726,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);
 
@@ -8957,8 +8954,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;
@@ -9028,7 +9023,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;
@@ -13340,7 +13334,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 8b05f8f..7a1bb02 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 f4e7974..b0a8b82 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 8419a19..bafdb86 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1320,12 +1320,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 91eefb4..6739037 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 a536bbb..c251b70 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 1514e13..9729173 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2432,7 +2432,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;
@@ -4069,7 +4068,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;
@@ -5292,7 +5290,6 @@ static void
 psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct dwarf2_per_cu_data *per_cu;
-  struct cleanup *back_to;
   int i;
 
   if (pst->readin)
@@ -5365,7 +5362,6 @@ load_full_comp_unit_reader (const struct die_reader_specs *reader,
 			    void *data)
 {
   struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
   enum language *language_ptr = data;
 
   gdb_assert (cu->die_hash == NULL);
@@ -6942,7 +6938,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);
@@ -6982,7 +6977,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);
@@ -7122,7 +7116,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)
@@ -7771,7 +7764,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)
@@ -15182,7 +15174,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 =
@@ -17527,8 +17518,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,
@@ -17737,7 +17726,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 8e64247..4639367 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 dba174d..59d8bff 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 dc81383..8b84b5a 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 9e884a4..9262b10 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/go-exp.y b/gdb/go-exp.y
index e73b561..c3171c3 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1554,7 +1554,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 7ec50b3..237f4a3 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 07b8015..581ffc7 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 b3abba2..5b04505 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 27a4938..a7a802a 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 a76cca1..f172e41 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);
@@ -781,7 +779,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;
@@ -942,7 +939,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)
     {
@@ -1102,7 +1098,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;
 
@@ -1244,7 +1239,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 09c2cc0..57d73b5 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 ea3f296..e92679f 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -321,7 +321,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 3957f8c..b680fa0 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..76e4bf1 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 720e8b6..150b9de 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 90feaaf..cc1df34 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 d3e2cae..ca59213 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 69cffc3..6e24a8e 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 6d31b39..cd6891a 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1576,7 +1576,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;
@@ -4959,7 +4958,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;
 
@@ -5696,7 +5694,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;
 
@@ -5750,7 +5748,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 33fa227..e292613 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/p-valprint.c b/gdb/p-valprint.c
index 77d9721..b8434ed 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;
   int want_space = 0;
 
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 878d3f8..98704c1 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 a4521ab..a221b70 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1079,7 +1079,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 3c2d28c..030a4f2 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1613,7 +1613,6 @@ map_display_numbers (char *args,
 		     void *data)
 {
   struct get_number_or_range_state state;
-  struct display *b, *tmp;
   int num;
 
   if (args == NULL)
@@ -1656,9 +1655,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 761ad32..56ab775 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -319,7 +319,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 57ef643..19eb7b5 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)
@@ -694,7 +693,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 d178a1f..acd36c2 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 c99273e..59cfa73 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -430,7 +430,6 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
 {
   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 f03c13a..620eaea 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 daaa518..fb25806 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 66b57e3..c8b1c04 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 f185d41..6da2297 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 9bc9522..f05a26b 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.  */
@@ -2032,7 +2032,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."));
@@ -2089,7 +2089,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."));
@@ -2210,7 +2210,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."));
@@ -2358,7 +2358,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;
 
@@ -2452,7 +2452,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."));
@@ -2531,7 +2531,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 3c983ff..02e36ca 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..416d35d 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)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d4555d9..46c365c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -156,7 +156,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;
@@ -196,7 +195,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);
@@ -3333,7 +3331,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 ca95947..8573222 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 88fd01c..b4269c6 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 c0d2281..e374df8 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 1384396..fc5942d 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -340,7 +340,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 c5b50c2..c64e55b 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 13397f2..b2a0617 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; 


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-05-18 21:05 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
2012-04-24  3:33 ` Doug Evans
2012-04-24 18:02   ` Sergio Durigan Junior
2012-04-24 12:16 ` Pedro Alves
2012-04-24 17:38   ` Jan Kratochvil
2012-04-24 17:42   ` Tom Tromey
2012-04-24 17:51     ` Pedro Alves
2012-05-02  5:30       ` Sergio Durigan Junior
2012-05-02  6:17         ` Michael Eager
2012-05-02 10:55         ` Pedro Alves
2012-05-18 18:46           ` Sergio Durigan Junior
2012-05-18 19:13             ` Tom Tromey
2012-05-18 21:05               ` Sergio Durigan Junior
2012-04-24 17:53     ` Sergio Durigan Junior
2012-04-24 20:07       ` Tom Tromey
2012-04-24 18:10   ` Sergio Durigan Junior
2012-04-24 17:49 ` Tom Tromey
2012-04-24 18:11   ` Doug Evans
2012-04-24 20:30     ` Joel Brobecker
2012-04-24 17:58 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
2012-04-24 18:11     ` Sergio Durigan Junior
2012-04-24 18:04   ` Pedro Alves
2012-05-14 11:37   ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox