This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
superfluous line in hpread.c
- From: david carlton <carlton at math dot stanford dot edu>
- To: gdb-patches at sources dot redhat dot com
- Cc: carlton at math dot stanford dot edu
- Date: Thu, 1 Aug 2002 15:35:51 -0700
- Subject: superfluous line in hpread.c
While in the middle of trying to track down a bug involving static
data members, I noticed that hpread.c(hpread_read_struct_type)
contains the consecutive lines
FIELD_BITSIZE (list->field) = -1; /* indicates static member */
SET_FIELD_PHYSNAME (list->field, 0); /* initialize to empty */
Given the following definitions from gdbtypes.h:
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define SET_FIELD_PHYSNAME(thisfld, name) \
((thisfld).bitsize = -1, FIELD_PHYSNAME(thisfld) = (name))
the first of those lines is completely superfluous and potentially a
bit confusing (e.g. to somebody either trying to track down a bug
involving static members or one involving bitfields).
Here's a patch that deletes it. No, I haven't tested it (I don't have
access to an appropriate machine), but it really does follow from the
definitions of the macros that that first line does nothing that the
second line doesn't also do.
David Carlton
carlton@math.stanford.edu
2002-08-01 david carlton <carlton@math.stanford.edu>
* hpread.c (hpread_read_struct_type): Deleted superfluous setting
of FIELD_BITSIZE.
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.21
diff -c -p -r1.21 hpread.c
*** hpread.c 14 Jun 2002 14:34:25 -0000 1.21
--- hpread.c 1 Aug 2002 22:25:48 -0000
*************** hpread_read_struct_type (dnttpointer hp_
*** 4038,4044 ****
list = new;
list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
- FIELD_BITSIZE (list->field) = -1; /* indicates static member */
SET_FIELD_PHYSNAME (list->field, 0); /* initialize to empty */
memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
--- 4038,4043 ----