Remove unused variable in gdb/varobj.c when built without Python support
authorPedro Alves <palves@redhat.com>
Thu, 21 Jul 2016 14:29:58 +0000 (15:29 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 21 Jul 2016 14:29:58 +0000 (15:29 +0100)
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.

gdb/ChangeLog
gdb/varobj.c

index 2988cda6034bfd3bf4996974bc81f9aa7158193c..d074a3de23049944a7824ab4d71c645312814f50 100644 (file)
@@ -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"
index 6f56cbadaee59325ab26536dd50c71b06e10a544..fb1349a85dba60374e6acf44f0f0f98489ae2b50 100644 (file)
@@ -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);