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 <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: use gdb::unordered_{set,map} at a few places
Date: Fri, 14 Nov 2025 15:00:59 -0500	[thread overview]
Message-ID: <dc14206e-1b49-46e8-ad97-51668a4b1837@simark.ca> (raw)
In-Reply-To: <87a50ov1gv.fsf@tromey.com>



On 2025-11-14 14:49, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
> 
> Simon> New in v2:
> Simon>  - I forgot to actually build-test with all targets enabled, so I was
> Simon>    missing a change in solib-rocm.c.
> 
> Simon> Use the gdb:: set/map types instead of the std:: ones.  I only changed
> Simon> places in files I can build on my dev machine.
> 
> Simon> I needed to explicitly default the move constructor and assigment
> Simon> operator in proc_mem_file.  I think this is ok, as nothing takes the
> Simon> address of a proc_mem_file, requiring it not to move.
> 
> Simon> I also needed to do it for refcnt_fd, in solib-rocm.c.  It's a bit odd
> Simon> to prevent moving / copying a refcnt_fd, as this struct doesn't directly
> Simon> hold a resource, but I think I get why it was done.
> 
> The patch removes DISABLE_COPY_AND_ASSIGN from refcnt_fd, but that seems
> like it shouldn't be needed -- the map should handle move-only types
> fine, and I think proc_mem_file is already one such.
> 
> Simon>    struct refcnt_fd
> Simon>    {
> Simon> -    DISABLE_COPY_AND_ASSIGN (refcnt_fd);
> Simon>      refcnt_fd (int fd, int refcnt) : fd (fd), refcnt (refcnt) {}
> 
> i.e. this change seems unnecessary.
> 
> Adding DISABLE_COPY_AND_ASSIGN to proc_mem_file isn't really need, since
> it's handled by scoped_fd, though maybe it's worthwhile for clarity.

I'm a bit confused with your answer.  But if I don't explicitly default
the move constructor and move assignment operator in proc_mem_file, it
won't build.  I would have expected proc_mem_file to automatically have
them since its scoped_fd field already is movable.  I don't understand
what makes it non-movable unless I explicitly default the operations.

Simon

  reply	other threads:[~2025-11-14 20:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 21:35 [PATCH] " Simon Marchi
2025-11-13 21:43 ` [PATCH v2] " Simon Marchi
2025-11-14 19:49   ` Tom Tromey
2025-11-14 20:00     ` Simon Marchi [this message]
2025-11-14 20:05       ` Tom Tromey
2025-11-14 20:32         ` Simon Marchi
2025-11-14 21:10           ` Tom Tromey
2025-11-14 21:15             ` Simon Marchi
2025-11-14 21:43               ` Tom Tromey
2025-11-14 22:20                 ` Simon Marchi
2025-11-17 15:58                   ` Tom Tromey
2025-11-17 16:31                     ` Simon Marchi
2026-07-27 16:21                       ` Daniel Fellows

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=dc14206e-1b49-46e8-ad97-51668a4b1837@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