[5/7] gdb: remove FIELD_BITSIZE

Message ID 20230831154727.1240363-6-simon.marchi@efficios.com
State New
Headers
Series Remove some more TYPE/FIELD macros |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Simon Marchi Aug. 31, 2023, 3:46 p.m. UTC
  From: Simon Marchi <simon.marchi@polymtl.ca>

Replace with field::bitsize.

Change-Id: I400be235d6a1f446d0a4aafac01df5e850185d3a
---
 gdb/dwarf2/read.c | 2 +-
 gdb/gdbtypes.c    | 2 +-
 gdb/gdbtypes.h    | 6 ++----
 gdb/stabsread.c   | 8 ++++----
 4 files changed, 8 insertions(+), 10 deletions(-)
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 79005b6849ae..a538cb55b748 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 43c09f825f8b..cd6b191ea628 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 00a792bc6580..6c522a935c5b 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 abc059b3ded7..cc7efda61bf7 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)