From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: GDB Patches <gdb-patches@sourceware.org>, Yao Qi <yao.qi@linaro.org>
Subject: Re: [PATCH] Use std::vector on tdesc->reg_defs (gdbserver/tdesc.h)
Date: Sun, 10 Sep 2017 21:35:00 -0000 [thread overview]
Message-ID: <87y3pmme41.fsf@redhat.com> (raw)
In-Reply-To: <e28227bbecf218daaeb28d82d7409574@polymtl.ca> (Simon Marchi's message of "Sun, 10 Sep 2017 20:43:47 +0200")
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 <vector>
>>
>> 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<struct reg *> 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/
next prev parent reply other threads:[~2017-09-10 21:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-10 17:12 Sergio Durigan Junior
2017-09-10 18:43 ` Simon Marchi
2017-09-10 21:35 ` Sergio Durigan Junior [this message]
2017-09-16 3:53 ` Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y3pmme41.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
--cc=yao.qi@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox