From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 3/6] gdb: remove TYPE_POINTER_TYPE
Date: Mon, 16 Mar 2026 10:25:20 -0400 [thread overview]
Message-ID: <20260316142645.26877-4-simon.marchi@efficios.com> (raw)
In-Reply-To: <20260316142645.26877-1-simon.marchi@efficios.com>
From: Simon Marchi <simon.marchi@polymtl.ca>
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
---
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 bbefa3ff6b4b..b6b6a95b8a6c 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. */
@@ -4983,7 +4983,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 2058f2c8bb94..5bbaa846dc33 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 00b67647fc56..2e24da095c03 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
--
2.53.0
next prev parent reply other threads:[~2026-03-16 14:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 14:25 [PATCH 0/6] Remove some trivial TYPE_* macros Simon Marchi
2026-03-16 14:25 ` [PATCH 1/6] gdb: remove INIT_NONE_SPECIFIC Simon Marchi
2026-03-16 14:25 ` [PATCH 2/6] gdb: remove TYPE_MAIN_TYPE Simon Marchi
2026-03-16 14:25 ` Simon Marchi [this message]
2026-03-16 14:25 ` [PATCH 4/6] gdb: remove TYPE_REFERENCE_TYPE Simon Marchi
2026-03-16 14:25 ` [PATCH 5/6] gdb: remove TYPE_RVALUE_REFERENCE_TYPE Simon Marchi
2026-03-16 14:25 ` [PATCH 6/6] gdb: remove TYPE_CHAIN Simon Marchi
2026-03-16 17:16 ` [PATCH 0/6] Remove some trivial TYPE_* macros Andrew Burgess
2026-03-16 17:28 ` Simon Marchi
2026-03-19 14:34 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316142645.26877-4-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox