diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-05-23 17:39:54 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-05-23 17:39:54 -0400 |
commit | ceacbf6edf2c72aaa16280205a9bfc8513e9ed27 (patch) | |
tree | 0e801f13f8c4c59f584af1e1cd5c9e49b225c3ab /gdb | |
parent | 26f16254544873f4d7450f6fbbc8f34bf3d2e359 (diff) | |
download | gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.zip gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.tar.gz gdb-ceacbf6edf2c72aaa16280205a9bfc8513e9ed27.tar.bz2 |
gdb: remove TYPE_FIELD macro
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/aarch64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 6 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/c-varobj.c | 2 | ||||
-rw-r--r-- | gdb/coffread.c | 4 | ||||
-rw-r--r-- | gdb/compile/compile-c-symbols.c | 2 | ||||
-rw-r--r-- | gdb/compile/compile-cplus-types.c | 2 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 8 | ||||
-rw-r--r-- | gdb/ctfread.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 14 | ||||
-rw-r--r-- | gdb/eval.c | 3 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 28 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 23 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 2 | ||||
-rw-r--r-- | gdb/guile/scm-type.c | 2 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 2 | ||||
-rw-r--r-- | gdb/p-typeprint.c | 4 | ||||
-rw-r--r-- | gdb/p-valprint.c | 8 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 2 | ||||
-rw-r--r-- | gdb/python/py-type.c | 2 | ||||
-rw-r--r-- | gdb/rust-lang.c | 12 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 2 | ||||
-rw-r--r-- | gdb/stabsread.c | 4 | ||||
-rw-r--r-- | gdb/symtab.c | 2 | ||||
-rw-r--r-- | gdb/typeprint.c | 2 | ||||
-rw-r--r-- | gdb/valops.c | 6 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 2 |
31 files changed, 84 insertions, 81 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cbf81e7..35fdc61 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 2872d2d..91ea562 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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); diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c99705c..7522917 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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)) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 24f0614..f96a986 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -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 diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index e968192..3e08524 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -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) diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 4dcdc3b..54643dd 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -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) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 29ac595..8ed6c06 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -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); diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index 6cb260d..2be447a 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -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); diff --git a/gdb/coffread.c b/gdb/coffread.c index 9b2f638..8b1f040 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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; diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 8b3cd37..758b12d 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -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); } diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index b2a4544..eb70dfe 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -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; diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index a59afec..0c79b02 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -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 { diff --git a/gdb/ctfread.c b/gdb/ctfread.c index c0694ed..57a3763 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -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; } } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e6d0811..ec38441 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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: @@ -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")); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 96b75a0..4fe8d9a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index f91adbc..60cbcd1 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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 diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 064f924..6faaca2 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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); diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index e58f147..6c0c3fd 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -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); } /* Type smob accessors. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c602398..d700dd8 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -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; diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 3246d4e..70a8308 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -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 diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 284dc85..cf902ac 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -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. */ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index c0e6a92..2dc8962 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -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 diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index dbe25ad..7862f70 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -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; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index f7eba1d..5958b05 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -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) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index d6f176a..a7f71f8 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -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; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 8d53529..179a0fb 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -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) diff --git a/gdb/symtab.c b/gdb/symtab.c index 42f1b1e..3f90ea9 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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; } } diff --git a/gdb/typeprint.c b/gdb/typeprint.c index a46f6a5..3d1204e 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -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; diff --git a/gdb/valops.c b/gdb/valops.c index 8cbc3b9..bde4684 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -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) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 6eec257..aa0adeb 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -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; |