[binutils-gdb] gdb: convert TYPE_ATOMIC macro to type::is_atomic

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

commit 76af86838c76b6f3d7bb37ad33b1ae83d26d6153
Author: Tankut Baris Aktemur <[email protected]>
Date:   Thu Jul 23 05:04:43 2026 -0500

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

Diff:
---
 gdb/c-typeprint.c | 4 ++--
 gdb/gdbtypes.c    | 6 ++----
 gdb/gdbtypes.h    | 8 ++++++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 1c3b0fba04d..92938270647 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -322,7 +322,7 @@ cp_type_print_method_args (struct type *mtype,
 			     ? " __restrict__"
 			     : " restrict"));
=20
-      if (TYPE_ATOMIC (domain))
+      if (domain->is_atomic ())
 	gdb_printf (stream, " _Atomic");
     }
 }
@@ -475,7 +475,7 @@ c_type_print_modifier (struct type *type, struct ui_fil=
e *stream,
       did_print_modifier =3D 1;
     }
=20
-  if (TYPE_ATOMIC (type))
+  if (type->is_atomic ())
     {
       if (did_print_modifier || need_pre_space)
 	gdb_printf (stream, " ");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a682d525134..34eaac42e20 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5035,10 +5035,8 @@ recursive_dump_type (struct type *type, int spaces)
     }
   if (type->is_restrict ())
     gdb_puts (" TYPE_RESTRICT");
-  if (TYPE_ATOMIC (type))
-    {
-      gdb_puts (" TYPE_ATOMIC");
-    }
+  if (type->is_atomic ())
+    gdb_puts (" TYPE_ATOMIC");
   gdb_puts ("]\n");
=20
   gdb_printf ("%*sflags", spaces, "");
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 0acfda0d74b..624d468e4f2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -168,8 +168,6 @@ struct type_instance_flags
   bool is_atomic : 1;
 };
=20
-#define TYPE_ATOMIC(t) (((t)->instance_flags ()).is_atomic)
-
 /* True if this type represents either an lvalue or lvalue reference type.=
  */
=20
 #define TYPE_IS_REFERENCE(t) \
@@ -1227,6 +1225,12 @@ struct type
     return this->m_instance_flags.is_restrict;
   }
=20
+  /* Return if this type is atomic.  */
+  bool is_atomic () const
+  {
+    return this->m_instance_flags.is_atomic;
+  }
+
   /* Get the bounds bounds of this type.  The type must be a range type.  =
*/
   range_bounds *bounds () const
   {