From 3a543e211e963c6ff131e9275524d4632309f15b Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 23 Sep 2021 23:43:13 -0400 Subject: gdb: remove FIELD_BITPOS macro Remove FIELD_BITPOD, replace its uses with field::loc_bitpos. Change-Id: Idb99297e0170661254276c206383a7e9bf1a935a --- gdb/dwarf2/read.c | 8 ++++---- gdb/gdbtypes.c | 8 ++++---- gdb/gdbtypes.h | 3 +-- gdb/guile/scm-type.c | 4 ++-- gdb/mips-tdep.c | 6 ++---- gdb/stabsread.c | 4 ++-- 6 files changed, 15 insertions(+), 18 deletions(-) (limited to 'gdb') diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 8b223e4..71efd1c 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -14594,7 +14594,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, anonymous object to the MSB of the field. We don't have to do anything special since we don't need to know the size of the anonymous object. */ - fp->set_loc_bitpos ((FIELD_BITPOS (*fp) + attr->constant_value (0))); + fp->set_loc_bitpos (fp->loc_bitpos () + attr->constant_value (0)); } else { @@ -14623,9 +14623,9 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, bit field. */ anonymous_size = TYPE_LENGTH (fp->type ()); } - fp->set_loc_bitpos (FIELD_BITPOS (*fp) - + anonymous_size * bits_per_byte - - bit_offset - FIELD_BITSIZE (*fp)); + fp->set_loc_bitpos (fp->loc_bitpos () + + anonymous_size * bits_per_byte + - bit_offset - FIELD_BITSIZE (*fp)); } } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 622f314..659123a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4211,7 +4211,7 @@ check_types_equal (struct type *type1, struct type *type2, switch (field1->loc_kind ()) { case FIELD_LOC_KIND_BITPOS: - if (FIELD_BITPOS (*field1) != FIELD_BITPOS (*field2)) + if (field1->loc_bitpos () != field2->loc_bitpos ()) return false; break; case FIELD_LOC_KIND_ENUMVAL: @@ -5917,18 +5917,18 @@ append_composite_type_field_aligned (struct type *t, const char *name, if (t->num_fields () > 1) { f->set_loc_bitpos - ((FIELD_BITPOS (f[-1]) + (TYPE_LENGTH (f[-1].type ()) * TARGET_CHAR_BIT))); + (f[-1].loc_bitpos () + (TYPE_LENGTH (f[-1].type ()) * TARGET_CHAR_BIT)); if (alignment) { int left; alignment *= TARGET_CHAR_BIT; - left = FIELD_BITPOS (f[0]) % alignment; + left = f[0].loc_bitpos () % alignment; if (left) { - f->set_loc_bitpos (FIELD_BITPOS (f[0]) + (alignment - left)); + f->set_loc_bitpos (f[0].loc_bitpos () + (alignment - left)); TYPE_LENGTH (t) += (alignment - left) / TARGET_CHAR_BIT; } } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index f1c8d43..39b5fcf 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2125,7 +2125,6 @@ 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_BITPOS(thisfld) ((thisfld).loc_bitpos ()) #define FIELD_ENUMVAL(thisfld) ((thisfld).loc_enumval ()) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc_physname ()) #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc_physaddr ()) @@ -2134,7 +2133,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) #define TYPE_FIELD_LOC_KIND(thistype, n) ((thistype)->field (n).loc_kind ()) -#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n)) +#define TYPE_FIELD_BITPOS(thistype, n) ((thistype)->field (n).loc_bitpos ()) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL ((thistype)->field (n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME ((thistype)->field (n)) #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR ((thistype)->field (n)) diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index 04d3d75..bd8c113 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -1183,7 +1183,7 @@ gdbscm_field_bitpos (SCM self) SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME, _("non-enum type")); - return scm_from_long (FIELD_BITPOS (*field)); + return scm_from_long (field->loc_bitpos ()); } /* (field-bitsize ) -> integer @@ -1196,7 +1196,7 @@ gdbscm_field_bitsize (SCM self) = tyscm_get_field_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct field *field = tyscm_field_smob_to_field (f_smob); - return scm_from_long (FIELD_BITPOS (*field)); + return scm_from_long (field->loc_bitpos ()); } /* (field-artificial? ) -> boolean diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index d9f8652..65eec47 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5248,8 +5248,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, : MIPS_V0_REGNUM); field < type->num_fields (); field++, regnum += 2) { - int offset = (FIELD_BITPOS (type->field (field)) - / TARGET_CHAR_BIT); + int offset = type->field (field).loc_bitpos () / TARGET_CHAR_BIT; if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset); @@ -5800,8 +5799,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function, for (field = 0, regnum = mips_regnum (gdbarch)->fp0; field < type->num_fields (); field++, regnum += 2) { - int offset = (FIELD_BITPOS (type->fields ()[field]) - / TARGET_CHAR_BIT); + int offset = (type->fields ()[field].loc_bitpos () / TARGET_CHAR_BIT); if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", offset); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 64734b7..04f5210 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2846,7 +2846,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, } } - if (FIELD_BITPOS (fip->list->field) == 0 + if (fip->list->field.loc_bitpos () == 0 && FIELD_BITSIZE (fip->list->field) == 0) { /* This can happen in two cases: (1) at least for gcc 2.4.5 or so, @@ -2889,7 +2889,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp, == gdbarch_int_bit (gdbarch)) ) && - FIELD_BITPOS (fip->list->field) % 8 == 0) + fip->list->field.loc_bitpos () % 8 == 0) { FIELD_BITSIZE (fip->list->field) = 0; } -- cgit v1.1