[binutils-gdb] gdb: convert TYPE_NOTTEXT macro to type::is_nottext

Tankut Baris Aktemur via Gdb-cvs <[email protected]> Thu, 23 Jul 2026 10:13:10 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7eda16a923b8=
205144fc7d009ea752f9cc5b68d1

commit 7eda16a923b8205144fc7d009ea752f9cc5b68d1
Author: Tankut Baris Aktemur <[email protected]>
Date:   Thu Jul 23 05:04:42 2026 -0500

    gdb: convert TYPE_NOTTEXT macro to type::is_nottext
   =20
    Convert the TYPE_NOTTEXT macro to a method of the type class.  This is
    a refactoring.
   =20
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/c-valprint.c | 2 +-
 gdb/gdbtypes.c   | 8 +++-----
 gdb/gdbtypes.h   | 7 ++++++-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 9f9f61ea2e0..2ee65c41061 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -109,7 +109,7 @@ c_textual_element_type (struct type *type, char format)
 	 being used as data.  */
       if (true_type->code () =3D=3D TYPE_CODE_INT
 	  && true_type->length () =3D=3D 1
-	  && !TYPE_NOTTEXT (true_type))
+	  && !true_type->is_nottext ())
 	return 1;
     }
=20
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a866f36d1ea..dd73d9e624f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4126,7 +4126,7 @@ check_types_equal (struct type *type1, struct type *t=
ype2,
       || type1->endianity_is_not_default () !=3D type2->endianity_is_not_d=
efault ()
       || type1->has_varargs () !=3D type2->has_varargs ()
       || type1->is_vector () !=3D type2->is_vector ()
-      || TYPE_NOTTEXT (type1) !=3D TYPE_NOTTEXT (type2)
+      || type1->is_nottext () !=3D type2->is_nottext ()
       || type1->instance_flags () !=3D type2->instance_flags ()
       || type1->num_fields () !=3D type2->num_fields ())
     return false;
@@ -5091,10 +5091,8 @@ recursive_dump_type (struct type *type, int spaces)
     {
       gdb_puts (" TYPE_FIXED_INSTANCE");
     }
-  if (TYPE_NOTTEXT (type))
-    {
-      gdb_puts (" TYPE_NOTTEXT");
-    }
+  if (type->is_nottext ())
+    gdb_puts (" TYPE_NOTTEXT");
   gdb_puts ("\n");
   gdb_printf ("%*snfields %d ", spaces, "", type->num_fields ());
   if (type->dyn_prop (DYN_PROP_ASSOCIATED) !=3D nullptr
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 11a08428baf..176d3936661 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -168,7 +168,6 @@ struct type_instance_flags
   bool is_atomic : 1;
 };
=20
-#define TYPE_NOTTEXT(t)	(((t)->instance_flags ()).is_nottext)
 #define TYPE_CONST(t) (((t)->instance_flags ()).is_const)
 #define TYPE_VOLATILE(t) (((t)->instance_flags ()).is_volatile)
 #define TYPE_RESTRICT(t) (((t)->instance_flags ()).is_restrict)
@@ -1201,6 +1200,12 @@ struct type
     this->m_instance_flags.is_nottext =3D flag;
   }
=20
+  /* Return if this type is nottext.  */
+  bool is_nottext () const
+  {
+    return this->m_instance_flags.is_nottext;
+  }
+
   /* Get the bounds bounds of this type.  The type must be a range type.  =
*/
   range_bounds *bounds () const
   {