gdb: remove TYPE_FIELD macro
authorSimon Marchi <simon.marchi@polymtl.ca>
Sat, 23 May 2020 21:39:54 +0000 (17:39 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 23 May 2020 21:39:54 +0000 (17:39 -0400)
Replace all uses of it by type::field.

Note that since type::field returns a reference to the field, some spots
are used to assign the whole field structure.  See ctfread.c, function
attach_fields_to_type, for example.  This is the same as was happening
with the macro, so I don't think it's a problem, but if anybody sees a
really nicer way to do this, now could be a good time to implement it.

gdb/ChangeLog:

* gdbtypes.h (TYPE_FIELD): Remove.  Replace all uses with
type::field.

31 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/ada-lang.c
gdb/amd64-tdep.c
gdb/arm-tdep.c
gdb/ax-gdb.c
gdb/c-typeprint.c
gdb/c-varobj.c
gdb/coffread.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-cplus-types.c
gdb/cp-valprint.c
gdb/ctfread.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/guile/scm-type.c
gdb/mips-tdep.c
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/ppc-sysv-tdep.c
gdb/python/py-type.c
gdb/rust-lang.c
gdb/s390-tdep.c
gdb/stabsread.c
gdb/symtab.c
gdb/typeprint.c
gdb/valops.c
gdb/windows-tdep.c

index cbf81e70fcbd7a1dec899d6d034e543f96e7afa4..35fdc614ee47cac95c80ee5f7619e0c1da411407 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-23  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * gdbtypes.h (TYPE_FIELD): Remove.  Replace all uses with
+       type::field.
+
 2020-05-23  Joel Brobecker  <brobecker@adacore.com>
 
        GDB 9.2 released.
index 2872d2d2bf7f23b36057229cf869bc600fe44c39..91ea562248df9d553b86a698d7b4a4576ad35f60 100644 (file)
@@ -1349,7 +1349,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
        for (int i = 0; i < type->num_fields (); i++)
          {
            /* Ignore any static fields.  */
-           if (field_is_static (&TYPE_FIELD (type, i)))
+           if (field_is_static (&type->field (i)))
              continue;
 
            struct type *member = check_typedef (TYPE_FIELD_TYPE (type, i));
@@ -1631,7 +1631,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
       for (int i = 0; i < arg_type->num_fields (); i++)
        {
          /* Don't include static fields.  */
-         if (field_is_static (&TYPE_FIELD (arg_type, i)))
+         if (field_is_static (&arg_type->field (i)))
            continue;
 
          struct value *field = value_primitive_field (arg, 0, i, arg_type);
index c99705ca74b892938681699c0f07b12fbdebb1bd..7522917401cf60af5a517baf06d74ff09458ab64 100644 (file)
@@ -8090,7 +8090,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
     {
       off = align_up (off, field_alignment (type, f))
        + TYPE_FIELD_BITPOS (type, f);
-      SET_FIELD_BITPOS (TYPE_FIELD (rtype, f), off);
+      SET_FIELD_BITPOS (rtype->field (f), off);
       TYPE_FIELD_BITSIZE (rtype, f) = 0;
 
       if (ada_is_variant_part (type, f))
index 24f0614b235b55110d1616179d22f0779cb877e4..f96a9868259ef521d4041b81d2312bdb097f6beb 100644 (file)
@@ -558,7 +558,7 @@ amd64_has_unaligned_fields (struct type *type)
          /* Ignore static fields, empty fields (for example nested
             empty structures), and bitfields (these are handled by
             the caller).  */
-         if (field_is_static (&TYPE_FIELD (type, i))
+         if (field_is_static (&type->field (i))
              || (TYPE_FIELD_BITSIZE (type, i) == 0
                  && TYPE_LENGTH (subtype) == 0)
              || TYPE_FIELD_PACKED (type, i))
@@ -600,7 +600,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
 
   /* Ignore static fields, or empty fields, for example nested
      empty structures.*/
-  if (field_is_static (&TYPE_FIELD (type, i)) || bitsize == 0)
+  if (field_is_static (&type->field (i)) || bitsize == 0)
     return;
 
   if (subtype->code () == TYPE_CODE_STRUCT
index e96819252118ea6288ace37a2dd25223ec82a952..3e085245c8e85ea0d0549fb6986e33f690b0c204 100644 (file)
@@ -3501,7 +3501,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
          {
            int sub_count = 0;
 
-           if (!field_is_static (&TYPE_FIELD (t, i)))
+           if (!field_is_static (&t->field (i)))
              sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
                                                      base_type);
            if (sub_count == -1)
index 4dcdc3b411f1470ff0d5772f6a8abf9fd9896a5b..54643dd79ba33a22454f47f7fec48c27aa461c16 100644 (file)
@@ -318,7 +318,7 @@ gen_trace_static_fields (struct agent_expr *ax,
 
   for (i = type->num_fields () - 1; i >= nbases; i--)
     {
-      if (field_is_static (&TYPE_FIELD (type, i)))
+      if (field_is_static (&type->field (i)))
        {
          gen_static_field (ax, &value, type, i);
          if (value.optimized_out)
@@ -1456,7 +1456,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
                 "this") will have been generated already, which will
                 be unnecessary but not harmful if the static field is
                 being handled as a global.  */
-             if (field_is_static (&TYPE_FIELD (type, i)))
+             if (field_is_static (&type->field (i)))
                {
                  gen_static_field (ax, value, type, i);
                  if (value->optimized_out)
@@ -1594,7 +1594,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
 
       if (t_field_name && strcmp (t_field_name, fieldname) == 0)
        {
-         if (field_is_static (&TYPE_FIELD (t, i)))
+         if (field_is_static (&t->field (i)))
            {
              gen_static_field (ax, value, t, i);
              if (value->optimized_out)
index 29ac595cb253789f38557d0e3b2df338ddee206e..8ed6c06781117caea9d20b12539843db010213a5 100644 (file)
@@ -1167,7 +1167,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
                 TYPE_FIELD_PRIVATE (type, i), flags);
            }
 
-         bool is_static = field_is_static (&TYPE_FIELD (type, i));
+         bool is_static = field_is_static (&type->field (i));
 
          if (flags->print_offsets)
            podata->update (type, i, stream);
index 6cb260ddc91a86388569645899d5edffc7e8c548..2be447a86609a1a82eeb743fd16b317907bab564 100644 (file)
@@ -254,7 +254,7 @@ value_struct_element_index (struct value *value, int type_index)
 
   try
     {
-      if (field_is_static (&TYPE_FIELD (type, type_index)))
+      if (field_is_static (&type->field (type_index)))
        result = value_static_field (type, type_index);
       else
        result = value_primitive_field (value, 0, type_index, type);
index 9b2f638d748f0ac2dde7b946810eedc50600e0ff..8b1f040f95f4fa157536fb2ee2504d88fad73239 100644 (file)
@@ -2045,7 +2045,7 @@ coff_read_struct_type (int index, int length, int lastsym,
   /* Copy the saved-up fields into the field vector.  */
 
   for (n = nfields; list; list = list->next)
-    TYPE_FIELD (type, --n) = list->field;
+    type->field (--n) = list->field;
 
   return type;
 }
@@ -2142,7 +2142,7 @@ coff_read_enum_type (int index, int length, int lastsym,
 
          SYMBOL_TYPE (xsym) = type;
          TYPE_FIELD_NAME (type, n) = xsym->linkage_name ();
-         SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
+         SET_FIELD_ENUMVAL (type->field (n), SYMBOL_VALUE (xsym));
          if (SYMBOL_VALUE (xsym) < 0)
            unsigned_enum = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
index 8b3cd370aa49ba286d1dbe13efa70a23c3f9cad7..758b12db1a784370b38bd48b0cdc3b6943405f48 100644 (file)
@@ -527,7 +527,7 @@ generate_vla_size (compile_instance *compiler,
        int i;
 
        for (i = 0; i < type->num_fields (); ++i)
-         if (!field_is_static (&TYPE_FIELD (type, i)))
+         if (!field_is_static (&type->field (i)))
            generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
                               TYPE_FIELD_TYPE (type, i), sym);
       }
index b2a4544c041e4c848acc5a7a843138963b3fce72..eb70dfe967a44747e936033d32070e92bfad01db 100644 (file)
@@ -595,7 +595,7 @@ compile_cplus_convert_struct_or_union_members
       gcc_type field_type
        = instance->convert_type (TYPE_FIELD_TYPE (type, i));
 
-      if (field_is_static (&TYPE_FIELD (type, i)))
+      if (field_is_static (&type->field (i)))
        {
          CORE_ADDR physaddr;
 
index a59afec4958d5fc113906c0b16e644d25c421763..0c79b025bd3a98896cc3cb9c35c4744bb2130436 100644 (file)
@@ -191,7 +191,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 
          /* If requested, skip printing of static fields.  */
          if (!options->static_field_print
-             && field_is_static (&TYPE_FIELD (type, i)))
+             && field_is_static (&type->field (i)))
            continue;
 
          if (fields_seen)
@@ -225,7 +225,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 
          annotate_field_begin (TYPE_FIELD_TYPE (type, i));
 
-         if (field_is_static (&TYPE_FIELD (type, i)))
+         if (field_is_static (&type->field (i)))
            {
              fputs_filtered ("static ", stream);
              fprintf_symbol_filtered (stream,
@@ -256,7 +256,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
            }
          annotate_field_value ();
 
-         if (!field_is_static (&TYPE_FIELD (type, i))
+         if (!field_is_static (&type->field (i))
              && TYPE_FIELD_PACKED (type, i))
            {
              struct value *v;
@@ -295,7 +295,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
                  fputs_styled ("<optimized out or zero length>",
                                metadata_style.style (), stream);
                }
-             else if (field_is_static (&TYPE_FIELD (type, i)))
+             else if (field_is_static (&type->field (i)))
                {
                  try
                    {
index c0694ed312f316b3e0b2a3245e80c850f784d2f1..57a376329385eb6763c4288ea14b4b3dc96db929 100644 (file)
@@ -316,7 +316,7 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
   for (int i = 0; i < nfields; ++i)
     {
       struct ctf_nextfield &field = fip->fields[i];
-      TYPE_FIELD (type, i) = field.field;
+      type->field (i) = field.field;
     }
 }
 
index e6d08110b2a762293d87ba50d1d4dcd052aa08c3..ec3844188ee6a21d4fa45682ebbc5b159a404334 100644 (file)
@@ -9364,7 +9364,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       type->set_code (TYPE_CODE_STRUCT);
       type->set_num_fields (3);
       /* Save the field we care about.  */
-      struct field saved_field = TYPE_FIELD (type, 0);
+      struct field saved_field = type->field (0);
       type->set_fields
        ((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
 
@@ -9372,11 +9372,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       TYPE_FIELD_TYPE (type, 0) = field_type;
       TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
       TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
-      SET_FIELD_BITPOS (TYPE_FIELD (type, 0), bit_offset);
+      SET_FIELD_BITPOS (type->field (0), bit_offset);
 
       /* The order of fields doesn't really matter, so put the real
         field at index 1 and the data-less field at index 2.  */
-      TYPE_FIELD (type, 1) = saved_field;
+      type->field (1) = saved_field;
       TYPE_FIELD_NAME (type, 1)
        = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
       TYPE_FIELD_TYPE (type, 1)->set_name
@@ -9392,7 +9392,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       /* NAME points into the original discriminant name, which
         already has the correct lifetime.  */
       TYPE_FIELD_NAME (type, 2) = name;
-      SET_FIELD_BITPOS (TYPE_FIELD (type, 2), 0);
+      SET_FIELD_BITPOS (type->field (2), 0);
 
       /* Indicate that this is a variant type.  */
       static discriminant_range ranges[1] = { { 0, 0 } };
@@ -9454,7 +9454,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       type->set_code (TYPE_CODE_STRUCT);
 
       /* Make space for the discriminant field.  */
-      struct field *disr_field = &TYPE_FIELD (disr_type, 0);
+      struct field *disr_field = &disr_type->field (0);
       field *new_fields
        = (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1)
                                               * sizeof (struct field)));
@@ -9464,7 +9464,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
       type->set_num_fields (type->num_fields () + 1);
 
       /* Install the discriminant at index 0 in the union.  */
-      TYPE_FIELD (type, 0) = *disr_field;
+      type->field (0) = *disr_field;
       TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
       TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
 
@@ -14849,7 +14849,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
        = ((i < fip->baseclasses.size ()) ? fip->baseclasses[i]
           : fip->fields[i - fip->baseclasses.size ()]);
 
-      TYPE_FIELD (type, i) = field.field;
+      type->field (i) = field.field;
       switch (field.accessibility)
        {
        case DW_ACCESS_private:
index 3f23cebfb29648acd7a3953208616a2c5acadefe..20533abf93d0f72aa5100e711d06e1b5f8fedf6b 100644 (file)
@@ -296,8 +296,7 @@ evaluate_struct_tuple (struct value *struct_val,
       fieldno++;
       /* Skip static fields.  */
       while (fieldno < struct_type->num_fields ()
-            && field_is_static (&TYPE_FIELD (struct_type,
-                                             fieldno)))
+            && field_is_static (&struct_type->field (fieldno)))
        fieldno++;
       if (fieldno >= struct_type->num_fields ())
        error (_("too many initializers"));
index 96b75a00a923d9890e2ea199866bff0a98562514..4fe8d9a8e9cc3b439113427b0694676dd0f76023 100644 (file)
@@ -1757,7 +1757,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
 
       if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
        {
-         return {&TYPE_FIELD (type, i), TYPE_FIELD_BITPOS (type, i)};
+         return {&type->field (i), TYPE_FIELD_BITPOS (type, i)};
        }
      else if (!t_field_name || *t_field_name == '\0')
        {
@@ -2039,7 +2039,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
        for (i = 0; i < type->num_fields (); ++i)
          {
            /* Static fields can be ignored here.  */
-           if (field_is_static (&TYPE_FIELD (type, i)))
+           if (field_is_static (&type->field (i)))
              continue;
            /* If the field has dynamic type, then so does TYPE.  */
            if (is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
@@ -2249,7 +2249,7 @@ resolve_dynamic_union (struct type *type,
     {
       struct type *t;
 
-      if (field_is_static (&TYPE_FIELD (type, i)))
+      if (field_is_static (&type->field (i)))
        continue;
 
       t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
@@ -2415,7 +2415,7 @@ compute_variant_fields (struct type *type,
       if (!flags[i])
        continue;
 
-      TYPE_FIELD (resolved_type, out) = TYPE_FIELD (type, i);
+      resolved_type->field (out) = type->field (i);
       ++out;
     }
 }
@@ -2463,7 +2463,7 @@ resolve_dynamic_struct (struct type *type,
       unsigned new_bit_length;
       struct property_addr_info pinfo;
 
-      if (field_is_static (&TYPE_FIELD (resolved_type, i)))
+      if (field_is_static (&resolved_type->field (i)))
        continue;
 
       if (TYPE_FIELD_LOC_KIND (resolved_type, i) == FIELD_LOC_KIND_DWARF_BLOCK)
@@ -2480,7 +2480,7 @@ resolve_dynamic_struct (struct type *type,
          CORE_ADDR addr;
          if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr,
                                        true))
-           SET_FIELD_BITPOS (TYPE_FIELD (resolved_type, i),
+           SET_FIELD_BITPOS (resolved_type->field (i),
                              TARGET_CHAR_BIT * (addr - addr_stack->addr));
        }
 
@@ -3391,7 +3391,7 @@ type_align (struct type *type)
        int number_of_non_static_fields = 0;
        for (unsigned i = 0; i < type->num_fields (); ++i)
          {
-           if (!field_is_static (&TYPE_FIELD (type, i)))
+           if (!field_is_static (&type->field (i)))
              {
                number_of_non_static_fields++;
                ULONGEST f_align = type_align (TYPE_FIELD_TYPE (type, i));
@@ -4028,8 +4028,8 @@ check_types_equal (struct type *type1, struct type *type2,
 
       for (i = 0; i < type1->num_fields (); ++i)
        {
-         const struct field *field1 = &TYPE_FIELD (type1, i);
-         const struct field *field2 = &TYPE_FIELD (type2, i);
+         const struct field *field1 = &type1->field (i);
+         const struct field *field2 = &type2->field (i);
 
          if (FIELD_ARTIFICIAL (*field1) != FIELD_ARTIFICIAL (*field2)
              || FIELD_BITSIZE (*field1) != FIELD_BITSIZE (*field2)
@@ -5321,19 +5321,19 @@ copy_type_recursive (struct objfile *objfile,
          switch (TYPE_FIELD_LOC_KIND (type, i))
            {
            case FIELD_LOC_KIND_BITPOS:
-             SET_FIELD_BITPOS (TYPE_FIELD (new_type, i),
+             SET_FIELD_BITPOS (new_type->field (i),
                                TYPE_FIELD_BITPOS (type, i));
              break;
            case FIELD_LOC_KIND_ENUMVAL:
-             SET_FIELD_ENUMVAL (TYPE_FIELD (new_type, i),
+             SET_FIELD_ENUMVAL (new_type->field (i),
                                 TYPE_FIELD_ENUMVAL (type, i));
              break;
            case FIELD_LOC_KIND_PHYSADDR:
-             SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
+             SET_FIELD_PHYSADDR (new_type->field (i),
                                  TYPE_FIELD_STATIC_PHYSADDR (type, i));
              break;
            case FIELD_LOC_KIND_PHYSNAME:
-             SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
+             SET_FIELD_PHYSNAME (new_type->field (i),
                                  xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
                                                                       i)));
              break;
@@ -5588,7 +5588,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
 
   TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
   TYPE_FIELD_TYPE (type, field_nr) = field_type;
-  SET_FIELD_BITPOS (TYPE_FIELD (type, field_nr), start_bitpos);
+  SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
   TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
   type->set_num_fields (type->num_fields () + 1);
 }
index f91adbc6cc29b1e4d95622c2ec93e363b0e23703..60cbcd1003f6ae745835d1deb5e8c7772414d8da 100644 (file)
@@ -1613,18 +1613,17 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
 #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
 #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
 
-#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields[n]
-#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
-#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
-#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
-#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
-#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
-#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
+#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE((thistype)->field (n))
+#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME((thistype)->field (n))
+#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
+#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
+#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))
+#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK ((thistype)->field (n))
+#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field (n))
+#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_PRIVATE_BITS(thistype) \
   TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
index 064f924c7691285d6be18168d5e733db2524b120..6faaca2e0416d2b991e3f6eed004b1c47d5367f1 100644 (file)
@@ -1528,7 +1528,7 @@ gnuv3_pass_by_reference (struct type *type)
      about recursive loops here, since we are only looking at members
      of complete class type.  Also ignore any static members.  */
   for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++)
-    if (!field_is_static (&TYPE_FIELD (type, fieldnum)))
+    if (!field_is_static (&type->field (fieldnum)))
       {
        struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);
 
index e58f1474699691ac02e408cdace237e762aca8e7..6c0c3fd3617c750c1ac2025d3c5d7f8b9a7d03be 100644 (file)
@@ -514,7 +514,7 @@ tyscm_field_smob_to_field (field_smob *f_smob)
   /* This should be non-NULL by construction.  */
   gdb_assert (type->fields () != NULL);
 
-  return &TYPE_FIELD (type, f_smob->field_num);
+  return &type->field (f_smob->field_num);
 }
 \f
 /* Type smob accessors.  */
index c602398506b845cdb1caadc09753ba8bdb3afe1a..d700dd8ebd02845d651f06b381326b9278c668c2 100644 (file)
@@ -4856,7 +4856,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
       struct type *field_type;
 
       /* We're only looking at normal fields.  */
-      if (field_is_static (&TYPE_FIELD (arg_type, i))
+      if (field_is_static (&arg_type->field (i))
          || (TYPE_FIELD_BITPOS (arg_type, i) % 8) != 0)
        continue;
 
index 3246d4e82a51cee5fc3a5d7f08783af3f0284693..70a8308b047e2ef51cc06b808b033cb7310a6254 100644 (file)
@@ -618,12 +618,12 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
                }
 
              print_spaces_filtered (level + 4, stream);
-             if (field_is_static (&TYPE_FIELD (type, i)))
+             if (field_is_static (&type->field (i)))
                fprintf_filtered (stream, "static ");
              pascal_print_type (TYPE_FIELD_TYPE (type, i),
                                 TYPE_FIELD_NAME (type, i),
                                 stream, show - 1, level + 4, flags);
-             if (!field_is_static (&TYPE_FIELD (type, i))
+             if (!field_is_static (&type->field (i))
                  && TYPE_FIELD_PACKED (type, i))
                {
                  /* It is a bitfield.  This code does not attempt
index 284dc85bf8c816434c241f44d2d259c164bd6b4b..cf902ac7fbe1758ae2442887ae69e11f7625ca75 100644 (file)
@@ -553,7 +553,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
        {
          /* If requested, skip printing of static fields.  */
          if (!options->pascal_static_field_print
-             && field_is_static (&TYPE_FIELD (type, i)))
+             && field_is_static (&type->field (i)))
            continue;
          if (fields_seen)
            fprintf_filtered (stream, ", ");
@@ -582,7 +582,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
 
          annotate_field_begin (TYPE_FIELD_TYPE (type, i));
 
-         if (field_is_static (&TYPE_FIELD (type, i)))
+         if (field_is_static (&type->field (i)))
            {
              fputs_filtered ("static ", stream);
              fprintf_symbol_filtered (stream,
@@ -597,7 +597,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
          fputs_filtered (" = ", stream);
          annotate_field_value ();
 
-         if (!field_is_static (&TYPE_FIELD (type, i))
+         if (!field_is_static (&type->field (i))
              && TYPE_FIELD_PACKED (type, i))
            {
              struct value *v;
@@ -636,7 +636,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
                  fputs_styled ("<optimized out or zero length>",
                                metadata_style.style (), stream);
                }
-             else if (field_is_static (&TYPE_FIELD (type, i)))
+             else if (field_is_static (&type->field (i)))
                {
                  /* struct value *v = value_static_field (type, i);
                     v4.17 specific.  */
index c0e6a929263c3c27f7ea147fcc922ed291d094e2..2dc896202dc7f01c556336d3cf8f374ecde2119f 100644 (file)
@@ -1142,7 +1142,7 @@ ppc64_aggregate_candidate (struct type *type,
            {
              LONGEST sub_count;
 
-             if (field_is_static (&TYPE_FIELD (type, i)))
+             if (field_is_static (&type->field (i)))
                continue;
 
              sub_count = ppc64_aggregate_candidate
index dbe25ad8f6cd53330eb48b91bb2885ec7321605a..7862f70d472b61f5aa66e80f9b056429f1f6b2a0 100644 (file)
@@ -177,7 +177,7 @@ convert_field (struct type *type, int field)
   if (PyObject_SetAttrString (result.get (), "parent_type", arg.get ()) < 0)
     return NULL;
 
-  if (!field_is_static (&TYPE_FIELD (type, field)))
+  if (!field_is_static (&type->field (field)))
     {
       const char *attrstring;
 
index f7eba1d9f2f952f4bf886eb7a68addecad3625ef..5958b058c10cceb05392b3a1f4ec4054f9183a57 100644 (file)
@@ -128,7 +128,7 @@ rust_underscore_fields (struct type *type)
     return false;
   for (i = 0; i < type->num_fields (); ++i)
     {
-      if (!field_is_static (&TYPE_FIELD (type, i)))
+      if (!field_is_static (&type->field (i)))
        {
          char buf[20];
 
@@ -420,7 +420,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
   first_field = 1;
   for (i = 0; i < type->num_fields (); ++i)
     {
-      if (field_is_static (&TYPE_FIELD (type, i)))
+      if (field_is_static (&type->field (i)))
         continue;
 
       if (!first_field)
@@ -735,7 +735,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
   std::vector<int> fields;
   for (int i = 0; i < type->num_fields (); ++i)
     {
-      if (field_is_static (&TYPE_FIELD (type, i)))
+      if (field_is_static (&type->field (i)))
        continue;
       if (is_enum && TYPE_FIELD_ARTIFICIAL (type, i))
        continue;
@@ -753,7 +753,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
     {
       QUIT;
 
-      gdb_assert (!field_is_static (&TYPE_FIELD (type, i)));
+      gdb_assert (!field_is_static (&type->field (i)));
       gdb_assert (! (is_enum && TYPE_FIELD_ARTIFICIAL (type, i)));
 
       if (flags->print_offsets)
@@ -992,7 +992,7 @@ rust_composite_type (struct type *original,
   bitpos = 0;
   if (field1 != NULL)
     {
-      struct field *field = &TYPE_FIELD (result, i);
+      struct field *field = &result->field (i);
 
       SET_FIELD_BITPOS (*field, bitpos);
       bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
@@ -1003,7 +1003,7 @@ rust_composite_type (struct type *original,
     }
   if (field2 != NULL)
     {
-      struct field *field = &TYPE_FIELD (result, i);
+      struct field *field = &result->field (i);
       unsigned align = type_align (type2);
 
       if (align != 0)
index d6f176a4867eb8cd936e521e1323dc91ebd40b70..a7f71f85b299abb4511771a823d5c793d665f681 100644 (file)
@@ -1646,7 +1646,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size)
         abort the unwrapping.  */
       for (int i = 0; i < type->num_fields (); i++)
        {
-         struct field f = TYPE_FIELD (type, i);
+         struct field f = type->field (i);
 
          if (field_is_static (&f))
            continue;
index 8d5352945243841aab7d0a12ee5878765dc4eb3b..179a0fb610bc8f9b2d1330ec924db8b5875f1999 100644 (file)
@@ -3339,7 +3339,7 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
 
   while (nfields-- > 0)
     {
-      TYPE_FIELD (type, nfields) = fip->list->field;
+      type->field (nfields) = fip->list->field;
       switch (fip->list->visibility)
        {
        case VISIBILITY_PRIVATE:
@@ -3681,7 +3681,7 @@ read_enum_type (const char **pp, struct type *type,
 
          SYMBOL_TYPE (xsym) = type;
          TYPE_FIELD_NAME (type, n) = xsym->linkage_name ();
-         SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
+         SET_FIELD_ENUMVAL (type->field (n), SYMBOL_VALUE (xsym));
          TYPE_FIELD_BITSIZE (type, n) = 0;
        }
       if (syms == osyms)
index 42f1b1ee690a49c6ceb367a7cf5a3bc176a062d0..3f90ea996478db072983b6450732679ca0bff34f 100644 (file)
@@ -1973,7 +1973,7 @@ check_field (struct type *type, const char *name,
       if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
        {
          is_a_field_of_this->type = type;
-         is_a_field_of_this->field = &TYPE_FIELD (type, i);
+         is_a_field_of_this->field = &type->field (i);
          return 1;
        }
     }
index a46f6a564c059956b1916e32bfa78d8f4b410046..3d1204e244c972f87abb3d3fd516dc88810d911a 100644 (file)
@@ -110,7 +110,7 @@ void
 print_offset_data::update (struct type *type, unsigned int field_idx,
                           struct ui_file *stream)
 {
-  if (field_is_static (&TYPE_FIELD (type, field_idx)))
+  if (field_is_static (&type->field (field_idx)))
     {
       print_spaces_filtered (indentation, stream);
       return;
index 8cbc3b92ec8c66d14668f53ba0f902d09f56a84a..bde4684a82b14fc0a00bcde773fd8dc10d13fa7e 100644 (file)
@@ -1813,7 +1813,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
          {
            struct value *v;
 
-           if (field_is_static (&TYPE_FIELD (type, i)))
+           if (field_is_static (&type->field (i)))
              v = value_static_field (type, i);
            else
              v = value_primitive_field (arg1, offset, i, type);
@@ -2221,7 +2221,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
 
   for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
     {
-      if (!field_is_static (&TYPE_FIELD (t, i))
+      if (!field_is_static (&t->field (i))
          && bitpos == TYPE_FIELD_BITPOS (t, i)
          && types_equal (ftype, TYPE_FIELD_TYPE (t, i)))
        return value_primitive_field (*argp, 0, i, t);
@@ -3299,7 +3299,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
 
       if (t_field_name && strcmp (t_field_name, name) == 0)
        {
-         if (field_is_static (&TYPE_FIELD (t, i)))
+         if (field_is_static (&t->field (i)))
            {
              struct value *v = value_static_field (t, i);
              if (want_address)
index 6eec2577f38614dac952e7c7df8c3806802a3383..aa0adeba99b7a9358ba09e3a5a0db32e8a6ce8e8 100644 (file)
@@ -759,7 +759,7 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
   for (i = 0; i < count; i++)
   {
     TYPE_FIELD_NAME (type, i) = values[i].name;
-    SET_FIELD_ENUMVAL (TYPE_FIELD (type, i), values[i].value);
+    SET_FIELD_ENUMVAL (type->field (i), values[i].value);
   }
 
   return type;
This page took 0.069578 seconds and 4 git commands to generate.