This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH 4/7] Add ATTRIBUTE_UNUSED_RESULT to scoped_mmap
> This applies ATTRIBUTE_UNUSED_RESULT to scoped_mmap::release and fixes a
> couple of spots to comply.
>
> 2019-02-27 Tom Tromey <tromey@adacore.com>
>
> * nat/linux-btrace.c (linux_enable_bts, linux_enable_pt): Update.
> * common/scoped_mmap.h (class scoped_mmap) <release>: Add
> ATTRIBUTE_UNUSED_RESULT.
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 ();
In this case, for example, ...
> - pt->header = header;
> + pt->header = (struct perf_event_mmap_page *) data.release ();
> + gdb_assert (pt->header == header);
...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 ().
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, , Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928