From: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/2] gdb: do minor code modernization in make_pointer_type and make_reference_type
Date: Mon, 3 Aug 2026 16:35:31 +0200 [thread overview]
Message-ID: <20260803143531.2958552-2-tankutbaris.aktemur@amd.com> (raw)
In-Reply-To: <20260803143531.2958552-1-tankutbaris.aktemur@amd.com>
This is a small code modernization. There should be no behavioral
change.
---
gdb/gdbtypes.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2dda175237c..409601abe03 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -366,10 +366,8 @@ smash_type (struct type *type)
type *
make_pointer_type (type *type)
{
- struct type *ntype; /* New type */
- ntype = type->pointer_type;
-
- if (ntype)
+ struct type *ntype = type->pointer_type;
+ if (ntype != nullptr)
return ntype;
ntype = type_allocator (type).new_type ();
@@ -403,23 +401,22 @@ lookup_pointer_type (struct type *type)
type *
make_reference_type (type *type, type_code refcode)
{
- struct type *ntype; /* New type */
- struct type **reftype;
-
gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
- ntype = (refcode == TYPE_CODE_REF ? type->reference_type
- : type->rvalue_reference_type);
+ struct type *ntype = (refcode == TYPE_CODE_REF
+ ? type->reference_type
+ : type->rvalue_reference_type);
- if (ntype)
+ if (ntype != nullptr)
return ntype;
ntype = type_allocator (type).new_type ();
ntype->set_target_type (type);
- reftype = (refcode == TYPE_CODE_REF ? &type->reference_type
- : &type->rvalue_reference_type);
- *reftype = ntype;
+ if (refcode == TYPE_CODE_REF)
+ type->reference_type = ntype;
+ else
+ type->rvalue_reference_type = ntype;
/* FIXME! Assume the machine has only one representation for
references, and that it matches the (only) representation for
--
2.53.0
next prev parent reply other threads:[~2026-08-03 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 14:35 [PATCH 1/2] gdb: remove dead code " Tankut Baris Aktemur
2026-08-03 14:35 ` Tankut Baris Aktemur [this message]
2026-08-03 14:51 ` [PATCH 2/2] gdb: do minor code modernization " Simon Marchi
2026-08-03 14:50 ` [PATCH 1/2] gdb: remove dead code " Simon Marchi
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=20260803143531.2958552-2-tankutbaris.aktemur@amd.com \
--to=tankutbaris.aktemur@amd.com \
--cc=gdb-patches@sourceware.org \
/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