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


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

[pushed] Remove some unused variables


This patch removes some unused variables, found with -Wunused.  I have
not removed everything reported by -Wunused, because some expressions
such as

  struct type *arg_type = check_typedef (value_type);

in bfin-tdep.c could have an unexpected but important side-effect.  I
removed others that I considered more low-risk, such as:

  struct gdbarch *gdbarch = get_objfile_arch (objfile);

I tested building with Python 2/Python 3/no Python, with/without expat,
with/without libipt and with/without babeltrace.

gdb/ChangeLog:

	* ada-lang.c (ada_collect_symbol_completion_matches): Remove
	unused variables.
	(ada_is_redundant_range_encoding): Likewise.
	* ada-varobj.c (ada_varobj_get_value_of_array_variable):
	Likewise.
	* alpha-tdep.c (alpha_software_single_step): Likewise.
	* arm-tdep.c (_initialize_arm_tdep): Likewise.
	* auto-load.c (info_auto_load_cmd): Likewise.
	* break-catch-syscall.c (insert_catch_syscall): Likewise.
	(remove_catch_syscall): Likewise.
	* breakpoint.c (condition_completer): Likewise.
	(clear_command): Likewise.
	(update_breakpoint_locations): Likewise.
	* btrace.c (btrace_disable): Likewise.
	(btrace_teardown): Likewise.
	(btrace_maint_update_pt_packets): Likewise.
	(maint_btrace_clear_cmd): Likewise.
	* cli/cli-decode.c (lookup_cmd_1): Likewise.
	(lookup_cmd_composition): Likewise.
	* cli/cli-dump.c (scan_filename): Likewise.
	(restore_command): Likewise.
	* compile/compile-loc2c.c (compute_stack_depth): Likewise.
	* compile/compile-object-load.c (compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* compile/compile.c (compile_to_object): Likewise.
	* completer.c (filename_completer): Likewise.
	(complete_files_symbols): Likewise.
	(complete_expression): Likewise.
	* corelow.c (core_open): Likewise.
	* ctf.c (ctf_start): Likewise.
	(ctf_write_status): Likewise.
	(ctf_write_uploaded_tsv): Likewise.
	(ctf_write_definition_end): Likewise.
	(ctf_open_dir): Likewise.
	(ctf_xfer_partial): Likewise.
	(ctf_trace_find): Likewise.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Likewise.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	(indirect_pieced_value): Likewise.
	(dwarf2_evaluate_loc_desc_full): Likewise.
	* dwarf2read.c (dw2_expand_marked_cus): Likewise.
	(dw2_expand_symtabs_matching): Likewise.
	(dw2_map_symbol_filenames): Likewise.
	(read_and_check_comp_unit_head): Likewise.
	(read_cutu_die_from_dwo): Likewise.
	(lookup_dwo_unit): Likewise.
	(read_comp_units_from_section): Likewise.
	(dwarf2_compute_name): Likewise.
	(handle_DW_AT_stmt_list): Likewise.
	(create_cus_hash_table): Likewise.
	(create_dwp_v2_section): Likewise.
	(dwarf2_rnglists_process): Likewise.
	(dwarf2_ranges_process): Likewise.
	(dwarf2_record_block_ranges): Likewise.
	(is_vtable_name): Likewise.
	(read_formatted_entries): Likewise.
	(skip_form_bytes): Likewise.
	* elfread.c (elf_symtab_read): Likewise.
	* exec.c (exec_file_command): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	(info_common_command_for_block): Likewise.
	* guile/guile.c (initialize_scheme_side): Likewise.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
	* guile/scm-cmd.c (cmdscm_completer): Likewise.
	(gdbscm_register_command_x): Likewise.
	* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
	* guile/scm-param.c (gdbscm_parameter_value): Likewise.
	* guile/scm-ports.c (file_port_magic): Likewise.
	* guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise.
	(ppscm_pretty_print_one_value): Likewise.
	(ppscm_print_children): Likewise.
	* guile/scm-string.c (gdbscm_string_to_argv): Likewise.
	* guile/scm-symtab.c (gdbscm_sal_symtab): Likewise.
	* guile/scm-type.c (gdbscm_type_next_field_x): Likewise.
	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
	* i386-tdep.c (i386_register_reggroup_p): Likewise.
	* infcmd.c (run_command_1): Likewise.
	(until_next_fsm_clean_up): Likewise.
	* linespec.c (linespec_complete): Likewise.
	(find_label_symbols): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* memattr.c (require_user_regions): Likewise.
	(lookup_mem_region): Likewise.
	(disable_mem_command): Likewise.
	(mem_delete): Likewise.
	* mep-tdep.c (mep_register_name): Likewise.
	(mep_analyze_prologue): Likewise.
	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise.
	* mi/mi-interp.c (mi_on_sync_execution_done): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
	* microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise.
	* minidebug.c (lzma_open): Likewise.
	* minsyms.c (lookup_minimal_symbol): Likewise.
	* mips-linux-tdep.c (mips64_fill_fpregset): Likewise.
	* mips-tdep.c (mips_stub_frame_sniffer): Likewise.
	(mips_o64_return_value): Likewise.
	(mips_single_step_through_delay): Likewise.
	(_initialize_mips_tdep): Likewise.
	* nios2-tdep.c (nios2_push_dummy_call): Likewise.
	(nios2_software_single_step): Likewise.
	* parse.c (find_minsym_type_and_address): Likewise.
	* psymtab.c (psym_relocate): Likewise.
	* python/py-breakpoint.c (bppy_get_commands): Likewise.
	(gdbpy_breakpoint_modified): Likewise.
	* python/py-infevents.c (create_inferior_call_event_object):
	Likewise.
	* python/py-record-btrace.c (btpy_list_item): Likewise.
	* python/py-type.c (typy_str): Likewise.
	* python/py-value.c (valpy_call): Likewise.
	* python/python.c (do_start_initialization): Likewise.
	* record-btrace.c (record_btrace_insn_history_range): Likewise.
	(record_btrace_call_history_range): Likewise.
	(record_btrace_record_method): Likewise.
	(record_btrace_xfer_partial): Likewise.
	(btrace_get_frame_function): Likewise.
	* record-full.c (record_full_open): Likewise.
	* record.c (get_context_size): Likewise.
	* registry.h (DEFINE_REGISTRY): Likewise.
	* remote-fileio.c (remote_fileio_request): Likewise.
	* remote.c (remote_update_thread_list): Likewise.
	(remote_check_symbols): Likewise.
	(remote_commit_resume): Likewise.
	(remote_interrupt): Likewise.
	(remote_insert_breakpoint): Likewise.
	(compare_sections_command): Likewise.
	* rust-exp.y (super_name): Likewise.
	(lex_string): Likewise.
	(convert_ast_to_type): Likewise.
	(convert_ast_to_expression): Likewise.
	* rust-lang.c (rust_print_struct_def): Likewise.
	(rust_print_type): Likewise.
	(rust_evaluate_subexp): Likewise.
	* rx-tdep.c (rx_register_type): Likewise.
	* ser-event.c (serial_event_clear): Likewise.
	* serial.c (serial_open): Likewise.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
	* symfile.c (section_is_overlay): Likewise.
	(overlay_unmapped_address): Likewise.
	(overlay_mapped_address): Likewise.
	(simple_overlay_update_1): Likewise.
	(simple_overlay_update): Likewise.
	* symtab.c (symbol_find_demangled_name): Likewise.
	(search_symbols): Likewise.
	* target-descriptions.c (tdesc_predefined_type): Likewise.
	* target.c (target_commit_resume): Likewise.
	* thread.c (print_selected_thread_frame): Likewise.
	* top.c (new_ui_command): Likewise.
	(gdb_readline_no_editing): Likewise.
	* tracefile-tfile.c (tfile_open): Likewise.
	* tracepoint.c (create_tsv_from_upload): Likewise.
	* utils.c (quit): Likewise.
	(defaulted_query): Likewise.
	* valarith.c (value_concat): Likewise.
	* xml-syscall.c (xml_list_syscalls_by_group): Likewise.
	* xml-tdesc.c (target_fetch_description_xml): Likewise.
	* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
	(xtensa_pseudo_register_write): Likewise.

gdb/gdbserver/ChangeLog:

	* regcache.c (registers_to_string): Remove unused variable.
---
 gdb/ChangeLog                     | 161 ++++++++++++++++++++++++++++++++++++++
 gdb/ada-lang.c                    |   2 -
 gdb/ada-varobj.c                  |   1 -
 gdb/alpha-tdep.c                  |   5 +-
 gdb/arm-tdep.c                    |   2 -
 gdb/auto-load.c                   |   1 -
 gdb/break-catch-syscall.c         |   3 -
 gdb/breakpoint.c                  |   3 -
 gdb/btrace.c                      |   4 -
 gdb/cli/cli-decode.c              |   4 +-
 gdb/cli/cli-dump.c                |   2 -
 gdb/compile/compile-loc2c.c       |   1 -
 gdb/compile/compile-object-load.c |   4 +-
 gdb/compile/compile-object-run.c  |   2 -
 gdb/compile/compile.c             |   1 -
 gdb/completer.c                   |   5 --
 gdb/corelow.c                     |   1 -
 gdb/ctf.c                         |  16 ----
 gdb/disasm.c                      |   1 -
 gdb/dwarf2loc.c                   |   3 -
 gdb/dwarf2read.c                  |  24 ------
 gdb/elfread.c                     |   1 -
 gdb/exec.c                        |   2 -
 gdb/f-valprint.c                  |   2 -
 gdb/gdbserver/ChangeLog           |   4 +
 gdb/gdbserver/regcache.c          |   2 -
 gdb/guile/guile.c                 |   1 -
 gdb/guile/scm-breakpoint.c        |   1 -
 gdb/guile/scm-cmd.c               |   4 +-
 gdb/guile/scm-frame.c             |   1 -
 gdb/guile/scm-param.c             |   1 -
 gdb/guile/scm-ports.c             |   4 -
 gdb/guile/scm-pretty-print.c      |   5 +-
 gdb/guile/scm-string.c            |   1 -
 gdb/guile/scm-symtab.c            |   1 -
 gdb/guile/scm-type.c              |   2 +-
 gdb/guile/scm-utils.c             |   2 +-
 gdb/i386-tdep.c                   |   4 +-
 gdb/infcmd.c                      |   3 -
 gdb/linespec.c                    |   2 -
 gdb/m2-valprint.c                 |   1 -
 gdb/memattr.c                     |  11 ---
 gdb/mep-tdep.c                    |   3 -
 gdb/mi/mi-cmd-file.c              |   1 -
 gdb/mi/mi-interp.c                |   1 -
 gdb/mi/mi-main.c                  |   5 --
 gdb/microblaze-linux-tdep.c       |   2 -
 gdb/minidebug.c                   |   1 -
 gdb/minsyms.c                     |   2 -
 gdb/mips-linux-tdep.c             |   1 -
 gdb/mips-tdep.c                   |   5 --
 gdb/nios2-tdep.c                  |   2 -
 gdb/parse.c                       |   2 -
 gdb/psymtab.c                     |   1 -
 gdb/python/py-breakpoint.c        |   3 -
 gdb/python/py-infevents.c         |   1 -
 gdb/python/py-record-btrace.c     |   1 -
 gdb/python/py-type.c              |   1 -
 gdb/python/py-value.c             |   1 -
 gdb/python/python.c               |   1 -
 gdb/record-btrace.c               |   6 --
 gdb/record-full.c                 |   2 -
 gdb/record.c                      |   1 -
 gdb/registry.h                    |   4 -
 gdb/remote-fileio.c               |   2 -
 gdb/remote.c                      |   7 --
 gdb/rust-exp.y                    |   4 -
 gdb/rust-lang.c                   |   5 +-
 gdb/rx-tdep.c                     |   2 -
 gdb/ser-event.c                   |   2 +-
 gdb/serial.c                      |   1 -
 gdb/spu-tdep.c                    |   1 -
 gdb/symfile.c                     |   5 --
 gdb/symtab.c                      |   2 -
 gdb/target-descriptions.c         |   5 +-
 gdb/target.c                      |   2 -
 gdb/thread.c                      |   1 -
 gdb/top.c                         |   3 -
 gdb/tracefile-tfile.c             |   1 -
 gdb/tracepoint.c                  |   1 -
 gdb/utils.c                       |   3 -
 gdb/valarith.c                    |   1 -
 gdb/xml-syscall.c                 |   1 -
 gdb/xml-tdesc.c                   |   2 -
 gdb/xtensa-tdep.c                 |   4 -
 85 files changed, 179 insertions(+), 224 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0bb4546..524eef3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,164 @@
+2017-12-05  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* ada-lang.c (ada_collect_symbol_completion_matches): Remove
+	unused variables.
+	(ada_is_redundant_range_encoding): Likewise.
+	* ada-varobj.c (ada_varobj_get_value_of_array_variable):
+	Likewise.
+	* alpha-tdep.c (alpha_software_single_step): Likewise.
+	* arm-tdep.c (_initialize_arm_tdep): Likewise.
+	* auto-load.c (info_auto_load_cmd): Likewise.
+	* break-catch-syscall.c (insert_catch_syscall): Likewise.
+	(remove_catch_syscall): Likewise.
+	* breakpoint.c (condition_completer): Likewise.
+	(clear_command): Likewise.
+	(update_breakpoint_locations): Likewise.
+	* btrace.c (btrace_disable): Likewise.
+	(btrace_teardown): Likewise.
+	(btrace_maint_update_pt_packets): Likewise.
+	(maint_btrace_clear_cmd): Likewise.
+	* cli/cli-decode.c (lookup_cmd_1): Likewise.
+	(lookup_cmd_composition): Likewise.
+	* cli/cli-dump.c (scan_filename): Likewise.
+	(restore_command): Likewise.
+	* compile/compile-loc2c.c (compute_stack_depth): Likewise.
+	* compile/compile-object-load.c (compile_object_load): Likewise.
+	* compile/compile-object-run.c (compile_object_run): Likewise.
+	* compile/compile.c (compile_to_object): Likewise.
+	* completer.c (filename_completer): Likewise.
+	(complete_files_symbols): Likewise.
+	(complete_expression): Likewise.
+	* corelow.c (core_open): Likewise.
+	* ctf.c (ctf_start): Likewise.
+	(ctf_write_status): Likewise.
+	(ctf_write_uploaded_tsv): Likewise.
+	(ctf_write_definition_end): Likewise.
+	(ctf_open_dir): Likewise.
+	(ctf_xfer_partial): Likewise.
+	(ctf_trace_find): Likewise.
+	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
+	Likewise.
+	* dwarf2loc.c (allocate_piece_closure): Likewise.
+	(indirect_pieced_value): Likewise.
+	(dwarf2_evaluate_loc_desc_full): Likewise.
+	* dwarf2read.c (dw2_expand_marked_cus): Likewise.
+	(dw2_expand_symtabs_matching): Likewise.
+	(dw2_map_symbol_filenames): Likewise.
+	(read_and_check_comp_unit_head): Likewise.
+	(read_cutu_die_from_dwo): Likewise.
+	(lookup_dwo_unit): Likewise.
+	(read_comp_units_from_section): Likewise.
+	(dwarf2_compute_name): Likewise.
+	(handle_DW_AT_stmt_list): Likewise.
+	(create_cus_hash_table): Likewise.
+	(create_dwp_v2_section): Likewise.
+	(dwarf2_rnglists_process): Likewise.
+	(dwarf2_ranges_process): Likewise.
+	(dwarf2_record_block_ranges): Likewise.
+	(is_vtable_name): Likewise.
+	(read_formatted_entries): Likewise.
+	(skip_form_bytes): Likewise.
+	* elfread.c (elf_symtab_read): Likewise.
+	* exec.c (exec_file_command): Likewise.
+	* f-valprint.c (f_val_print): Likewise.
+	(info_common_command_for_block): Likewise.
+	* guile/guile.c (initialize_scheme_side): Likewise.
+	* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
+	* guile/scm-cmd.c (cmdscm_completer): Likewise.
+	(gdbscm_register_command_x): Likewise.
+	* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
+	* guile/scm-param.c (gdbscm_parameter_value): Likewise.
+	* guile/scm-ports.c (file_port_magic): Likewise.
+	* guile/scm-pretty-print.c (ppscm_search_pp_list): Likewise.
+	(ppscm_pretty_print_one_value): Likewise.
+	(ppscm_print_children): Likewise.
+	* guile/scm-string.c (gdbscm_string_to_argv): Likewise.
+	* guile/scm-symtab.c (gdbscm_sal_symtab): Likewise.
+	* guile/scm-type.c (gdbscm_type_next_field_x): Likewise.
+	* guile/scm-utils.c (gdbscm_parse_function_args): Likewise.
+	* i386-tdep.c (i386_register_reggroup_p): Likewise.
+	* infcmd.c (run_command_1): Likewise.
+	(until_next_fsm_clean_up): Likewise.
+	* linespec.c (linespec_complete): Likewise.
+	(find_label_symbols): Likewise.
+	* m2-valprint.c (m2_val_print): Likewise.
+	* memattr.c (require_user_regions): Likewise.
+	(lookup_mem_region): Likewise.
+	(disable_mem_command): Likewise.
+	(mem_delete): Likewise.
+	* mep-tdep.c (mep_register_name): Likewise.
+	(mep_analyze_prologue): Likewise.
+	* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Likewise.
+	* mi/mi-interp.c (mi_on_sync_execution_done): Likewise.
+	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
+	* microblaze-linux-tdep.c (microblaze_linux_init_abi): Likewise.
+	* minidebug.c (lzma_open): Likewise.
+	* minsyms.c (lookup_minimal_symbol): Likewise.
+	* mips-linux-tdep.c (mips64_fill_fpregset): Likewise.
+	* mips-tdep.c (mips_stub_frame_sniffer): Likewise.
+	(mips_o64_return_value): Likewise.
+	(mips_single_step_through_delay): Likewise.
+	(_initialize_mips_tdep): Likewise.
+	* nios2-tdep.c (nios2_push_dummy_call): Likewise.
+	(nios2_software_single_step): Likewise.
+	* parse.c (find_minsym_type_and_address): Likewise.
+	* psymtab.c (psym_relocate): Likewise.
+	* python/py-breakpoint.c (bppy_get_commands): Likewise.
+	(gdbpy_breakpoint_modified): Likewise.
+	* python/py-infevents.c (create_inferior_call_event_object):
+	Likewise.
+	* python/py-record-btrace.c (btpy_list_item): Likewise.
+	* python/py-type.c (typy_str): Likewise.
+	* python/py-value.c (valpy_call): Likewise.
+	* python/python.c (do_start_initialization): Likewise.
+	* record-btrace.c (record_btrace_insn_history_range): Likewise.
+	(record_btrace_call_history_range): Likewise.
+	(record_btrace_record_method): Likewise.
+	(record_btrace_xfer_partial): Likewise.
+	(btrace_get_frame_function): Likewise.
+	* record-full.c (record_full_open): Likewise.
+	* record.c (get_context_size): Likewise.
+	* registry.h (DEFINE_REGISTRY): Likewise.
+	* remote-fileio.c (remote_fileio_request): Likewise.
+	* remote.c (remote_update_thread_list): Likewise.
+	(remote_check_symbols): Likewise.
+	(remote_commit_resume): Likewise.
+	(remote_interrupt): Likewise.
+	(remote_insert_breakpoint): Likewise.
+	(compare_sections_command): Likewise.
+	* rust-exp.y (super_name): Likewise.
+	(lex_string): Likewise.
+	(convert_ast_to_type): Likewise.
+	(convert_ast_to_expression): Likewise.
+	* rust-lang.c (rust_print_struct_def): Likewise.
+	(rust_print_type): Likewise.
+	(rust_evaluate_subexp): Likewise.
+	* rx-tdep.c (rx_register_type): Likewise.
+	* ser-event.c (serial_event_clear): Likewise.
+	* serial.c (serial_open): Likewise.
+	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
+	* symfile.c (section_is_overlay): Likewise.
+	(overlay_unmapped_address): Likewise.
+	(overlay_mapped_address): Likewise.
+	(simple_overlay_update_1): Likewise.
+	(simple_overlay_update): Likewise.
+	* symtab.c (symbol_find_demangled_name): Likewise.
+	(search_symbols): Likewise.
+	* target-descriptions.c (tdesc_predefined_type): Likewise.
+	* target.c (target_commit_resume): Likewise.
+	* thread.c (print_selected_thread_frame): Likewise.
+	* top.c (new_ui_command): Likewise.
+	(gdb_readline_no_editing): Likewise.
+	* tracefile-tfile.c (tfile_open): Likewise.
+	* tracepoint.c (create_tsv_from_upload): Likewise.
+	* utils.c (quit): Likewise.
+	(defaulted_query): Likewise.
+	* valarith.c (value_concat): Likewise.
+	* xml-syscall.c (xml_list_syscalls_by_group): Likewise.
+	* xml-tdesc.c (target_fetch_description_xml): Likewise.
+	* xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
+	(xtensa_pseudo_register_write): Likewise.
+
 2017-12-04  Tom Tromey  <tom@tromey.com>
 
 	* NEWS: Mention Rust trait object inspection.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c5636b9..d6f7ef4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6475,7 +6475,6 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
   struct minimal_symbol *msymbol;
   struct objfile *objfile;
   const struct block *b, *surrounding_static_block = 0;
-  int i;
   struct block_iterator iter;
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
 
@@ -8652,7 +8651,6 @@ static int
 ada_is_redundant_range_encoding (struct type *range_type,
 				 struct type *encoding_type)
 {
-  struct type *fixed_range_type;
   const char *bounds_str;
   int n;
   LONGEST lo, hi;
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 267ee26..c8b4ba6 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -825,7 +825,6 @@ ada_varobj_get_value_of_array_variable (struct value *value,
 					struct type *type,
 					struct value_print_options *opts)
 {
-  char *result;
   const int numchild = ada_varobj_get_array_number_of_children (value, type);
 
   /* If we have a string, provide its contents in the "value" field.
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 3100d72..21199bd 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1723,10 +1723,7 @@ alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
 std::vector<CORE_ADDR>
 alpha_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = regcache->arch ();
-  CORE_ADDR pc;
-
-  pc = alpha_next_pc (regcache, regcache_read_pc (regcache));
+  CORE_ADDR pc = alpha_next_pc (regcache, regcache_read_pc (regcache));
 
   return {pc};
 }
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 54c6392..ac92c88 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9546,8 +9546,6 @@ void
 _initialize_arm_tdep (void)
 {
   long length;
-  const char *setname;
-  const char *setdesc;
   int i, j;
   char regdesc[1024], *rdptr = regdesc;
   size_t rest = sizeof (regdesc);
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 3d56014..69b242b 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1521,7 +1521,6 @@ static void
 info_auto_load_cmd (const char *args, int from_tty)
 {
   struct cmd_list_element *list;
-  struct cleanup *infolist_chain;
   struct ui_out *uiout = current_uiout;
 
   ui_out_emit_tuple tuple_emitter (uiout, "infolist");
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 41ea424..a8312f2 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -104,8 +104,6 @@ insert_catch_syscall (struct bp_location *bl)
     {
       for (int iter : c->syscalls_to_be_caught)
 	{
-          int elem;
-
 	  if (iter >= inf_data->syscalls_counts.size ())
 	    inf_data->syscalls_counts.resize (iter + 1);
 	  ++inf_data->syscalls_counts[iter];
@@ -137,7 +135,6 @@ remove_catch_syscall (struct bp_location *bl, enum remove_bp_reason reason)
     {
       for (int iter : c->syscalls_to_be_caught)
 	{
-          int elem;
 	  if (iter >= inf_data->syscalls_counts.size ())
 	    /* Shouldn't happen.  */
 	    continue;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index d4d095d..76bfd53 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -921,7 +921,6 @@ condition_completer (struct cmd_list_element *cmd,
     {
       int len;
       struct breakpoint *b;
-      VEC (char_ptr) *result = NULL;
 
       if (text[0] == '$')
 	{
@@ -11479,7 +11478,6 @@ clear_command (const char *arg, int from_tty)
 {
   struct breakpoint *b;
   int default_match;
-  int i;
 
   std::vector<symtab_and_line> decoded_sals;
   symtab_and_line last_sal;
@@ -13664,7 +13662,6 @@ update_breakpoint_locations (struct breakpoint *b,
 			     gdb::array_view<const symtab_and_line> sals,
 			     gdb::array_view<const symtab_and_line> sals_end)
 {
-  int i;
   struct bp_location *existing_locations;
 
   if (!sals_end.empty () && (sals.size () != 1 || sals_end.size () != 1))
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 8338ebf..4670b6f 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1636,7 +1636,6 @@ void
 btrace_disable (struct thread_info *tp)
 {
   struct btrace_thread_info *btp = &tp->btrace;
-  int errcode = 0;
 
   if (btp->target == NULL)
     return;
@@ -1656,7 +1655,6 @@ void
 btrace_teardown (struct thread_info *tp)
 {
   struct btrace_thread_info *btp = &tp->btrace;
-  int errcode = 0;
 
   if (btp->target == NULL)
     return;
@@ -3021,7 +3019,6 @@ btrace_maint_decode_pt (struct btrace_maint_info *maint,
 static void
 btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
 {
-  volatile struct gdb_exception except;
   struct pt_packet_decoder *decoder;
   struct btrace_data_pt *pt;
   struct pt_config config;
@@ -3358,7 +3355,6 @@ maint_btrace_clear_packet_history_cmd (const char *args, int from_tty)
 static void
 maint_btrace_clear_cmd (const char *args, int from_tty)
 {
-  struct btrace_thread_info *btinfo;
   struct thread_info *tp;
 
   if (args != NULL && *args != 0)
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 6140a17..81df308 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1386,7 +1386,7 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
 	      struct cmd_list_element **result_list, int ignore_help_classes)
 {
   char *command;
-  int len, tmp, nfound;
+  int len, nfound;
   struct cmd_list_element *found, *c;
   const char *line = *text;
 
@@ -1715,7 +1715,7 @@ lookup_cmd_composition (const char *text,
                       struct cmd_list_element **cmd)
 {
   char *command;
-  int len, tmp, nfound;
+  int len, nfound;
   struct cmd_list_element *cur_list;
   struct cmd_list_element *prev_cmd;
 
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index e97dabf..4322640 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -55,7 +55,6 @@ static gdb::unique_xmalloc_ptr<char>
 scan_filename (const char **cmd, const char *defname)
 {
   gdb::unique_xmalloc_ptr<char> filename;
-  char *fullname;
 
   /* FIXME: Need to get the ``/a(ppend)'' flag from somewhere.  */
 
@@ -516,7 +515,6 @@ static void
 restore_command (const char *args, int from_tty)
 {
   struct callback_data data;
-  bfd *ibfd;
   int binary_flag = 0;
 
   if (!target_has_execution)
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index ca26f13..2a340e8 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -389,7 +389,6 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
 		     int initial_depth,
 		     std::vector<struct insn_info> *info)
 {
-  unsigned char *set;
   std::vector<int> to_do;
   int stack_depth, i;
 
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index e69fbc6..f1c8ccd 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -608,15 +608,13 @@ compile_object_load (const compile_file_names &file_names,
 {
   struct cleanup *cleanups;
   struct setup_sections_data setup_sections_data;
-  CORE_ADDR addr, regs_addr, out_value_addr = 0;
+  CORE_ADDR regs_addr, out_value_addr = 0;
   struct symbol *func_sym;
   struct type *func_type;
   struct bound_minimal_symbol bmsym;
   long storage_needed;
   asymbol **symbol_table, **symp;
   long number_of_symbols, missing_symbols;
-  struct type *dptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
-  unsigned dptr_type_len = TYPE_LENGTH (dptr_type);
   struct compile_module *retval;
   struct type *regs_type, *out_value_type = NULL;
   char **matching;
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 9c36779..6580f39 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -116,8 +116,6 @@ void
 compile_object_run (struct compile_module *module)
 {
   struct value *func_val;
-  struct frame_id dummy_id;
-  struct cleanup *cleanups;
   struct do_module_cleanup *data;
   const char *objfile_name_s = objfile_name (module->objfile);
   int dtor_found, executed = 0;
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 9de244a..c47d7d2 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -462,7 +462,6 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
   int argc;
   char **argv;
   int ok;
-  FILE *src;
   struct gdbarch *gdbarch = get_current_arch ();
   char *triplet_rx;
   char *error_message;
diff --git a/gdb/completer.c b/gdb/completer.c
index 701f578..1cfabcd 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -154,7 +154,6 @@ filename_completer (struct cmd_list_element *ignore,
 		    const char *text, const char *word)
 {
   int subsequent_name;
-  VEC (char_ptr) *return_val = NULL;
 
   subsequent_name = 0;
   while (1)
@@ -429,7 +428,6 @@ static void
 complete_files_symbols (completion_tracker &tracker,
 			const char *text, const char *word)
 {
-  int ix;
   completion_list fn_list;
   const char *p;
   int quote_found = 0;
@@ -524,8 +522,6 @@ complete_files_symbols (completion_tracker &tracker,
 
   if (!fn_list.empty () && !tracker.have_completions ())
     {
-      char *fn;
-
       /* If we only have file names as possible completion, we should
 	 bring them in sync with what rl_complete expects.  The
 	 problem is that if the user types "break /foo/b TAB", and the
@@ -1081,7 +1077,6 @@ complete_expression (completion_tracker &tracker,
     }
   else if (fieldname && code != TYPE_CODE_UNDEF)
     {
-      VEC (char_ptr) *result;
       struct cleanup *cleanup = make_cleanup (xfree, fieldname);
 
       collect_symbol_completion_matches_type (tracker, fieldname, fieldname,
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 6800905..4214896 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -272,7 +272,6 @@ core_open (const char *arg, int from_tty)
   const char *p;
   int siggy;
   struct cleanup *old_chain;
-  char *temp;
   int scratch_chan;
   int flags;
 
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 35cf78c..e9bd6fe 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -313,7 +313,6 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
 {
   struct ctf_trace_file_writer *writer
     = (struct ctf_trace_file_writer *) self;
-  int i;
   mode_t hmode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH;
 
   /* Create DIRNAME.  */
@@ -453,7 +452,6 @@ ctf_write_status (struct trace_file_writer *self,
   struct ctf_trace_file_writer *writer
     = (struct ctf_trace_file_writer *) self;
   uint32_t id;
-  int32_t int32;
 
   ctf_save_write_metadata (&writer->tcs, "\n");
   ctf_save_write_metadata (&writer->tcs,
@@ -496,7 +494,6 @@ ctf_write_uploaded_tsv (struct trace_file_writer *self,
     = (struct ctf_trace_file_writer *) self;
   int32_t int32;
   int64_t int64;
-  unsigned int len;
   const gdb_byte zero = 0;
 
   /* Event Id.  */
@@ -618,9 +615,6 @@ ctf_write_tdesc (struct trace_file_writer *self)
 static void
 ctf_write_definition_end (struct trace_file_writer *self)
 {
-  struct ctf_trace_file_writer *writer
-    = (struct ctf_trace_file_writer *) self;
-
   self->ops->frame_ops->end (self);
 }
 
@@ -859,7 +853,6 @@ static void
 ctf_open_dir (const char *dirname)
 {
   struct bt_iter_pos begin_pos;
-  struct bt_iter_pos *pos;
   unsigned int count, i;
   struct bt_ctf_event_decl * const *list;
 
@@ -889,7 +882,6 @@ ctf_open_dir (const char *dirname)
   for (i = 0; i < count; i++)
     if (strcmp ("register", bt_ctf_get_decl_event_name (list[i])) == 0)
       {
-	unsigned int j;
 	const struct bt_ctf_field_decl * const *field_list;
 	const struct bt_declaration *decl;
 
@@ -1284,7 +1276,6 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
   if (get_traceframe_number () != -1)
     {
       struct bt_iter_pos *pos;
-      int i = 0;
       enum target_xfer_status res;
       /* Records the lowest available address of all blocks that
 	 intersects the requested range.  */
@@ -1302,8 +1293,6 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
 	  ULONGEST amt;
 	  uint64_t maddr;
 	  uint16_t mlen;
-	  enum bfd_endian byte_order
-	    = gdbarch_byte_order (target_gdbarch ());
 	  const struct bt_definition *scope;
 	  const struct bt_definition *def;
 	  struct bt_ctf_event *event
@@ -1336,8 +1325,6 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
 	    {
 	      const struct bt_definition *array
 		= bt_ctf_get_field (event, scope, "contents");
-	      const struct bt_declaration *decl
-		= bt_ctf_get_decl_from_def (array);
 	      gdb_byte *contents;
 	      int k;
 
@@ -1534,10 +1521,8 @@ static int
 ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
 		CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
 {
-  int ret = -1;
   int tfnum = 0;
   int found = 0;
-  struct bt_iter_pos pos;
 
   if (num == -1)
     {
@@ -1552,7 +1537,6 @@ ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
 
   while (1)
     {
-      int id;
       struct bt_ctf_event *event;
       const char *name;
 
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 4b2c8e6..ab629f6 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -263,7 +263,6 @@ gdb_pretty_print_disassembler::pretty_print_insn (struct ui_out *uiout,
       {
 	CORE_ADDR end_pc;
 	bfd_byte data;
-	int err;
 	const char *spacer = "";
 
 	/* Build the opcodes using a temporary stream so we can
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index fe2fea0..83a8c34 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1501,7 +1501,6 @@ allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
 			struct frame_info *frame)
 {
   struct piece_closure *c = new piece_closure;
-  int i;
 
   c->refc = 1;
   c->per_cu = per_cu;
@@ -2179,7 +2178,6 @@ indirect_pieced_value (struct value *value)
     = (struct piece_closure *) value_computed_closure (value);
   struct type *type;
   struct frame_info *frame;
-  struct dwarf2_locexpr_baton baton;
   int i, bit_length;
   LONGEST bit_offset;
   struct dwarf_expr_piece *piece = NULL;
@@ -2387,7 +2385,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
     {
       struct piece_closure *c;
       ULONGEST bit_size = 0;
-      int i;
 
       for (dwarf_expr_piece &piece : ctx.pieces)
 	bit_size += piece.size;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 78c663c..287de7b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4938,7 +4938,6 @@ dw2_expand_marked_cus
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    search_domain kind)
 {
-  const char *name;
   offset_type *vec, vec_len, vec_idx;
   bool global_seen = false;
 
@@ -5029,7 +5028,6 @@ dw2_expand_symtabs_matching
    enum search_domain kind)
 {
   int i;
-  offset_type iter;
 
   dw2_setup (objfile);
 
@@ -5213,7 +5211,6 @@ dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun,
 
       for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
 	{
-	  int j;
 	  struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
 	  struct quick_file_names *file_data;
 	  void **slot;
@@ -5553,7 +5550,6 @@ read_and_check_comp_unit_head (struct comp_unit_head *header,
 			       rcuh_kind section_kind)
 {
   const gdb_byte *beg_of_comp_unit = info_ptr;
-  bfd *abfd = get_section_bfd_owner (section);
 
   header->sect_off = (sect_offset) (beg_of_comp_unit - section->buffer);
 
@@ -6196,7 +6192,6 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
   struct dwarf2_section_info *section;
   bfd *abfd;
   const gdb_byte *begin_info_ptr, *info_ptr;
-  ULONGEST signature; /* Or dwo_id.  */
   struct attribute *comp_dir, *stmt_list, *low_pc, *high_pc, *ranges;
   int i,num_extra_attrs;
   struct dwarf2_section_info *dwo_abbrev_section;
@@ -6383,7 +6378,6 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
 		 struct die_info *comp_unit_die)
 {
   struct dwarf2_cu *cu = this_cu->cu;
-  struct attribute *attr;
   ULONGEST signature;
   struct dwo_unit *dwo_unit;
   const char *comp_dir, *dwo_name;
@@ -7651,7 +7645,6 @@ read_comp_units_from_section (struct objfile *objfile,
 			      struct dwarf2_per_cu_data ***all_comp_units)
 {
   const gdb_byte *info_ptr;
-  bfd *abfd = get_section_bfd_owner (section);
 
   if (dwarf_read_debug)
     fprintf_unfiltered (gdb_stdlog, "Reading %s for %s\n",
@@ -9666,7 +9659,6 @@ dwarf2_compute_name (const char *name,
     {
       if (die_needs_namespace (die, cu))
 	{
-	  long length;
 	  const char *prefix;
 	  const char *canonical_name = NULL;
 
@@ -10267,7 +10259,6 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
   struct attribute *attr;
   struct line_header line_header_local;
   hashval_t line_header_local_hash;
-  unsigned u;
   void **slot;
   int decode_mapping;
 
@@ -10739,7 +10730,6 @@ create_cus_hash_table (struct dwo_file &dwo_file, dwarf2_section_info &section,
 		       htab_t &cus_htab)
 {
   struct objfile *objfile = dwarf2_per_objfile->objfile;
-  const struct dwarf2_section_info *abbrev_section = &dwo_file.sections.abbrev;
   const gdb_byte *info_ptr, *end_ptr;
 
   dwarf2_read_section (objfile, &section);
@@ -11359,8 +11349,6 @@ create_dwp_v2_section (struct dwarf2_section_info *section,
   if (sectp == NULL
       || offset + size > bfd_get_section_size (sectp))
     {
-      bfd *abfd = sectp->owner;
-
       error (_("Dwarf Error: Bad DWP V2 section info, doesn't fit"
 	       " in section %s [in module %s]"),
 	     sectp ? bfd_section_name (abfd, sectp) : "<unknown>",
@@ -13118,18 +13106,11 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 			 Callback &&callback)
 {
   struct objfile *objfile = cu->objfile;
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct comp_unit_head *cu_header = &cu->header;
   bfd *obfd = objfile->obfd;
-  unsigned int addr_size = cu_header->addr_size;
-  CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
   /* Base address selection entry.  */
   CORE_ADDR base;
   int found_base;
-  unsigned int dummy;
   const gdb_byte *buffer;
-  CORE_ADDR low = 0;
-  CORE_ADDR high = 0;
   CORE_ADDR baseaddr;
   bool overflow = false;
 
@@ -13291,7 +13272,6 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
 		       Callback &&callback)
 {
   struct objfile *objfile = cu->objfile;
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   struct comp_unit_head *cu_header = &cu->header;
   bfd *obfd = objfile->obfd;
   unsigned int addr_size = cu_header->addr_size;
@@ -13665,7 +13645,6 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
   attr = dwarf2_attr (die, DW_AT_ranges, cu);
   if (attr)
     {
-      bfd *obfd = objfile->obfd;
       /* DW_AT_ranges_base does not apply to DIEs from the DWO skeleton.
 	 We take advantage of the fact that DW_AT_ranges does not appear
 	 in DW_TAG_compile_unit of DWO files.  */
@@ -14441,7 +14420,6 @@ static int
 is_vtable_name (const char *name, struct dwarf2_cu *cu)
 {
   static const char vptr[] = "_vptr";
-  static const char vtable[] = "vtable";
 
   /* Look for the C++ form of the vtable.  */
   if (startswith (name, vptr) && is_cplus_marker (name[sizeof (vptr) - 1]))
@@ -18733,7 +18711,6 @@ read_formatted_entries (bfd *abfd, const gdb_byte **bufp,
   ULONGEST data_count, datai;
   const gdb_byte *buf = *bufp;
   const gdb_byte *format_header_data;
-  int i;
   unsigned int bytes_read;
 
   format_count = read_1_byte (abfd, buf);
@@ -22793,7 +22770,6 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
 
     default:
       {
-      complain:
 	complaint (&symfile_complaints,
 		   _("invalid form 0x%x in `%s'"),
 		   form, get_section_name (section));
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b806ca3..b8881d9 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -237,7 +237,6 @@ elf_symtab_read (minimal_symbol_reader &reader,
   /* Name of the last file symbol.  This is either a constant string or is
      saved on the objfile's filename cache.  */
   const char *filesymname = "";
-  struct dbx_symfile_info *dbx = DBX_SYMFILE_INFO (objfile);
   int stripped = (bfd_get_symcount (objfile->obfd) == 0);
   int elf_make_msymbol_special_p
     = gdbarch_elf_make_msymbol_special_p (gdbarch);
diff --git a/gdb/exec.c b/gdb/exec.c
index 4fbe9dd..adff980 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -395,8 +395,6 @@ exec_file_attach (const char *filename, int from_tty)
 static void
 exec_file_command (const char *args, int from_tty)
 {
-  char *filename;
-
   if (from_tty && target_has_execution
       && !query (_("A program is being debugged already.\n"
 		   "Are you sure you want to change the file? ")))
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index c9ece0d..d16dc05 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -214,7 +214,6 @@ f_val_print (struct type *type, 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);
   int printed_field = 0; /* Number of fields printed.  */
   struct type *elttype;
   CORE_ADDR addr;
@@ -376,7 +375,6 @@ info_common_command_for_block (const struct block *block, const char *comname,
 {
   struct block_iterator iter;
   struct symbol *sym;
-  const char *name;
   struct value_print_options opts;
 
   get_user_print_options (&opts);
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index ccab17e..04c6f23 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-05  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* regcache.c (registers_to_string): Remove unused variable.
+
 2017-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* inferiors.c (for_each_inferior_with_data): Remove.
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 6a27042..c4ece0f 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -207,8 +207,6 @@ registers_to_string (struct regcache *regcache, char *buf)
 
   for (int i = 0; i < tdesc->reg_defs.size (); ++i)
     {
-      struct reg *reg = tdesc->reg_defs[i];
-
       if (regcache->register_status[i] == REG_VALID)
 	{
 	  bin2hex (registers, buf, register_size (tdesc, i));
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index bc3c45f..af1f9ae 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -605,7 +605,6 @@ static void
 initialize_scheme_side (void)
 {
   char *boot_scm_path;
-  char *msg;
 
   guile_datadir = concat (gdb_datadir, SLASH_STRING, "guile", (char *) NULL);
   boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb",
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index f84815e..c2d5c77 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -975,7 +975,6 @@ gdbscm_breakpoint_commands (SCM self)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct breakpoint *bp;
-  long length;
   SCM result;
 
   bp = bp_smob->bp;
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 4745def..bcc7462 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -385,7 +385,7 @@ cmdscm_completer (struct cmd_list_element *command,
 {
   command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
   SCM completer_result_scm;
-  SCM text_scm, word_scm, result_scm;
+  SCM text_scm, word_scm;
 
   gdb_assert (c_smob != NULL);
   gdb_assert (gdbscm_is_procedure (c_smob->complete));
@@ -746,7 +746,7 @@ gdbscm_register_command_x (SCM self)
 {
   command_smob *c_smob
     = cmdscm_get_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
-  char *cmd_name, *pfx_name;
+  char *cmd_name;
   struct cmd_list_element **cmd_list;
   struct cmd_list_element *cmd = NULL;
 
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 594d16e..fd5a60e 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -840,7 +840,6 @@ static SCM
 gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
 {
   SCM keywords[] = { block_keyword, SCM_BOOL_F };
-  int rc;
   frame_smob *f_smob;
   int block_arg_pos = -1;
   SCM block_scm = SCM_UNDEFINED;
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 9478778..79b5bb4 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -1062,7 +1062,6 @@ gdbscm_parameter_value (SCM self)
       char *name;
       SCM except_scm;
       struct cmd_list_element *alias, *prefix, *cmd;
-      const char *arg;
       char *newarg;
       int found = -1;
       struct gdb_exception except = exception_none;
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index a7c0bd4..340f505 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -98,10 +98,6 @@ static SCM input_port_scm;
 static SCM output_port_scm;
 static SCM error_port_scm;
 
-/* Magic number to identify port ui-files.
-   Actually, the address of this variable is the magic number.  */
-static int file_port_magic;
-
 /* Internal enum for specifying output port.  */
 enum oport { GDB_STDOUT, GDB_STDERR };
 
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index a28e4e6..45edcf1 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -381,7 +381,6 @@ ppscm_search_pp_list (SCM list, SCM value)
       SCM matcher = scm_car (list);
       SCM worker;
       pretty_printer_smob *pp_smob;
-      int rc;
 
       if (!ppscm_is_pretty_printer (matcher))
 	{
@@ -534,7 +533,6 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
   *out_value = NULL;
   TRY
     {
-      int rc;
       pretty_printer_worker_smob *w_smob
 	= (pretty_printer_worker_smob *) SCM_SMOB_DATA (printer);
 
@@ -744,7 +742,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
     = (pretty_printer_worker_smob *) SCM_SMOB_DATA (printer);
   int is_map, is_array, done_flag, pretty;
   unsigned int i;
-  SCM children, status;
+  SCM children;
   SCM iter = SCM_BOOL_F; /* -Wall */
   struct cleanup *cleanups;
 
@@ -799,7 +797,6 @@ ppscm_print_children (SCM printer, enum display_hint hint,
   done_flag = 0;
   for (i = 0; i < options->print_max; ++i)
     {
-      int rc;
       SCM scm_name, v_scm;
       char *name;
       SCM item = itscm_safe_call_next_x (iter, gdbscm_memory_error_p);
diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c
index 4e495eb..5adac4e 100644
--- a/gdb/guile/scm-string.c
+++ b/gdb/guile/scm-string.c
@@ -241,7 +241,6 @@ static SCM
 gdbscm_string_to_argv (SCM string_scm)
 {
   char *string;
-  int i;
   SCM result = SCM_EOL;
 
   gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s",
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 755ea67..e5278a7 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -578,7 +578,6 @@ static SCM
 gdbscm_sal_symtab (SCM self)
 {
   sal_smob *s_smob = stscm_get_valid_sal_smob_arg (self, SCM_ARG1, FUNC_NAME);
-  const struct symtab_and_line *sal = &s_smob->sal;
 
   return s_smob->symtab_scm;
 }
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 704be88..922351d 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1090,7 +1090,7 @@ gdbscm_type_next_field_x (SCM self)
   type_smob *t_smob;
   struct type *type;
   SCM it_scm, result, progress, object;
-  int field, rc;
+  int field;
 
   it_scm = itscm_get_iterator_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   i_smob = (iterator_smob *) SCM_SMOB_DATA (it_scm);
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index b7c955d..c0557dd 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -381,7 +381,7 @@ gdbscm_parse_function_args (const char *func_name,
 {
   va_list args;
   const char *p;
-  int i, have_rest, num_keywords, length, position;
+  int i, have_rest, num_keywords, position;
   int have_optional = 0;
   SCM status;
   SCM rest = SCM_EOL;
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 8104808..12d5a24 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4518,8 +4518,8 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
   const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p,
       ymm_regnum_p, ymmh_regnum_p, ymm_avx512_regnum_p, ymmh_avx512_regnum_p,
-      bndr_regnum_p, bnd_regnum_p, k_regnum_p, zmm_regnum_p, zmmh_regnum_p,
-      zmm_avx512_regnum_p, mpx_ctrl_regnum_p, xmm_avx512_regnum_p,
+      bndr_regnum_p, bnd_regnum_p, zmm_regnum_p, zmmh_regnum_p,
+      mpx_ctrl_regnum_p, xmm_avx512_regnum_p,
       avx512_p, avx_p, sse_p, pkru_regnum_p;
 
   /* Don't include pseudo registers, except for MMX, in any register
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9cee174..8bde28e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -569,7 +569,6 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
   struct ui_out *uiout = current_uiout;
   struct target_ops *run_target;
   int async_exec;
-  CORE_ADDR pc;
 
   dont_repeat ();
 
@@ -1497,8 +1496,6 @@ until_next_fsm_should_stop (struct thread_fsm *self,
 static void
 until_next_fsm_clean_up (struct thread_fsm *self, struct thread_info *thread)
 {
-  struct until_next_fsm *sm = (struct until_next_fsm *) self;
-
   delete_longjmp_breakpoint (thread->global_num);
 }
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index e9664a0..09758762 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3113,7 +3113,6 @@ linespec_complete (completion_tracker &tracker, const char *text,
 	 the ':', then complete_linespec_component won't try to
 	 complete on source filenames.  */
 
-      const char *text = parser.completion_word;
       const char *word = parser.completion_word;
 
       complete_linespec_component (&parser, tracker,
@@ -4159,7 +4158,6 @@ find_label_symbols (struct linespec_state *self,
 {
   int ix;
   const struct block *block;
-  struct symbol *sym;
   struct symbol *fn_sym;
   VEC (symbolp) *result = NULL;
 
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 9660fe7..344a376 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -313,7 +313,6 @@ m2_val_print (struct type *type, int embedded_offset,
 	      struct value *original_value,
 	      const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
   unsigned len;
   struct type *elttype;
   CORE_ADDR addr;
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 02b93e8..aa772ef 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -74,9 +74,6 @@ show_inaccessible_by_default (struct ui_file *file, int from_tty,
 static void
 require_user_regions (int from_tty)
 {
-  struct mem_region *m;
-  int ix, length;
-
   /* If we're already using a user-provided list, nothing to do.  */
   if (!mem_use_target ())
     return;
@@ -166,10 +163,8 @@ struct mem_region *
 lookup_mem_region (CORE_ADDR addr)
 {
   static struct mem_region region (0, 0);
-  struct mem_region *m;
   CORE_ADDR lo;
   CORE_ADDR hi;
-  int ix;
 
   require_target_regions ();
 
@@ -531,9 +526,6 @@ disable_mem_command (const char *args, int from_tty)
 
   if (args == NULL || *args == '\0')
     {
-      struct mem_region *m;
-      int ix;
-
       for (mem_region &m : *mem_region_list)
 	m.enabled_p = false;
     }
@@ -553,9 +545,6 @@ disable_mem_command (const char *args, int from_tty)
 static void
 mem_delete (int num)
 {
-  struct mem_region *m;
-  int ix;
-
   if (!mem_region_list)
     {
       printf_unfiltered (_("No memory region number %d.\n"), num);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index bf08ca1..202cccb 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -927,8 +927,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 */
@@ -1673,7 +1671,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];
   CORE_ADDR after_last_frame_setup_insn = start_pc;
 
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index a39ef3b..b6a1d9b 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -119,7 +119,6 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
   struct ui_out *uiout = current_uiout;
   const char *pattern;
   struct so_list *so = NULL;
-  struct gdbarch *gdbarch = target_gdbarch ();
 
   switch (argc)
     {
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index d845a9c..bbf537d 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -284,7 +284,6 @@ mi_execute_command_wrapper (const char *cmd)
 static void
 mi_on_sync_execution_done (void)
 {
-  struct ui *ui = current_ui;
   struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
 
   if (mi == NULL)
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 3261488..3c04f59 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2605,8 +2605,6 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
 
   /* Explicitly wholly collected variables.  */
   {
-    int i;
-
     ui_out_emit_list list_emitter (uiout, "explicit-variables");
     const std::vector<std::string> &wholly_collected
       = clist->wholly_collected ();
@@ -2619,9 +2617,6 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
 
   /* Computed expressions.  */
   {
-    char *p;
-    int i;
-
     ui_out_emit_list list_emitter (uiout, "computed-expressions");
 
     const std::vector<std::string> &computed = clist->computed ();
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 285eefe..4fdf106 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -119,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/minidebug.c b/gdb/minidebug.c
index d4687dd..fd00e60 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -83,7 +83,6 @@ lzma_open (struct bfd *nbfd, void *open_closure)
   gdb_byte footer[LZMA_STREAM_HEADER_SIZE];
   gdb_byte *indexdata;
   lzma_index *index;
-  int ret;
   uint64_t memlimit = UINT64_MAX;
   struct gdb_lzma_stream *lstream;
   size_t pos;
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index d68fb65..123d466 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -330,8 +330,6 @@ lookup_minimal_symbol (const char *name, const char *sfile,
        objfile != NULL && found.external_symbol.minsym == NULL;
        objfile = objfile->next)
     {
-      struct minimal_symbol *msymbol;
-
       if (objf == NULL || objf == objfile
 	  || objf == objfile->separate_debug_objfile_backlink)
 	{
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index ebdacd9..53d3f19 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -530,7 +530,6 @@ mips64_fill_fpregset (const struct regcache *regcache,
 		      mips64_elf_fpregset_t *fpregsetp, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   gdb_byte *to;
 
   if ((regno >= gdbarch_fp0_regnum (gdbarch))
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 830535f..a09f644 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3781,7 +3781,6 @@ mips_stub_frame_sniffer (const struct frame_unwind *self,
 			 struct frame_info *this_frame, void **this_cache)
 {
   gdb_byte dummy[4];
-  struct obj_section *s;
   CORE_ADDR pc = get_frame_address_in_block (this_frame);
   struct bound_minimal_symbol msym;
 
@@ -6074,7 +6073,6 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
 {
   CORE_ADDR func_addr = function ? find_function_addr (function, NULL) : 0;
   int mips16 = mips_pc_is_mips16 (gdbarch, func_addr);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum mips_fval_reg fval_reg;
 
   fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
@@ -6593,11 +6591,9 @@ static int
 mips_single_step_through_delay (struct gdbarch *gdbarch,
 				struct frame_info *frame)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR pc = get_frame_pc (frame);
   enum mips_isa isa;
   ULONGEST insn;
-  int status;
   int size;
 
   if ((mips_pc_is_mips (pc)
@@ -8969,7 +8965,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/nios2-tdep.c b/gdb/nios2-tdep.c
index 0a9f138..51300d0 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1817,7 +1817,6 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                        int struct_return, CORE_ADDR struct_addr)
 {
   int argreg;
-  int float_argreg;
   int argnum;
   int len = 0;
   int stack_offset = 0;
@@ -2209,7 +2208,6 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
 static std::vector<CORE_ADDR>
 nios2_software_single_step (struct regcache *regcache)
 {
-  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR next_pc = nios2_get_next_pc (regcache, regcache_read_pc (regcache));
 
   return {next_pc};
diff --git a/gdb/parse.c b/gdb/parse.c
index 506efa3..dff519b 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -502,8 +502,6 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
   if (address_p != NULL)
     *address_p = addr;
 
-  struct type *the_type;
-
   switch (type)
     {
     case mst_text:
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c74ea21..c87ef25 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -803,7 +803,6 @@ psym_relocate (struct objfile *objfile,
 	       const struct section_offsets *new_offsets,
 	       const struct section_offsets *delta)
 {
-  struct partial_symbol **psym;
   struct partial_symtab *p;
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 5bc073e..2574683 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -484,8 +484,6 @@ bppy_get_commands (PyObject *self, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   struct breakpoint *bp = self_bp->bp;
-  long length;
-  PyObject *result;
 
   BPPY_REQUIRE_VALID (self_bp);
 
@@ -936,7 +934,6 @@ gdbpy_breakpoint_modified (struct breakpoint *b)
   int num = b->number;
   PyGILState_STATE state;
   struct breakpoint *bp = NULL;
-  gdbpy_breakpoint_object *bp_obj;
 
   state = PyGILState_Ensure ();
   bp = get_breakpoint (num);
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index 825a892..2464f8b 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -29,7 +29,6 @@ create_inferior_call_event_object (inferior_call_kind flag, ptid_t ptid,
 				   CORE_ADDR addr)
 {
   gdbpy_ref<> event;
-  int failed;
 
   switch (flag)
     {
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 220990b..55f673e 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -464,7 +464,6 @@ static PyObject *
 btpy_list_item (PyObject *self, Py_ssize_t index)
 {
   const btpy_list_object * const obj = (btpy_list_object *) self;
-  struct thread_info * const tinfo = find_thread_ptid (obj->ptid);
   Py_ssize_t number;
 
   if (index < 0 || index >= btpy_list_length (self))
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 51184ca..1453df5 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -965,7 +965,6 @@ static PyObject *
 typy_str (PyObject *self)
 {
   string_file thetype;
-  PyObject *result;
 
   TRY
     {
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 11f1fc9..b1ab824 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -874,7 +874,6 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
   struct value *function = ((value_object *) self)->value;
   struct value **vargs = NULL;
   struct type *ftype = NULL;
-  struct value *mark = value_mark ();
   PyObject *result = NULL;
 
   TRY
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c29a46b..44ca121 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1660,7 +1660,6 @@ static bool
 do_start_initialization ()
 {
 #ifdef IS_PY3K
-  int i;
   size_t progsize, count;
   wchar_t *progname_copy;
 #endif
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 07ef912..452e4c7 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -810,7 +810,6 @@ record_btrace_insn_history_range (struct target_ops *self,
 				  gdb_disassembly_flags flags)
 {
   struct btrace_thread_info *btinfo;
-  struct btrace_insn_history *history;
   struct btrace_insn_iterator begin, end;
   struct ui_out *uiout;
   unsigned int low, high;
@@ -1167,7 +1166,6 @@ record_btrace_call_history_range (struct target_ops *self,
 				  int int_flags)
 {
   struct btrace_thread_info *btinfo;
-  struct btrace_call_history *history;
   struct btrace_call_iterator begin, end;
   struct ui_out *uiout;
   unsigned int low, high;
@@ -1251,7 +1249,6 @@ record_btrace_call_history_from (struct target_ops *self,
 static enum record_method
 record_btrace_record_method (struct target_ops *self, ptid_t ptid)
 {
-  const struct btrace_config *config;
   struct thread_info * const tp = find_thread_ptid (ptid);
 
   if (tp == NULL)
@@ -1293,8 +1290,6 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
 			    const gdb_byte *writebuf, ULONGEST offset,
 			    ULONGEST len, ULONGEST *xfered_len)
 {
-  struct target_ops *t;
-
   /* Filter out requests that don't make sense during replay.  */
   if (replay_memory_access == replay_memory_access_read_only
       && !record_btrace_generating_corefile
@@ -1545,7 +1540,6 @@ static const struct btrace_function *
 btrace_get_frame_function (struct frame_info *frame)
 {
   const struct btrace_frame_cache *cache;
-  const struct btrace_function *bfun;
   struct btrace_frame_cache pattern;
   void **slot;
 
diff --git a/gdb/record-full.c b/gdb/record-full.c
index ec6fc69..b49f54c 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -828,8 +828,6 @@ static void record_full_init_record_breakpoints (void);
 static void
 record_full_open (const char *name, int from_tty)
 {
-  struct target_ops *t;
-
   if (record_debug)
     fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open\n");
 
diff --git a/gdb/record.c b/gdb/record.c
index b53c0bc..5b554d4 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -452,7 +452,6 @@ get_context_size (const char **arg)
 {
   const char *pos;
   char *end;
-  int number;
 
   pos = skip_spaces (*arg);
 
diff --git a/gdb/registry.h b/gdb/registry.h
index 1efa3f9..7f61ba2 100644
--- a/gdb/registry.h
+++ b/gdb/registry.h
@@ -158,8 +158,6 @@ const struct TAG ## _data *						\
 register_ ## TAG ## _data_with_cleanup (void (*save) (struct TAG *, void *), \
 					void (*free) (struct TAG *, void *)) \
 {									\
-  struct registry_data_registration **curr;				\
-									\
   return (struct TAG ## _data *)					\
     register_data_with_cleanup (&TAG ## _data_registry,			\
 				(registry_data_callback) save,		\
@@ -186,8 +184,6 @@ TAG ## registry_callback_adaptor (registry_data_callback func,		\
 				  void *data)				\
 {									\
   struct TAG *tagged_container = (struct TAG *) container;		\
-  struct registry_fields *rdata						\
-    = &ACCESS (tagged_container)->registry_data;			\
 									\
   registry_ ## TAG ## _callback tagged_func				\
     = (registry_ ## TAG ## _callback) func;				\
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 8771893..0bd7b96 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -1169,8 +1169,6 @@ remote_fileio_reset (void)
 void
 remote_fileio_request (char *buf, int ctrlc_pending_p)
 {
-  int ex;
-
   /* Save the previous quit handler, so we can restore it.  No need
      for a cleanup since we catch all exceptions below.  Note that the
      quit handler is also restored by remote_fileio_reply just before
diff --git a/gdb/remote.c b/gdb/remote.c
index 0a62ae0..be2c65b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3222,7 +3222,6 @@ remote_update_thread_list (struct target_ops *ops)
       || remote_get_threads_with_qthreadinfo (ops, &context)
       || remote_get_threads_with_ql (ops, &context))
     {
-      int i;
       struct thread_info *tp, *tmp;
 
       got_list = 1;
@@ -4352,7 +4351,6 @@ init_all_packet_configs (void)
 static void
 remote_check_symbols (void)
 {
-  struct remote_state *rs = get_remote_state ();
   char *msg, *reply, *tmp;
   int end;
   long reply_size;
@@ -5869,7 +5867,6 @@ vcont_builder_push_action (struct vcont_builder *builder,
 static void
 remote_commit_resume (struct target_ops *ops)
 {
-  struct remote_state *rs = get_remote_state ();
   struct inferior *inf;
   struct thread_info *tp;
   int any_process_wildcard;
@@ -6167,8 +6164,6 @@ remote_stop (struct target_ops *self, ptid_t ptid)
 static void
 remote_interrupt (struct target_ops *self, ptid_t ptid)
 {
-  struct remote_state *rs = get_remote_state ();
-
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "remote_interrupt called\n");
 
@@ -9768,7 +9763,6 @@ remote_insert_breakpoint (struct target_ops *ops,
       CORE_ADDR addr = bp_tgt->reqstd_address;
       struct remote_state *rs;
       char *p, *endbuf;
-      int bpsize;
 
       /* Make sure the remote is pointing at the right process, if
 	 necessary.  */
@@ -10226,7 +10220,6 @@ static void
 compare_sections_command (const char *args, int from_tty)
 {
   asection *s;
-  gdb_byte *sectdata;
   const char *sectname;
   bfd_size_type size;
   bfd_vma lma;
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index e372a6e..731a039 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -1011,7 +1011,6 @@ super_name (const struct rust_op *ident, unsigned int n_supers)
 
   if (n_supers > 0)
     {
-      int i;
       int len;
       std::vector<int> offsets;
       unsigned int current_len;
@@ -1251,7 +1250,6 @@ lex_string (void)
 {
   int is_byte = lexptr[0] == 'b';
   int raw_length;
-  int len_in_chars = 0;
 
   if (is_byte)
     ++lexptr;
@@ -2069,7 +2067,6 @@ convert_ast_to_type (struct parser_state *state,
 	std::vector<struct type *> args
 	  (convert_params_to_types (state, operation->left.params));
 	int i;
-	struct type *type;
 	const char *name;
 
 	obstack_1grow (work_obstack, '(');
@@ -2397,7 +2394,6 @@ convert_ast_to_expression (struct parser_state *state,
 
     case OP_AGGREGATE:
       {
-	int i;
 	int length;
 	rust_set_vector *fields = operation->right.field_inits;
 	struct type *type;
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index f3562e0..535a72b 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -848,8 +848,6 @@ rust_print_struct_def (struct type *type, const char *varstring,
 
   for (i = 0; i < TYPE_NFIELDS (type); ++i)
     {
-      const char *name;
-
       QUIT;
       if (field_is_static (&TYPE_FIELD (type, i)))
 	continue;
@@ -997,7 +995,7 @@ rust_print_type (struct type *type, const char *varstring,
     case TYPE_CODE_UNION:
       {
 	/* ADT enums.  */
-	int i, len = 0;
+	int i;
 	/* Skip the discriminant field.  */
 	int skip_to = 1;
 
@@ -1780,7 +1778,6 @@ rust_evaluate_subexp (struct type *expect_type, struct expression *exp,
 
 	if (noside == EVAL_NORMAL)
 	  {
-	    CORE_ADDR addr;
 	    int i;
 	    std::vector<struct value *> eltvec (copies);
 
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 7d0436c..c4631ab 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -214,8 +214,6 @@ rx_fpsw_type (struct gdbarch *gdbarch)
 static struct type *
 rx_register_type (struct gdbarch *gdbarch, int reg_nr)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
   if (reg_nr == RX_PC_REGNUM)
     return builtin_type (gdbarch)->builtin_func_ptr;
   else if (reg_nr == RX_PSW_REGNUM || reg_nr == RX_BPSW_REGNUM)
diff --git a/gdb/ser-event.c b/gdb/ser-event.c
index 8b88ca0..1280c6e 100644
--- a/gdb/ser-event.c
+++ b/gdb/ser-event.c
@@ -202,7 +202,6 @@ void
 serial_event_clear (struct serial_event *event)
 {
   struct serial *ser = (struct serial *) event;
-  struct serial_event_state *state = (struct serial_event_state *) ser->state;
 #ifndef USE_WIN32API
   int r;
 
@@ -214,6 +213,7 @@ serial_event_clear (struct serial_event *event)
     }
   while (r > 0 || (r < 0 && errno == EINTR));
 #else
+  struct serial_event_state *state = (struct serial_event_state *) ser->state;
   ResetEvent (state->event);
 #endif
 }
diff --git a/gdb/serial.c b/gdb/serial.c
index a2895d2..c6256fe 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -203,7 +203,6 @@ static struct serial *serial_open_ops_1 (const struct serial_ops *ops,
 struct serial *
 serial_open (const char *name)
 {
-  struct serial *scb;
   const struct serial_ops *ops;
   const char *open_name = name;
 
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 34a536a..fb9a5d8 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1915,7 +1915,6 @@ 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;
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 8f45d45..5a1447d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2979,7 +2979,6 @@ 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
@@ -3109,7 +3108,6 @@ 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)
@@ -3128,7 +3126,6 @@ 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)
@@ -3526,7 +3523,6 @@ static int
 simple_overlay_update_1 (struct obj_section *osect)
 {
   int i;
-  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;
@@ -3599,7 +3595,6 @@ simple_overlay_update (struct obj_section *osect)
     if (section_is_overlay (osect))
     {
       int i;
-      bfd *obfd = osect->objfile->obfd;
       asection *bsect = osect->the_bfd_section;
 
       for (i = 0; i < cache_novlys; i++)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index dd7434e..996d521 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -729,7 +729,6 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
 {
   char *demangled = NULL;
   int i;
-  int recognized;
 
   if (gsymbol->language == language_unknown)
     gsymbol->language = language_auto;
@@ -4283,7 +4282,6 @@ search_symbols (const char *regexp, enum search_domain kind,
          and <TYPENAME> or <OPERATOR>.  */
       const char *opend;
       const char *opname = operator_chars (regexp, &opend);
-      int errcode;
 
       if (*opname)
 	{
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 7896dd1..1a90110 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -831,10 +831,7 @@ static struct tdesc_type tdesc_predefined_types[] =
 static struct tdesc_type *
 tdesc_predefined_type (enum tdesc_type_kind kind)
 {
-  int ix;
-  struct tdesc_type *type;
-
-  for (ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
+  for (int ix = 0; ix < ARRAY_SIZE (tdesc_predefined_types); ix++)
     if (tdesc_predefined_types[ix].kind == kind)
       return &tdesc_predefined_types[ix];
 
diff --git a/gdb/target.c b/gdb/target.c
index 3bfc8b5..3b8b8ea 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2231,8 +2231,6 @@ static int defer_target_commit_resume;
 void
 target_commit_resume (void)
 {
-  struct target_ops *t;
-
   if (defer_target_commit_resume)
     return;
 
diff --git a/gdb/thread.c b/gdb/thread.c
index 052549a..9a55346 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1943,7 +1943,6 @@ print_selected_thread_frame (struct ui_out *uiout,
 			     user_selected_what selection)
 {
   struct thread_info *tp = inferior_thread ();
-  struct inferior *inf = current_inferior ();
 
   if (selection & USER_SELECTED_THREAD)
     {
diff --git a/gdb/top.c b/gdb/top.c
index 8cd7c99..3fb113c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -326,10 +326,8 @@ open_terminal_stream (const char *name)
 static void
 new_ui_command (const char *args, int from_tty)
 {
-  struct interp *interp;
   gdb_file_up stream[3];
   int i;
-  int res;
   int argc;
   const char *interpreter_name;
   const char *tty_name;
@@ -750,7 +748,6 @@ gdb_readline_no_editing (const char *prompt)
   while (1)
     {
       int c;
-      int numfds;
       fd_set readfds;
 
       QUIT;
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 6ef904d..54b9148 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -422,7 +422,6 @@ tfile_read (gdb_byte *readbuf, int size)
 static void
 tfile_open (const char *arg, int from_tty)
 {
-  char *temp;
   int flags;
   int scratch_chan;
   char header[TRACE_HEADER_SIZE];
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 76d05df..550a72f 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3265,7 +3265,6 @@ create_tsv_from_upload (struct uploaded_tsv *utsv)
   std::string buf;
   int try_num = 0;
   struct trace_state_variable *tsv;
-  struct cleanup *old_chain;
 
   if (utsv->name)
     {
diff --git a/gdb/utils.c b/gdb/utils.c
index 98ef6ac..b95dcfd 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -730,8 +730,6 @@ print_sys_errmsg (const char *string, int errcode)
 void
 quit (void)
 {
-  struct ui *ui = current_ui;
-
   if (sync_quit_force_run)
     {
       sync_quit_force_run = 0;
@@ -892,7 +890,6 @@ private:
 static int ATTRIBUTE_PRINTF (1, 0)
 defaulted_query (const char *ctlstr, const char defchar, va_list args)
 {
-  int ans2;
   int retval;
   int def_value;
   char def_answer, not_def_answer;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 89e44f3..f3b44f9 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -657,7 +657,6 @@ value_concat (struct value *arg1, struct value *arg2)
   struct value *outval = NULL;
   int inval1len, inval2len;
   int count, idx;
-  char *ptr;
   char inchar;
   struct type *type1 = check_typedef (value_type (arg1));
   struct type *type2 = check_typedef (value_type (arg2));
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 307c304..7bd7bee 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -455,7 +455,6 @@ xml_list_syscalls_by_group (struct gdbarch *gdbarch, const char *group)
 {
   struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
   struct syscall_group_desc *groupdesc;
-  struct syscall_desc *sysdesc;
   struct syscall *syscalls = NULL;
   int nsyscalls;
   int i;
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index 5a1f459..a50ac5e 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -740,8 +740,6 @@ target_fetch_description_xml (struct target_ops *ops)
 
   return {};
 #else
-  struct target_desc *tdesc;
-
   gdb::unique_xmalloc_ptr<char>
     tdesc_str = fetch_available_features_from_target ("target.xml", ops);
   if (tdesc_str == NULL)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 0b0ec2e..4af6184 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -551,8 +551,6 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
 			     int regnum,
 			     gdb_byte *buffer)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-
   DEBUGTRACE ("xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
 	      regnum, xtensa_register_name (gdbarch, regnum));
 
@@ -647,8 +645,6 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
 			      int regnum,
 			      const gdb_byte *buffer)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-
   DEBUGTRACE ("xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
 	      regnum, xtensa_register_name (gdbarch, regnum));
 
-- 
2.7.4


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