Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 4/4] gdb: remove TYPE_DYN_PROP_LIST macro
Date: Thu, 7 May 2020 10:15:35 -0400	[thread overview]
Message-ID: <7b47e447-4ca1-0548-e43e-189bac286629@simark.ca> (raw)
In-Reply-To: <87blmzzw1s.fsf@tromey.com>

On 2020-05-07 9:58 a.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> Remove this macro, which abstracts how to obtain the dyn_prop_list of a
> Simon> given type.  We could replace it with a method on `struct type`, but I
> Simon> don't think it's needed, as the only code that accesses the dynamic prop
> Simon> list directly is internal gdbtypes.c code (that can be seen as code
> Simon> internal to `struct type`).  So it can just refer to the field directly.
> 
> Eventually this member should probably be private.

Indeed, there are a few things to consider before:

- To make struct type non-POD, we need to re-evaluate how it's allocated/de-allocated
- Re-evaluate how the types are copied.  copy_type and copy_type_recursive are currently
  free functions.  So either they need to work only using the public API of struct type
  and struct main_type, they need to be made "friend" of these classes, or they need to
  be changed to be methods of these classes.

In the mean time, an approach I've taken with my not-submitted-yet patches is to still
rename the field to give it the `m_` prefix, even though it's not really private yet.
That still ensures that no other part of the code is unexpectedly accessing the field
directly.

Simon


  reply	other threads:[~2020-05-07 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 18:17 [PATCH 0/4] Move dyn prop functions to be methods of struct type Simon Marchi
2020-04-30 18:17 ` [PATCH 1/4] gdb: make get_dyn_prop a method " Simon Marchi
2020-04-30 18:17 ` [PATCH 2/4] gdb: make add_dyn_prop " Simon Marchi
2020-04-30 18:17 ` [PATCH 3/4] gdb: make remove_dyn_prop " Simon Marchi
2020-04-30 18:17 ` [PATCH 4/4] gdb: remove TYPE_DYN_PROP_LIST macro Simon Marchi
2020-05-07 13:58   ` Tom Tromey
2020-05-07 14:15     ` Simon Marchi [this message]
2020-05-07 13:59 ` [PATCH 0/4] Move dyn prop functions to be methods of struct type Tom Tromey
2020-05-07 14:07   ` Simon Marchi
2020-05-07 15:34     ` 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=7b47e447-4ca1-0548-e43e-189bac286629@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --cc=tom@tromey.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