[binutils-gdb] gdb: remove TYPE_POINTER_TYPE

Simon Marchi via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=26b3a712358b32e7dc4f098a15f7fa3db9103f92

commit 26b3a712358b32e7dc4f098a15f7fa3db9103f92
Author: Simon Marchi <[email protected]>
Date:   Mon Mar 16 10:25:20 2026 -0400

    gdb: remove TYPE_POINTER_TYPE
    
    IMO, there is no point in keeping this macro.  Remove it and access the
    field directly.  If we ever want some kind of abstraction in front of
    the field, then we'll add a method.
    
    Change-Id: I592789130ad81776c7a8b39c4721ebb4aa7293f7
    Approved-By: Andrew Burgess <[email protected]>

Diff:
---
 gdb/gdbtypes.c | 8 ++++----
 gdb/gdbtypes.h | 1 -
 gdb/p-exp.y    | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 896b3afe66a..8ebe9948bd2 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -368,14 +368,14 @@ make_pointer_type (type *type)
   struct type *ntype;	/* New type */
   struct type *chain;
 
-  ntype = TYPE_POINTER_TYPE (type);
+  ntype = type->pointer_type;
 
   if (ntype)
     return ntype;
 
   ntype = type_allocator (type).new_type ();
   ntype->set_target_type (type);
-  TYPE_POINTER_TYPE (type) = ntype;
+  type->pointer_type = ntype;
 
   /* FIXME!  Assumes the machine has only one representation for pointers!  */
 
@@ -614,7 +614,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags,
 
   /* Pointers or references to the original type are not relevant to
      the new type.  */
-  TYPE_POINTER_TYPE (ntype) = (struct type *) 0;
+  ntype->pointer_type = (struct type *) 0;
   TYPE_REFERENCE_TYPE (ntype) = (struct type *) 0;
 
   /* Chain the new qualified type to the old type.  */
@@ -4985,7 +4985,7 @@ recursive_dump_type (struct type *type, int spaces)
       recursive_dump_type (type->target_type (), spaces + 2);
     }
   gdb_printf ("%*spointer_type %s\n", spaces, "",
-	      host_address_to_string (TYPE_POINTER_TYPE (type)));
+	      host_address_to_string (type->pointer_type));
   gdb_printf ("%*sreference_type %s\n", spaces, "",
 	      host_address_to_string (TYPE_REFERENCE_TYPE (type)));
   gdb_printf ("%*stype_chain %s\n", spaces, "",
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2058f2c8bb9..5bbaa846dc3 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1897,7 +1897,6 @@ extern void allocate_gnat_aux_type (struct type *);
   (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
    allocate_fixed_point_type_info (type))
 
-#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
 #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
 #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
 #define TYPE_CHAIN(thistype) (thistype)->chain
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 37831be9074..c06ada3b7ff 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -222,7 +222,7 @@ exp	:	exp '^'   %prec UNARY
 exp	:	'@' exp    %prec UNARY
 			{ pstate->wrap<unop_addr_operation> ();
 			  if (current_type)
-			    current_type = TYPE_POINTER_TYPE (current_type); }
+			    current_type = current_type->pointer_type; }
 	;
 
 exp	:	'-' exp    %prec UNARY
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.