]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove type::stub_is_supported
authorTom Tromey <tom@tromey.com>
Fri, 20 Feb 2026 13:54:36 +0000 (06:54 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 13 Mar 2026 18:17:09 +0000 (12:17 -0600)
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 <keiths@redhat.com>
gdb/dwarf2/read.c
gdb/gdbtypes.c
gdb/gdbtypes.h

index 5e310afc3f9288edb75927bd9d6b09542f3a0b34..e436e0df8571b6497db6bec4a205a89633f35478 100644 (file)
@@ -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);
index dcfdc6b56c69ef28dc7060ad79d1379fd3527055..5e07e290f67ed4804bb802c9d89fb2436d624d22 100644 (file)
@@ -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.  */
index 68c272d5fe50cfbda8f032885c88da26702496f1..fae89cd2474d7bf5f96f957e19a8bb1818ec72d9 100644 (file)
@@ -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 () : _("<error type>");
   }
 
-  /* 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);