Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed] gdb: remove replace_type
@ 2026-10-22 17:18 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2026-10-22 17:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-22 17:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 17:18 [pushed] gdb: remove replace_type Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox