From: Tom Tromey Date: Fri, 20 Feb 2026 13:54:36 +0000 (-0700) Subject: Remove type::stub_is_supported X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e93b95c3ae3f00a0283ddbab8029cbc07d96aff;p=thirdparty%2Fbinutils-gdb.git Remove type::stub_is_supported I noticed type::stub_is_supported the other day. It is only set in a single spot in the DWARF reader. And looking at this, the logic seems backward or confused to me. type::is_opaque ends with this: return this->is_stub () || !this->stub_is_supported (); That is, a type is opaque if a bunch of conditions are met (earlier in the method), and then either the type is marked as a stub, or else the type does not have the stub_is_supported flag set. However the DWARF reader essentially does this: if (something) type->set_is_stub (true); else type->set_stub_is_supported (true); That is, either one flag or the other is going to be true along this path. So maybe this was a workaround for some other reader that doesn't set the flag. Luckily, most of the other readers were removed. Checking the CTF reader, it seems to correctly set the stub flag for incomplete types. So, I think the stub_is_supported machinery can simply be removed now. Reviewed-By: Keith Seitz --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 5e310afc3f9..e436e0df857 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10544,8 +10544,6 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) incomplete types, but gives them a size of zero. */ type->set_is_stub (true); } - else - type->set_stub_is_supported (true); if (die_is_declaration (die, cu)) type->set_is_stub (true); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index dcfdc6b56c6..5e07e290f67 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5064,10 +5064,6 @@ recursive_dump_type (struct type *type, int spaces) { gdb_puts (" TYPE_FIXED_INSTANCE"); } - if (type->stub_is_supported ()) - { - gdb_puts (" TYPE_STUB_SUPPORTED"); - } if (TYPE_NOTTEXT (type)) { gdb_puts (" TYPE_NOTTEXT"); @@ -5640,7 +5636,7 @@ type::is_opaque () const if (HAVE_CPLUS_STRUCT (this) && TYPE_NFN_FIELDS (this) != 0) return false; - return this->is_stub () || !this->stub_is_supported (); + return this->is_stub (); } /* See gdbtypes.h. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 68c272d5fe5..fae89cd2474 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -910,7 +910,6 @@ struct main_type unsigned int m_flag_prototyped : 1; unsigned int m_flag_varargs : 1; unsigned int m_flag_vector : 1; - unsigned int m_flag_stub_supported : 1; unsigned int m_flag_gnu_ifunc : 1; unsigned int m_flag_fixed_instance : 1; unsigned int m_flag_objfile_owned : 1; @@ -1072,9 +1071,8 @@ struct type return this->name () != nullptr ? this->name () : _(""); } - /* Return true if this type is "opaque", i.e. a struct or union with - no fields, no methods, and either a stub or with unsupported stub - information. */ + /* Return true if this type is "opaque", i.e. a struct or union + that is a stub with no fields and no methods. */ bool is_opaque () const; /* Note that if thistype is a TYPEDEF type, you have to call check_typedef. @@ -1301,21 +1299,6 @@ struct type this->main_type->m_flag_vector = is_vector; } - /* This debug target supports TYPE_STUB(t). In the unsupported case - we have to rely on NFIELDS to be zero etc., see type::is_opaque. - TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only - guessed the TYPE_STUB(t) value (see dwarfread.c). */ - - bool stub_is_supported () const - { - return this->main_type->m_flag_stub_supported; - } - - void set_stub_is_supported (bool stub_is_supported) - { - this->main_type->m_flag_stub_supported = stub_is_supported; - } - /* Used only for TYPE_CODE_FUNC where it specifies the real function address is returned by this function call. The target_type method determines the final returned function type to be presented to @@ -2054,7 +2037,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *); (TYPE_NESTED_TYPES_FIELD (thistype, n).accessibility \ == accessibility::PRIVATE) - /* Given TYPE, return its floatformat. */ const struct floatformat *floatformat_from_type (const struct type *type);