Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: "Metzger\, Markus T" <markus.t.metzger@intel.com>
Cc: Tom Tromey <tromey@adacore.com>,
	 "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 4/7] Add ATTRIBUTE_UNUSED_RESULT to scoped_mmap
Date: Thu, 28 Feb 2019 14:59:00 -0000	[thread overview]
Message-ID: <871s3sx8lr.fsf@tromey.com> (raw)
In-Reply-To: <A78C989F6D9628469189715575E55B236B3E188B@IRSMSX104.ger.corp.intel.com>	(Markus T. Metzger's message of "Thu, 28 Feb 2019 07:41:10 +0000")

>> I don't really see the need for such a change but the patch LGTM.  Can we avoid
>> the warning by casting the result to void in case it becomes too awkward otherwise?
>> E.g.

>> 	(void) data.release ();

I'm not sure if that works, but there are other ways to achieve the same
thing.

>> ...we're storing the base pointer.  But we could also store &header-><some field>,
>> which would make it pretty awkward to use the result of release ().

You can do &data.release().field.

I agree this could be awkward, but I don't anticipate it happening very
much.  Holding an interior pointer like that is pretty uncommon,
especially in the situation where one must "un-interior-ize" it in order
to free the resource.

Tom


  reply	other threads:[~2019-02-28 14:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 22:18 [PATCH 0/7] Use warn_unused_result on release methods Tom Tromey
2019-02-27 22:18 ` [PATCH 7/7] Add ATTRIBUTE_UNUSED_RESULT to ref_ptr::release Tom Tromey
2019-02-27 22:18 ` [PATCH 6/7] Add ATTRIBUTE_UNUSED_RESULT to scoped_remote_fd::release Tom Tromey
2019-02-27 22:18 ` [PATCH 1/7] Introduce ATTRIBUTE_UNUSED_RESULT and use it Tom Tromey
2019-02-27 22:18 ` [PATCH 3/7] Add ATTRIBUTE_UNUSED_RESULT to scoped_fd Tom Tromey
2019-02-27 22:18 ` [PATCH 2/7] Add ATTRIBUTE_UNUSED_RESULT to parser_state Tom Tromey
2019-02-27 22:26 ` [PATCH 0/7] Use warn_unused_result on release methods John Baldwin
2019-02-27 22:28 ` [PATCH 5/7] Add ATTRIBUTE_UNUSED_RESULT to macro_buffer Tom Tromey
2019-02-27 22:28 ` [PATCH 4/7] Add ATTRIBUTE_UNUSED_RESULT to scoped_mmap Tom Tromey
2019-02-28  7:41   ` Metzger, Markus T
2019-02-28 14:59     ` Tom Tromey [this message]
2019-03-05 15:46 ` [PATCH 0/7] Use warn_unused_result on release methods Tom Tromey

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=871s3sx8lr.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.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