This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make dwarf_expr_piece::pieces an std::vector
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org, arnez at linux dot vnet dot ibm dot com
- Date: Thu, 14 Sep 2017 11:24:33 +0100
- Subject: Re: [PATCH] Make dwarf_expr_piece::pieces an std::vector
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 22275C04B946
- References: <1505376948-22860-1-git-send-email-simon.marchi@ericsson.com> <83688181-eb4a-b2d6-f614-b011c6220cd3@redhat.com> <20733c26c93b710b8554c149c02d3fb3@polymtl.ca>
On 09/14/2017 10:26 AM, Simon Marchi wrote:
> On 2017-09-14 11:21, Pedro Alves wrote:
>> I wonder if there's ever a case for 'const T &&' parameters,
>> and if GCC could warn about them. At least in non-template
>> functions.
>
FYI, I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82213 now.
> Oops, I started with a const reference, before changing it to rvalue
> reference (and forgot to remove the const). Does the patch look good to
> you otherwise?
>
Sure, with tiny nit below.
> /* Expand the memory allocated stack to contain at least
> @@ -285,14 +282,9 @@ dwarf_expr_context::stack_empty_p () const
> void
> dwarf_expr_context::add_piece (ULONGEST size, ULONGEST offset)
> {
> - struct dwarf_expr_piece *p;
> + this->pieces.emplace_back ();
> + dwarf_expr_piece *p = &(this->pieces.back ());
>
The extra parens look odd to me:
- dwarf_expr_piece *p = &(this->pieces.back ());
+ dwarf_expr_piece *p = &this->pieces.back ();
('p' could be a reference instead, since it's always
non-null, but I guess even better would be to move most
of the code below to a dwarf_expr_piece ctor. But you don't
really have to do that. I definitely understand not wanting
to change too much at a time. And I wouldn't have said a thing
if it weren't for the parens making me pause. :-))
Thanks,
Pedro Alves