From: Simon Marchi Date: Mon, 16 Mar 2026 14:25:23 +0000 (-0400) Subject: gdb: remove TYPE_CHAIN X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cc83ec0ce9b4b75e8cd2b0c46f23d4cbf4b2f2b;p=thirdparty%2Fbinutils-gdb.git gdb: remove TYPE_CHAIN IMO, there is no point in keeping this macro. Remove it and access the field directly. If we ever want some kind of abstraction in front of the field, then we'll add a method. Change-Id: Ia45cc7be5c6d9d09a9d4903f01b1ab282839a9c2 Approved-By: Andrew Burgess --- diff --git a/gdb/eval.c b/gdb/eval.c index 32b07f91883..7beff554ed4 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -458,7 +458,7 @@ fake_method::fake_method (type_instance_flags flags, type->main_type = &m_main_type; type->set_length (1); type->set_code (TYPE_CODE_METHOD); - TYPE_CHAIN (type) = type; + type->chain = type; type->set_instance_flags (flags); if (num_types > 0) { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6cdcdb6db2d..d880d707ee8 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -229,7 +229,7 @@ type_allocator::new_type () /* Initialize the fields that might not be zero. */ type->set_code (TYPE_CODE_UNDEF); - TYPE_CHAIN (type) = type; /* Chain back to itself. */ + type->chain = type; /* Chain back to itself. */ return type; } @@ -331,7 +331,7 @@ alloc_type_instance (struct type *oldtype) type->main_type = oldtype->main_type; - TYPE_CHAIN (type) = type; /* Chain back to itself for now. */ + type->chain = type; /* Chain back to itself for now. */ return type; } @@ -355,7 +355,7 @@ smash_type (struct type *type) type->set_owner (arch); /* For now, delete the rings. */ - TYPE_CHAIN (type) = type; + type->chain = type; /* For now, leave the pointer/reference types alone. */ } @@ -388,11 +388,11 @@ make_pointer_type (type *type) ntype->set_is_unsigned (true); /* Update the length of all the other variants of this type. */ - chain = TYPE_CHAIN (ntype); + chain = ntype->chain; while (chain != ntype) { chain->set_length (ntype->length ()); - chain = TYPE_CHAIN (chain); + chain = chain->chain; } return ntype; @@ -441,11 +441,11 @@ make_reference_type (type *type, type_code refcode) *reftype = ntype; /* Update the length of all the other variants of this type. */ - chain = TYPE_CHAIN (ntype); + chain = ntype->chain; while (chain != ntype) { chain->set_length (ntype->length ()); - chain = TYPE_CHAIN (chain); + chain = chain->chain; } return ntype; @@ -592,7 +592,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags, { if (ntype->instance_flags () == new_flags) return ntype; - ntype = TYPE_CHAIN (ntype); + ntype = ntype->chain; } while (ntype != type); @@ -609,7 +609,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags, ntype = storage; ntype->main_type = type->main_type; - TYPE_CHAIN (ntype) = ntype; + ntype->chain = ntype; } /* Pointers or references to the original type are not relevant to @@ -618,8 +618,8 @@ make_qualified_type (struct type *type, type_instance_flags new_flags, ntype->reference_type = nullptr; /* Chain the new qualified type to the old type. */ - TYPE_CHAIN (ntype) = TYPE_CHAIN (type); - TYPE_CHAIN (type) = ntype; + ntype->chain = type->chain; + type->chain = ntype; /* Now set the instance flags and return the new type. */ ntype->set_instance_flags (new_flags); @@ -742,7 +742,7 @@ replace_type (struct type *ntype, struct type *type) gdb_assert (TYPE_ADDRESS_CLASS_ALL (chain) == 0); chain->set_length (type->length ()); - chain = TYPE_CHAIN (chain); + chain = chain->chain; } while (ntype != chain); @@ -4989,7 +4989,7 @@ recursive_dump_type (struct type *type, int spaces) gdb_printf ("%*sreference_type %s\n", spaces, "", host_address_to_string (type->reference_type)); gdb_printf ("%*stype_chain %s\n", spaces, "", - host_address_to_string (TYPE_CHAIN (type))); + host_address_to_string (type->chain)); gdb_printf ("%*sinstance_flags 0x%x", spaces, "", (unsigned) type->instance_flags ()); if (TYPE_CONST (type)) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index afca3c9f636..139467cfd85 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1897,8 +1897,6 @@ extern void allocate_gnat_aux_type (struct type *); (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \ allocate_fixed_point_type_info (type)) -#define TYPE_CHAIN(thistype) (thistype)->chain - /* * Return the alignment of the type in target addressable memory units, or 0 if no alignment was specified. */ #define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)