public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb: add gdbarch_up
Date: Thu,  2 Feb 2023 15:08:52 +0000 (GMT)	[thread overview]
Message-ID: <20230202150852.6DA433858C2D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d246d904adf3e338c731c123219a8246281002e2

commit d246d904adf3e338c731c123219a8246281002e2
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Mon Oct 3 12:56:30 2022 -0400

    gdb: add gdbarch_up
    
    Add a gdbarch_up unique pointer type, that calls gdbarch_free on
    deletion.  This is used in the ROCm support patch at the end of this
    series.
    
    Change-Id: I4b808892d35d69a590ce83180f41afd91705b2c8
    Approved-By: Andrew Burgess <aburgess@redhat.com>

Diff:
---
 gdb/gdbarch.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f4efd8c0bc7..f0399c2fa88 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -306,6 +306,14 @@ extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info,
 
 extern void gdbarch_free (struct gdbarch *);
 
+struct gdbarch_deleter
+{
+  void operator() (gdbarch *arch) const
+  { gdbarch_free (arch); }
+};
+
+using gdbarch_up = std::unique_ptr<gdbarch, gdbarch_deleter>;
+
 /* Get the obstack owned by ARCH.  */
 
 extern obstack *gdbarch_obstack (gdbarch *arch);

                 reply	other threads:[~2023-02-02 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230202150852.6DA433858C2D@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).