Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [pushed] gdb: remove replace_type
Date: Thu, 22 Oct 2026 13:18:06 -0400	[thread overview]
Message-ID: <20261022171807.273513-1-simon.marchi@efficios.com> (raw)

replace_type has been unused since commit eaea19f98d87 ("gdb: Fully
remove stabs code from GDB", 2025-02-12), which removed its last caller
in stabsread.c.  Remove it.

Change-Id: Ifb7aebb13a5d179cf22bacc7fabe265333288e99
---
 gdb/gdbtypes.c | 46 ----------------------------------------------
 gdb/gdbtypes.h |  2 --
 2 files changed, 48 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 97e7a012b0c5..7bdd2744cf54 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -652,52 +652,6 @@ make_atomic_type (struct type *type)
   return make_qualified_type (type, new_flags, nullptr);
 }
 
-/* Replace the contents of ntype with the type *type.  This changes the
-   contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus
-   the changes are propagated to all types in the TYPE_CHAIN.
-
-   In order to build recursive types, it's inevitable that we'll need
-   to update types in place --- but this sort of indiscriminate
-   smashing is ugly, and needs to be replaced with something more
-   controlled.  TYPE_MAIN_TYPE is a step in this direction; it's not
-   clear if more steps are needed.  */
-
-void
-replace_type (struct type *ntype, struct type *type)
-{
-  struct type *chain;
-
-  /* These two types had better be in the same objfile.  Otherwise,
-     the assignment of one type's main type structure to the other
-     will produce a type with references to objects (names; field
-     lists; etc.) allocated on an objfile other than its own.  */
-  gdb_assert (ntype->objfile_owner () == type->objfile_owner ());
-
-  *ntype->main_type = *type->main_type;
-
-  /* The type length is not a part of the main type.  Update it for
-     each type on the variant chain.  */
-  chain = ntype;
-  do
-    {
-      /* Assert that this element of the chain has no address-class bits
-	 set in its flags.  Such type variants might have type lengths
-	 which are supposed to be different from the non-address-class
-	 variants.  This assertion shouldn't ever be triggered because
-	 symbol readers which do construct address-class variants don't
-	 call replace_type().  */
-      gdb_assert (chain->address_class () == 0);
-
-      chain->set_length (type->length ());
-      chain = chain->chain;
-    }
-  while (ntype != chain);
-
-  /* Assert that the two types have equivalent instance qualifiers.
-     This should be true for at least all of our debug readers.  */
-  gdb_assert (ntype->instance_flags () == type->instance_flags ());
-}
-
 /* See gdbtypes.h.  */
 
 type *
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index af3d47c4a20d..9650d1463322 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2495,8 +2495,6 @@ extern struct type *make_unqualified_type (struct type *);
 
 extern struct type *make_atomic_type (struct type *);
 
-extern void replace_type (struct type *, struct type *);
-
 extern struct type *make_type_with_harvard_address_space
   (struct type *type, enum harvard_address_space aspace);
 

base-commit: 638f6237867858a849f3d6ffa1a1f8d6cd669636
-- 
2.56.0


                 reply	other threads:[~2026-10-22 17:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022171807.273513-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox