This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Remove unused variable in gdb/varobj.c when built without Python support


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e3821cca157e93677ef098bf36526ccf24f497ac

commit e3821cca157e93677ef098bf36526ccf24f497ac
Author: Pedro Alves <palves@redhat.com>
Date:   Thu Jul 21 15:29:58 2016 +0100

    Remove unused variable in gdb/varobj.c when built without Python support
    
    gdb/ChangeLog:
    2016-07-21  Pedro Alves  <palves@redhat.com>
    
    	* varobj.c (varobj_value_get_print_value): Move "gdbarch" to block
    	scope that uses it.

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/varobj.c  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2988cda..d074a3d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-21  Pedro Alves  <palves@redhat.com>
+
+	* varobj.c (varobj_value_get_print_value): Move "gdbarch" to block
+	scope that uses it.
+
 2016-07-20  John Baldwin  <jhb@FreeBSD.org>
 
 	* fbsd-nat.c (fbsd_enable_proc_events): Enable "PTRACE_VFORK"
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 6f56cba..fb1349a 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2453,7 +2453,6 @@ varobj_value_get_print_value (struct value *value,
   struct type *type = NULL;
   long len = 0;
   char *encoding = NULL;
-  struct gdbarch *gdbarch = NULL;
   /* Initialize it just to avoid a GCC false warning.  */
   CORE_ADDR str_addr = 0;
   int string_print = 0;
@@ -2464,7 +2463,6 @@ varobj_value_get_print_value (struct value *value,
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
 
-  gdbarch = get_type_arch (value_type (value));
 #if HAVE_PYTHON
   if (gdb_python_initialized)
     {
@@ -2518,6 +2516,7 @@ varobj_value_get_print_value (struct value *value,
 
 		      if (s)
 			{
+			  struct gdbarch *gdbarch;
 			  char *hint;
 
 			  hint = gdbpy_get_display_hint (value_formatter);
@@ -2530,6 +2529,7 @@ varobj_value_get_print_value (struct value *value,
 
 			  len = strlen (s);
 			  thevalue = (char *) xmemdup (s, len + 1, len + 1);
+			  gdbarch = get_type_arch (value_type (value));
 			  type = builtin_type (gdbarch)->builtin_char;
 			  xfree (s);


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