This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[patch] Fix for recent breakage
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: archer at sourceware dot org
- Cc: ppluzhnikov at google dot com, tromey at redhat dot com
- Date: Mon, 3 Nov 2008 13:50:44 -0800 (PST)
- Subject: [patch] Fix for recent breakage
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1225749048; bh=EWVlaTeWnFNJS7xh5QkQ9gnm6gk=;h=DomainKey-Signature:To:Cc:Subject:Message-Id:Date:From; b=ukPa31leIqdNDp2YnJKz+GIFZLf1gyeJqM0n/cDgYKcNItZIwVlMvL/w71drh7O6MydcenRVuOEM/JG5FAptFA==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=to:cc:subject:message-id:date:from;b=aXAwpJ8ctE93OBQ2DwYfI+65FmpUsb/PAkQY+NHquRvJJbU7e2KfCz/wQYI0RKIJg+1XdHTMBY4gFvJPI0rsaQ==
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