Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* superfluous line in hpread.c
@ 2002-08-01 15:35 david carlton
  2002-08-02 11:30 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: david carlton @ 2002-08-01 15:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: carlton

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 ----


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-04 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-01 15:35 superfluous line in hpread.c david carlton
2002-08-02 11:30 ` Joel Brobecker
2002-08-04 12:11   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox