Patchwork [ob/pushed] Darwin: Remove unused variables [-Werror=unused-variable]

login
register
mail settings
Submitter Pedro Alves
Date Sept. 30, 2018, 4:39 p.m.
Message ID <20180930163903.19570-1-palves@redhat.com>
Download mbox | patch
Permalink /patch/29589/
State New
Headers show

Comments

Pedro Alves - Sept. 30, 2018, 4:39 p.m.
Building GDB with --host=x86_64-apple-darwin15 using G++ 5.3.0 runs
into a number of -Werror=unused-variable warnings/errors:

  ../../src/gdb/i386-darwin-nat.c: In function 'void i386_darwin_dr_set(int, CORE_ADDR)':
  ../../src/gdb/i386-darwin-nat.c:283:7: error: unused variable 'current_pid' [-Werror=unused-variable]
     int current_pid;
	 ^
  [etc, etc.]

This commit fixes all such warnings.

gdb/ChangeLog:
2018-09-30  Pedro Alves  <palves@redhat.com>

	* darwin-nat-info.c (darwin_debug_regions_recurse)
	(info_mach_exceptions_command): Remove unused local variables.
	* darwin-nat.c (darwin_decode_notify_message)
	(darwin_nat_target::resume, darwin_nat_target::mourn_inferior)
	(darwin_stop_inferior, darwin_setup_exceptions)
	(darwin_nat_target::kill, darwin_attach_pid, darwin_ptrace_him)
	(darwin_nat_target::attach, darwin_nat_target::detach)
	(darwin_read_write_inferior, darwin_read_dyld_info): Remove unused
	local variables.
	* i386-darwin-nat.c (i386_darwin_dr_set): Remove unused local
	variables.
---
 gdb/ChangeLog         | 14 ++++++++++++++
 gdb/darwin-nat-info.c |  4 ----
 gdb/darwin-nat.c      | 32 --------------------------------
 gdb/i386-darwin-nat.c |  1 -
 4 files changed, 14 insertions(+), 37 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d5787816dc..31d06708e3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@ 
