From 3be8c91910114853a64ab87fd1efaef220bb0205 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 31 Aug 2023 11:46:26 -0400 Subject: [PATCH] gdb: remove FIELD_BITSIZE Replace with field::bitsize. Change-Id: I400be235d6a1f446d0a4aafac01df5e850185d3a Approved-By: Tom Tromey --- gdb/dwarf2/read.c | 2 +- gdb/gdbtypes.c | 2 +- gdb/gdbtypes.h | 6 ++---- gdb/stabsread.c | 8 ++++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 79005b6849a..a538cb55b74 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -11722,7 +11722,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } fp->set_loc_bitpos (fp->loc_bitpos () + anonymous_size * bits_per_byte - - bit_offset - FIELD_BITSIZE (*fp)); + - bit_offset - fp->bitsize ()); } } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 43c09f825f8..cd6b191ea62 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4244,7 +4244,7 @@ check_types_equal (struct type *type1, struct type *type2, const struct field *field2 = &type2->field (i); if (field1->is_artificial () != field2->is_artificial () - || FIELD_BITSIZE (*field1) != FIELD_BITSIZE (*field2) + || field1->bitsize () != field2->bitsize () || field1->loc_kind () != field2->loc_kind ()) return false; if (!compare_maybe_null_strings (field1->name (), field2->name ())) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 00a792bc658..6c522a935c5 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1933,10 +1933,8 @@ extern void set_type_vptr_basetype (struct type *, struct type *); (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \ : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index))) -#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize ()) - -#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n)) -#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0) +#define TYPE_FIELD_BITSIZE(thistype, n) ((thistype)->field (n).bitsize ()) +#define TYPE_FIELD_PACKED(thistype, n) (((thistype)->field (n).bitsize ())!=0) #define TYPE_FIELD_PRIVATE_BITS(thistype) \ TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits diff --git a/gdb/stabsread.c b/gdb/stabsread.c index abc059b3ded..cc7efda61bf 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2873,7 +2873,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, } if (fip->list->field.loc_bitpos () == 0 - && FIELD_BITSIZE (fip->list->field) == 0) + && fip->list->field.bitsize () == 0) { /* This can happen in two cases: (1) at least for gcc 2.4.5 or so, it is a field which has been optimized out. The correct stab for @@ -2908,11 +2908,11 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, { fip->list->field.set_bitsize (0); } - if ((FIELD_BITSIZE (fip->list->field) + if ((fip->list->field.bitsize () == TARGET_CHAR_BIT * field_type->length () || (field_type->code () == TYPE_CODE_ENUM - && FIELD_BITSIZE (fip->list->field) - == gdbarch_int_bit (gdbarch)) + && (fip->list->field.bitsize () + == gdbarch_int_bit (gdbarch))) ) && fip->list->field.loc_bitpos () % 8 == 0) -- 2.30.2