From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WVM+AogTuGliEiwAWB0awg (envelope-from ) for ; Mon, 16 Mar 2026 10:28:24 -0400 Received: by simark.ca (Postfix, from userid 112) id 056D01E0BC; Mon, 16 Mar 2026 10:28:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6C6C41E08C for ; Mon, 16 Mar 2026 10:28:23 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 192954B1A352 for ; Mon, 16 Mar 2026 14:28:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 192954B1A352 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 143524B9DB4E for ; Mon, 16 Mar 2026 14:26:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 143524B9DB4E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 143524B9DB4E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773671212; cv=none; b=upldIQG41X4/yBKn6jD3wopWHxASaJq+mdxtdaJTb734iCfiZBMu9/DxN79Poowrt9Q0R7gTvM7qmytgMNdI7t5WjWAgWw7eVZcjsJ90CKZNgDB9NLNS9VQYJ/nskcky4HbynlC1iie3jFDD2/nUL6wgz455C9STTnXn9FgQtfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773671212; c=relaxed/simple; bh=W/VbgbbhfI+wxVagGBt+f6kArH/BnJXipY55T/JQqds=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Nc7VXW8qgF/E2+J2lQa/tihbzE0rGzivUy3WwdXUU1FWAlczuW40kvyyr658QiJuASNWbWC27olgqp6NnOFktoKfzXU2/kqzpuSCP3cTyL445Z49pq4IWCc6wbQ9IJjuc4Qk8DLKlnP/4PFZynSaFBywOuSXYXeURRubiYLjFxM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 143524B9DB4E Received: by simark.ca (Postfix) id 5E0161E08C; Mon, 16 Mar 2026 10:26:51 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 6/6] gdb: remove TYPE_CHAIN Date: Mon, 16 Mar 2026 10:25:23 -0400 Message-ID: <20260316142645.26877-7-simon.marchi@efficios.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260316142645.26877-1-simon.marchi@efficios.com> References: <20260316142645.26877-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Simon Marchi 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 --- gdb/eval.c | 2 +- gdb/gdbtypes.c | 26 +++++++++++++------------- gdb/gdbtypes.h | 2 -- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/gdb/eval.c b/gdb/eval.c index 6cd6f1e677bc..4ac51399fc89 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 a32dcfb56991..debecac8edd8 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); @@ -4987,7 +4987,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 afca3c9f6368..139467cfd850 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) -- 2.53.0