Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Remove type::is_ignored
@ 2026-10-22 16:37 Tom Tromey
  2026-10-22 17:03 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-10-22 16:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that nothing calls type::set_ignored, so this patch removes
that method and the code checking type::is_ignored.

Regression tested on x86-64 Fedora 43.
---
 gdb/ada-valprint.c                | 34 ++++++++++++-------------------
 gdb/compile/compile-cplus-types.c |  3 +--
 gdb/cp-valprint.c                 | 17 +++-------------
 gdb/gdbtypes.c                    |  2 --
 gdb/gdbtypes.h                    | 13 ------------
 gdb/p-valprint.c                  | 17 +++-------------
 6 files changed, 20 insertions(+), 66 deletions(-)

diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 020478bdf40..7bb5e1394b0 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -492,27 +492,19 @@ print_field_values (struct value *value, struct value *outer_value,
 	{
 	  /* Bitfields require special handling, especially due to byte
 	     order problems.  */
-	  if (type->field (i).is_ignored ())
-	    {
-	      fputs_styled (_("<optimized out or zero length>"),
-			    metadata_style.style (), stream);
-	    }
-	  else
-	    {
-	      struct value *v;
-	      int bit_pos = type->field (i).loc_bitpos ();
-	      int bit_size = type->field (i).bitsize ();
-	      value_print_options opts;
-
-	      v = ada_value_primitive_packed_val
-		    (value, nullptr,
-		     bit_pos / HOST_CHAR_BIT,
-		     bit_pos % HOST_CHAR_BIT,
-		     bit_size, type->field (i).type ());
-	      opts = options;
-	      opts.deref_ref = false;
-	      common_val_print (v, stream, recurse + 1, opts, language);
-	    }
+	  struct value *v;
+	  int bit_pos = type->field (i).loc_bitpos ();
+	  int bit_size = type->field (i).bitsize ();
+	  value_print_options opts;
+
+	  v = ada_value_primitive_packed_val
+	    (value, nullptr,
+	     bit_pos / HOST_CHAR_BIT,
+	     bit_pos % HOST_CHAR_BIT,
+	     bit_size, type->field (i).type ());
+	  opts = options;
+	  opts.deref_ref = false;
+	  common_val_print (v, stream, recurse + 1, opts, language);
 	}
       else
 	{
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 8352c9324f4..01482d4082b 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -583,8 +583,7 @@ compile_cplus_convert_struct_or_union_members
     {
       const char *field_name = type->field (i).name ();
 
-      if (type->field (i).is_ignored ()
-	  || type->field (i).is_artificial ())
+      if (type->field (i).is_artificial ())
 	continue;
 
       /* GDB records unnamed/anonymous fields with empty string names.  */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 30291a6c8be..b623ebaa4af 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -279,14 +279,8 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 
 	      /* Bitfields require special handling, especially due to
 		 byte order problems.  */
-	      if (type->field (i).is_ignored ())
-		{
-		  fputs_styled ("<optimized out or zero length>",
-				metadata_style.style (), stream);
-		}
-	      else if (val->bits_synthetic_pointer
-		       (type->field (i).loc_bitpos (),
-			type->field (i).bitsize ()))
+	      if (val->bits_synthetic_pointer (type->field (i).loc_bitpos (),
+					       type->field (i).bitsize ()))
 		{
 		  fputs_styled (_("<synthetic pointer>"),
 				metadata_style.style (), stream);
@@ -304,12 +298,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 	    }
 	  else
 	    {
-	      if (type->field (i).is_ignored ())
-		{
-		  fputs_styled ("<optimized out or zero length>",
-				metadata_style.style (), stream);
-		}
-	      else if (type->field (i).is_static ())
+	      if (type->field (i).is_static ())
 		{
 		  try
 		    {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e0c25c58d83..97e7a012b0c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5070,8 +5070,6 @@ recursive_dump_type (struct type *type, int spaces)
 	gdb_printf (" private");
       else if (fld.is_protected ())
 	gdb_printf (" protected");
-      else if (fld.is_ignored ())
-	gdb_printf (" ignored");
 
       gdb_printf ("\n");
       if (fld.type () != NULL)
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 1fd90f0531e..af3d47c4a20 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -738,17 +738,6 @@ struct field
   void set_virtual ()
   { m_virtual = true; }
 
-  /* True if this field is 'ignored'.  */
-  bool is_ignored () const
-  { return m_ignored; }
-
-  /* Set the field's "ignored" flag.  Note that the 'ignored' bit is
-     deprecated.  It was used by some unknown stabs generator, and has
-     been replaced by the optimized-out approach -- however, it
-     remains because the stabs reader was never updated.  */
-  void set_ignored ()
-  { m_ignored = true; }
-
   union field_location m_loc;
 
   /* For a function or member type, this is 1 if the argument is
@@ -760,8 +749,6 @@ struct field
 
   /* Whether the field is 'virtual'.  */
   bool m_virtual : 1;
-  /* Whether the field is 'ignored'.  */
-  bool m_ignored : 1;
 
   /* Discriminant for union field_location.  */
 
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 0f992bb92a9..bcd3f7a6619 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -604,14 +604,8 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
 
 	      /* Bitfields require special handling, especially due to byte
 		 order problems.  */
-	      if (type->field (i).is_ignored ())
-		{
-		  fputs_styled ("<optimized out or zero length>",
-				metadata_style.style (), stream);
-		}
-	      else if (val->bits_synthetic_pointer
-		       (type->field (i).loc_bitpos (),
-			type->field (i).bitsize ()))
+	      if (val->bits_synthetic_pointer (type->field (i).loc_bitpos (),
+					       type->field (i).bitsize ()))
 		{
 		  fputs_styled (_("<synthetic pointer>"),
 				metadata_style.style (), stream);
@@ -629,12 +623,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
 	    }
 	  else
 	    {
-	      if (type->field (i).is_ignored ())
-		{
-		  fputs_styled ("<optimized out or zero length>",
-				metadata_style.style (), stream);
-		}
-	      else if (type->field (i).is_static ())
+	      if (type->field (i).is_static ())
 		{
 		  /* struct value *v = value_static_field (type, i);
 		     v4.17 specific.  */

base-commit: 21cffe7c0955c6bdb0c14ded96939d409f3c21f0
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-22 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 16:37 [PATCH] Remove type::is_ignored Tom Tromey
2026-10-22 17:03 ` Simon Marchi

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