From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26565 invoked by alias); 14 Sep 2017 10:24:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26380 invoked by uid 89); 14 Sep 2017 10:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Sep 2017 10:24:38 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22275C04B946; Thu, 14 Sep 2017 10:24:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 22275C04B946 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@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CB915D963; Thu, 14 Sep 2017 10:24:34 +0000 (UTC) Subject: Re: [PATCH] Make dwarf_expr_piece::pieces an std::vector To: Simon Marchi References: <1505376948-22860-1-git-send-email-simon.marchi@ericsson.com> <83688181-eb4a-b2d6-f614-b011c6220cd3@redhat.com> <20733c26c93b710b8554c149c02d3fb3@polymtl.ca> Cc: Simon Marchi , gdb-patches@sourceware.org, arnez@linux.vnet.ibm.com From: Pedro Alves Message-ID: Date: Thu, 14 Sep 2017 10:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20733c26c93b710b8554c149c02d3fb3@polymtl.ca> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00373.txt.bz2 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