From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122128 invoked by alias); 10 Sep 2017 18:43:57 -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 121926 invoked by uid 89); 10 Sep 2017 18:43:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=heard X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Sep 2017 18:43:55 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v8AIhmvP003448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 10 Sep 2017 14:43:53 -0400 Received: by simark.ca (Postfix, from userid 112) id CD5AB1EAAC; Sun, 10 Sep 2017 14:43:48 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 01A761EA17; Sun, 10 Sep 2017 14:43:47 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 10 Sep 2017 18:43:00 -0000 From: Simon Marchi To: Sergio Durigan Junior Cc: GDB Patches , Yao Qi Subject: Re: [PATCH] Use std::vector on tdesc->reg_defs (gdbserver/tdesc.h) In-Reply-To: <20170910171249.28470-1-sergiodj@redhat.com> References: <20170910171249.28470-1-sergiodj@redhat.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 10 Sep 2017 18:43:49 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00276.txt.bz2 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. 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. Thanks, Simon