This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] python, eliminate unused variables.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 07 May 2010 12:28:58 -0700
- Subject: [patch] python, eliminate unused variables.
2010-05-07 Michael Snyder <msnyder@vmware.com>
* python/python.c (execute_gdb_command): Remove unused variables.
* python/py-block.c (gdbpy_block_for_pc): Remove unused variable.
* python/py-breakpoint.c (gdbpy_breakpoint_created):
Remove unused variable.
* python/py-cmd.c (cmdpy_function): Remove unused variable.
(cmdpy_completer): Remove unused variable.
* python/py-frame.c (frapy_find_sal): Remove unused variable.
* python/py-function.c (fnpy_call): Remove unused variable.
* python/py-objfile.c (objfile_to_objfile_object):
Remove unused variable.
* python/py-param.c (parmpy_init): Remove unused variable.
* python/py-prettyprint.c (apply_varobj_pretty_printer):
Remove unused variable.
(gdbpy_default_visualizer): Remove unused variable.
* python/py-progspace.c (pspace_to_pspace_object):
Remove unused variable.
* python/py-symtab.c (symtab_and_line_to_sal_object):
Remove unused variable.
* python/py-type.c (typy_template_argument):
Remove unused variable.
* python/py-value.c (valpy_string): Remove unused variable.
(convert_value_from_python): Remove unused variables.
Index: python/py-block.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-block.c,v
retrieving revision 1.2
diff -u -p -r1.2 py-block.c
--- python/py-block.c 14 Apr 2010 13:18:54 -0000 1.2
+++ python/py-block.c 7 May 2010 19:25:20 -0000
@@ -271,7 +271,6 @@ gdbpy_block_for_pc (PyObject *self, PyOb
struct block *block;
struct obj_section *section;
struct symtab *symtab;
- PyObject *sym_obj;
if (!PyArg_ParseTuple (args, "K", &pc))
return NULL;
Index: python/py-breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-breakpoint.c,v
retrieving revision 1.1
diff -u -p -r1.1 py-breakpoint.c
--- python/py-breakpoint.c 9 Apr 2010 09:41:43 -0000 1.1
+++ python/py-breakpoint.c 7 May 2010 19:25:20 -0000
@@ -706,8 +706,6 @@ gdbpy_breakpoint_created (int num)
newbp = PyObject_New (breakpoint_object, &breakpoint_object_type);
if (newbp)
{
- PyObject *hookfn;
-
newbp->number = num;
newbp->bp = bp;
bppy_breakpoints[num] = newbp;
Index: python/py-cmd.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-cmd.c,v
retrieving revision 1.4
diff -u -p -r1.4 py-cmd.c
--- python/py-cmd.c 29 Apr 2010 15:45:56 -0000 1.4
+++ python/py-cmd.c 7 May 2010 19:25:20 -0000
@@ -148,7 +148,6 @@ cmdpy_function (struct cmd_list_element
if (! result)
{
PyObject *ptype, *pvalue, *ptraceback;
- char *s, *str;
PyErr_Fetch (&ptype, &pvalue, &ptraceback);
@@ -224,7 +223,6 @@ cmdpy_completer (struct cmd_list_element
result = (char **) xmalloc ((len + 1) * sizeof (char *));
for (i = out = 0; i < len; ++i)
{
- int l;
PyObject *elt = PySequence_GetItem (resultobj, i);
if (elt == NULL || ! gdbpy_is_string (elt))
{
Index: python/py-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-frame.c,v
retrieving revision 1.5
diff -u -p -r1.5 py-frame.c
--- python/py-frame.c 14 Apr 2010 13:18:54 -0000 1.5
+++ python/py-frame.c 7 May 2010 19:25:20 -0000
@@ -365,7 +365,6 @@ frapy_find_sal (PyObject *self, PyObject
{
struct frame_info *frame;
struct symtab_and_line sal;
- struct objfile *objfile = NULL;
volatile struct gdb_exception except;
PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
Index: python/py-function.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-function.c,v
retrieving revision 1.3
diff -u -p -r1.3 py-function.c
--- python/py-function.c 1 Jan 2010 07:31:50 -0000 1.3
+++ python/py-function.c 7 May 2010 19:25:20 -0000
@@ -57,7 +57,6 @@ static struct value *
fnpy_call (struct gdbarch *gdbarch, const struct language_defn *language,
void *cookie, int argc, struct value **argv)
{
- int i;
struct value *value = NULL;
PyObject *result, *callable, *args;
struct cleanup *cleanup;
Index: python/py-objfile.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-objfile.c,v
retrieving revision 1.4
diff -u -p -r1.4 py-objfile.c
--- python/py-objfile.c 14 Apr 2010 13:18:54 -0000 1.4
+++ python/py-objfile.c 7 May 2010 19:25:20 -0000
@@ -144,8 +144,6 @@ objfile_to_objfile_object (struct objfil
object = PyObject_New (objfile_object, &objfile_object_type);
if (object)
{
- PyObject *dict;
-
object->objfile = objfile;
object->printers = PyList_New (0);
Index: python/py-param.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-param.c,v
retrieving revision 1.2
diff -u -p -r1.2 py-param.c
--- python/py-param.c 30 Apr 2010 16:22:42 -0000 1.2
+++ python/py-param.c 7 May 2010 19:25:20 -0000
@@ -456,7 +456,6 @@ parmpy_init (PyObject *self, PyObject *a
char *cmd_name;
int parmclass, cmdtype;
PyObject *enum_values = NULL;
- struct cmd_list_element *cmd_list;
struct cmd_list_element **set_list, **show_list;
volatile struct gdb_exception except;
Index: python/py-prettyprint.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-prettyprint.c,v
retrieving revision 1.8
diff -u -p -r1.8 py-prettyprint.c
--- python/py-prettyprint.c 15 Apr 2010 19:54:13 -0000 1.8
+++ python/py-prettyprint.c 7 May 2010 19:25:20 -0000
@@ -661,7 +661,6 @@ PyObject *
apply_varobj_pretty_printer (PyObject *printer_obj,
struct value **replacement)
{
- int size = 0;
PyObject *py_str = NULL;
*replacement = NULL;
@@ -707,7 +706,7 @@ PyObject *
gdbpy_default_visualizer (PyObject *self, PyObject *args)
{
PyObject *val_obj;
- PyObject *cons, *printer = NULL;
+ PyObject *cons;
struct value *value;
if (! PyArg_ParseTuple (args, "O", &val_obj))
Index: python/py-progspace.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-progspace.c,v
retrieving revision 1.1
diff -u -p -r1.1 py-progspace.c
--- python/py-progspace.c 15 Apr 2010 19:54:13 -0000 1.1
+++ python/py-progspace.c 7 May 2010 19:25:20 -0000
@@ -154,8 +154,6 @@ pspace_to_pspace_object (struct program_
object = PyObject_New (pspace_object, &pspace_object_type);
if (object)
{
- PyObject *dict;
-
object->pspace = pspace;
object->printers = PyList_New (0);
Index: python/py-symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-symtab.c,v
retrieving revision 1.1
diff -u -p -r1.1 py-symtab.c
--- python/py-symtab.c 24 Feb 2010 21:18:27 -0000 1.1
+++ python/py-symtab.c 7 May 2010 19:25:20 -0000
@@ -321,7 +321,6 @@ symtab_and_line_to_sal_object (struct sy
{
sal_object *sal_obj;
- symtab_object *symtab_obj;
int success = 0;
sal_obj = PyObject_New (sal_object, &sal_object_type);
Index: python/py-type.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-type.c,v
retrieving revision 1.8
diff -u -p -r1.8 py-type.c
--- python/py-type.c 14 Apr 2010 13:18:54 -0000 1.8
+++ python/py-type.c 7 May 2010 19:25:20 -0000
@@ -506,7 +506,7 @@ typy_lookup_type (struct demangle_compon
static PyObject *
typy_template_argument (PyObject *self, PyObject *args)
{
- int i, argno, n_pointers;
+ int i, argno;
struct type *type = ((type_object *) self)->type;
struct demangle_component *demangled;
const char *err;
Index: python/py-value.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-value.c,v
retrieving revision 1.8
diff -u -p -r1.8 py-value.c
--- python/py-value.c 14 Apr 2010 13:18:55 -0000 1.8
+++ python/py-value.c 7 May 2010 19:25:20 -0000
@@ -259,7 +259,7 @@ valpy_lazy_string (PyObject *self, PyObj
static PyObject *
valpy_string (PyObject *self, PyObject *args, PyObject *kw)
{
- int length = -1, ret = 0;
+ int length = -1;
gdb_byte *buffer;
struct value *value = ((value_object *) self)->value;
volatile struct gdb_exception except;
@@ -923,7 +923,6 @@ struct value *
convert_value_from_python (PyObject *obj)
{
struct value *value = NULL; /* -Wall */
- PyObject *target_str, *unicode_str;
struct cleanup *old;
volatile struct gdb_exception except;
int cmp;
Index: python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.34
diff -u -p -r1.34 python.c
--- python/python.c 29 Apr 2010 15:45:56 -0000 1.34
+++ python/python.c 7 May 2010 19:25:20 -0000
@@ -303,8 +303,7 @@ gdbpy_target_wide_charset (PyObject *sel
static PyObject *
execute_gdb_command (PyObject *self, PyObject *args)
{
- struct cmd_list_element *alias, *prefix, *cmd;
- char *arg, *newarg;
+ char *arg;
PyObject *from_tty_obj = NULL;
int from_tty;
int cmp;