This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

[patch] Fix for recent breakage


Greetings,

After this change:

  commit 344a0cdf12f3c60ad027f536f209dea7be51e1f0
  Author: Tom Tromey <tromey@redhat.com>
  Date:   Fri Oct 31 11:24:11 2008 -0600

GDB doesn't build with gcc-4.3.1 -Wall -Werror:

../../gdb/python/python.c: In function 'find_pretty_printer':
../../gdb/python/python.c:705: error: 'dict' may be used uninitialized in this function
../../gdb/python/python.c:687: error: 'found' may be used uninitialized in this function
make: *** [python.o] Error 1


The first warning is (AFAICT) correct, and the second is bogus
(control flow too complicated for GCC).

Proposed fix:

diff --git a/gdb/python/python.c b/gdb/python/python.c
index af50c4c..5f6a269 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -684,7 +684,7 @@ search_pp_dictionary (PyObject *dict, char *type_name)
 static PyObject *
 find_pretty_printer (struct type *type, PyObject **dictp, int is_mi)
 {
-  PyObject *dict, *found;
+  PyObject *dict, *found = NULL;
   char *type_name = NULL;
   char *dict_name;
   struct objfile *obj;
@@ -701,10 +701,7 @@ find_pretty_printer (struct type *type, PyObject **dictp, int is_mi)
       type_name = get_type (type);
     }
   if (except.reason < 0)
-    {
-      Py_DECREF (dict);
-      return NULL;
-    }
+    return NULL;
 
   /* Look at the pretty-printer dictionary for each objfile.  */
   ALL_OBJFILES (obj)

--
Paul Pluzhnikov


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