From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46907 invoked by alias); 10 Sep 2017 21:35:14 -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 45157 invoked by uid 89); 10 Sep 2017 21:35:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,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; Sun, 10 Sep 2017 21:35:12 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D23436DAC4; Sun, 10 Sep 2017 21:35:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1D23436DAC4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=sergiodj@redhat.com Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C377660179; Sun, 10 Sep 2017 21:35:10 +0000 (UTC) From: Sergio Durigan Junior To: Simon Marchi Cc: GDB Patches , Yao Qi Subject: Re: [PATCH] Use std::vector on tdesc->reg_defs (gdbserver/tdesc.h) References: <20170910171249.28470-1-sergiodj@redhat.com> Date: Sun, 10 Sep 2017 21:35:00 -0000 In-Reply-To: (Simon Marchi's message of "Sun, 10 Sep 2017 20:43:47 +0200") Message-ID: <87y3pmme41.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00284.txt.bz2 On Sunday, September 10 2017, Simon Marchi wrote: > On 2017-09-10 19:12, Sergio Durigan Junior wrote: >> This is a followup patch to the build breakage fix on AArch64. While >> doing the fix, I found it better to convert tdesc->reg_defs (on >> gdbserver/tdesc.h) from using VEC to using std::vector. This makes >> the code easier to read and maintain, and also is one more step >> towards the C++fication. >> >> Regtested on BuildBot. > > Hi Sergio, > > Thanks for the patch. It looks good to me, but Yao might want to look > at it since it changes an area he knows well. So leave the patch up > for a few days just in case, if you haven't heard anything new in a > week, you can push. Thanks for the review. > I just noted a nit below. >> diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h >> index 71249e4eda..ec4d6b38dc 100644 >> --- a/gdb/gdbserver/tdesc.h >> +++ b/gdb/gdbserver/tdesc.h >> @@ -22,9 +22,7 @@ >> #include "arch/tdesc.h" >> >> #include "regdef.h" >> - >> -typedef struct reg *tdesc_reg_p; >> -DEF_VEC_P(tdesc_reg_p); >> +#include >> >> struct tdesc_feature >> {}; >> @@ -36,7 +34,7 @@ struct target_desc : tdesc_feature >> { >> /* A vector of elements of register definitions that >> describe the inferior's register set. */ >> - VEC(tdesc_reg_p) *reg_defs; >> + std::vector reg_defs; >> >> /* The register cache size, in bytes. */ >> int registers_size; >> @@ -66,17 +64,16 @@ struct target_desc : tdesc_feature >> >> public: >> target_desc () >> - : reg_defs (NULL), registers_size (0) >> + : registers_size (0) >> {} >> >> ~target_desc () >> { >> int i; >> - struct reg *reg; >> >> - for (i = 0; VEC_iterate (tdesc_reg_p, reg_defs, i, reg); i++) >> + for (reg *reg : reg_defs) >> xfree (reg); >> - VEC_free (tdesc_reg_p, reg_defs); >> + reg_defs.clear (); > > The clear is unnecessary. You're right, removed. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/