This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] eval, valops, valarith, valprint, printcmd.c: delete unused variables.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "tromey at redhat dot com" <tromey at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 07 May 2010 11:49:02 -0700
- Subject: Re: [patch] eval, valops, valarith, valprint, printcmd.c: delete unused variables.
- References: <4BE30B48.9040800@vmware.com> <m3aasbhbhf.fsf@fleche.redhat.com>
Tom Tromey wrote:
"Michael" == Michael Snyder <msnyder@vmware.com> writes:
Michael> struct value *
Michael> value_cast_pointers (struct type *type, struct value *arg2)
Michael> {
Michael> - struct type *type1 = check_typedef (type);
Michael> struct type *type2 = check_typedef (value_type (arg2));
Michael> struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type));
Michael> struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2));
In this case I think the intent is for t1 to reference type1, and not type.
I would recommend making that change rather than deleting type1.
OK -- committed as attached.
2010-05-07 Michael Snyder <msnyder@vmware.com>
* valops.c (value_cast_pointers): Restore unused variable 'type1',
and use it to compute variable 't1'.
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.241
diff -u -p -r1.241 valops.c
--- valops.c 7 May 2010 14:46:26 -0000 1.241
+++ valops.c 7 May 2010 18:48:11 -0000
@@ -300,8 +300,9 @@ value_cast_structs (struct type *type, s
struct value *
value_cast_pointers (struct type *type, struct value *arg2)
{
+ struct type *type1 = check_typedef (type);
struct type *type2 = check_typedef (value_type (arg2));
- struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type));
+ struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1));
struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2));
if (TYPE_CODE (t1) == TYPE_CODE_STRUCT