+2018-09-30  Pedro Alves  <palves@redhat.com>
+
+	* darwin-nat-info.c (darwin_debug_regions_recurse)
+	(info_mach_exceptions_command): Remove unused local variables.
+	* darwin-nat.c (darwin_decode_notify_message)
+	(darwin_nat_target::resume, darwin_nat_target::mourn_inferior)
+	(darwin_stop_inferior, darwin_setup_exceptions)
+	(darwin_nat_target::kill, darwin_attach_pid, darwin_ptrace_him)
+	(darwin_nat_target::attach, darwin_nat_target::detach)
+	(darwin_read_write_inferior, darwin_read_dyld_info): Remove unused
+	local variables.
+	* i386-darwin-nat.c (i386_darwin_dr_set): Remove unused local
+	variables.
+
 2018-09-29  Tom Tromey  <tom@tromey.com>
 
 	* README: Remove some leftover text.
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index f3c8de286a..8c814a91a6 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -607,14 +607,12 @@  darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
 static void
 darwin_debug_regions_recurse (task_t task)
 {
-  mach_vm_address_t r_addr;
   mach_vm_address_t r_start;
   mach_vm_size_t r_size;
   natural_t r_depth;
   mach_msg_type_number_t r_info_size;
   vm_region_submap_short_info_data_64_t r_info;
   kern_return_t kret;
-  int ret;
   struct ui_out *uiout = current_uiout;
 
   ui_out_emit_table table_emitter (uiout, 9, -1, "regions");
@@ -792,8 +790,6 @@  disp_exception (const darwin_exception_info *info)
 static void
 info_mach_exceptions_command (const char *args, int from_tty)
 {
-  int i;
-  task_t task;
   kern_return_t kret;
   darwin_exception_info info;
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index eee9380d65..ecc7635d04 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -746,11 +746,7 @@  darwin_decode_notify_message (mach_msg_header_t *hdr, struct inferior **pinf)
   NDR_record_t *ndr = (NDR_record_t *)(hdr + 1);
   integer_t *data = (integer_t *)(ndr + 1);
   struct inferior *inf;
-  darwin_thread_t *thread;
   task_t task_port;
-  thread_t thread_port;
-  kern_return_t kret;
-  int i;
 
   /* Check message header.  */
   if (hdr->msgh_bits & MACH_MSGH_BITS_COMPLEX)
@@ -939,12 +935,8 @@  void
 darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
 {
   struct target_waitstatus status;
-  int pid;
 
-  kern_return_t kret;
-  int res;
   int nsignal;
-  struct inferior *inf;
 
   inferior_debug
     (2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"),
@@ -1361,7 +1353,6 @@  darwin_nat_target::mourn_inferior ()
   darwin_inferior *priv = get_darwin_inferior (inf);
   kern_return_t kret;
   mach_port_t prev;
-  int i;
 
   /* Deallocate threads.  */
   darwin_deallocate_threads (inf);
@@ -1420,8 +1411,6 @@  darwin_stop_inferior (struct inferior *inf)
 {
   struct target_waitstatus wstatus;
   ptid_t ptid;
-  kern_return_t kret;
-  int status;
   int res;
   darwin_inferior *priv = get_darwin_inferior (inf);
 
@@ -1502,7 +1491,6 @@  darwin_setup_exceptions (struct inferior *inf)
 {
   darwin_inferior *priv = get_darwin_inferior (inf);
   kern_return_t kret;
-  int traps_expected;
   exception_mask_t mask;
 
   kret = darwin_save_exception_ports (priv);
@@ -1532,7 +1520,6 @@  darwin_nat_target::kill ()
   struct target_waitstatus wstatus;
   ptid_t ptid;
   kern_return_t kret;
-  int status;
   int res;
 
   if (inferior_ptid == null_ptid)
@@ -1611,10 +1598,6 @@  static void
 darwin_attach_pid (struct inferior *inf)
 {
   kern_return_t kret;
-  mach_port_t prev_port;
-  int traps_expected;
-  mach_port_t prev_not;
-  exception_mask_t mask;
 
   darwin_inferior *priv = new darwin_inferior;
   inf->priv.reset (priv);
@@ -1800,10 +1783,6 @@  darwin_pre_ptrace (void)
 static void
 darwin_ptrace_him (int pid)
 {
-  task_t itask;
-  kern_return_t kret;
-  mach_port_t prev_port;
-  int traps_expected;
   struct inferior *inf = current_inferior ();
 
   darwin_attach_pid (inf);
@@ -1927,11 +1906,7 @@  void
 darwin_nat_target::attach (const char *args, int from_tty)
 {
   pid_t pid;
-  pid_t pid2;
-  int wstatus;
-  int res;
   struct inferior *inf;
-  kern_return_t kret;
 
   pid = parse_pid_to_attach (args);
 
@@ -1987,7 +1962,6 @@  darwin_nat_target::attach (const char *args, int from_tty)
 void
 darwin_nat_target::detach (inferior *inf, int from_tty)
 {
-  pid_t pid = inferior_ptid.pid ();
   darwin_inferior *priv = get_darwin_inferior (inf);
   kern_return_t kret;
   int res;
@@ -2056,11 +2030,6 @@  darwin_read_write_inferior (task_t task, CORE_ADDR addr,
 {
   kern_return_t kret;
   mach_vm_size_t res_length = 0;
-  pointer_t copied;
-  mach_msg_type_number_t copy_count;
-  mach_vm_size_t remaining_length;
-  mach_vm_address_t region_address;
-  mach_vm_size_t region_length;
 
   inferior_debug (8, _("darwin_read_write_inferior(task=0x%x, %s, len=%s)\n"),
 		  task, core_addr_to_string (addr), pulongest (length));
@@ -2214,7 +2183,6 @@  darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
 {
   struct task_dyld_info task_dyld_info;
   mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT;
-  int sz = TASK_DYLD_INFO_COUNT * sizeof (natural_t);
   kern_return_t kret;
 
   if (addr != 0 || length > sizeof (mach_vm_address_t))
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 2304f4a6d3..820aff90cc 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -280,7 +280,6 @@  i386_darwin_nat_target::store_registers (struct regcache *regcache,
 static void
 i386_darwin_dr_set (int regnum, CORE_ADDR value)
 {
-  int current_pid;
   thread_t current_thread;
   x86_debug_state_t dr_regs;
   kern_return_t ret;