From: Simon Marchi <simark@simark.ca>
To: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: remove dead code in make_pointer_type and make_reference_type
Date: Mon, 3 Aug 2026 10:50:47 -0400 [thread overview]
Message-ID: <0148fccf-a2f1-4aa0-a85d-a0053fffd387@simark.ca> (raw)
In-Reply-To: <20260803143531.2958552-1-tankutbaris.aktemur@amd.com>
On 8/3/26 10:35 AM, Tankut Baris Aktemur wrote:
> At the end of `make_pointer_type` and `make_reference_type`, GDB
> updates the length of every type in the chain. This is practically
> dead code, because if we reach this point, we must have allocated a
> new type. After a new allocation, the chain contains only the
> newly-created type itself. See in `type_allocator::new_type ()`:
>
> type->chain = type; /* Chain back to itself. */
>
> That is, we always have `ntype == ntype->chain`. Therefore, the loop
> can never be entered. Remove it.
>
> In `make_reference_type`, we also remove `*reftype = ntype;`, because
> a few lines above the assignment was already made. This is repeated
> code.
Thanks, this LGTM.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
prev parent reply other threads:[~2026-08-03 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 14:35 Tankut Baris Aktemur
2026-08-03 14:35 ` [PATCH 2/2] gdb: do minor code modernization " Tankut Baris Aktemur
2026-08-03 14:51 ` Simon Marchi
2026-08-03 14:50 ` Simon Marchi [this message]
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=0148fccf-a2f1-4aa0-a85d-a0053fffd387@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tankutbaris.aktemur@amd.com \
/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