From: Simon Marchi <simon.marchi@ericsson.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>, Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH 03/10] Make target_desc::features an std::vector
Date: Thu, 02 Nov 2017 13:20:00 -0000 [thread overview]
Message-ID: <249cbd02-0ec3-63e0-1c3e-8946e261af82@ericsson.com> (raw)
In-Reply-To: <868tfpxc3l.fsf@gmail.com>
On 2017-11-02 05:29 AM, Yao Qi wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Patch is good to me, two comments below,
>
>> +typedef std::unique_ptr<tdesc_feature> tdesc_feature_up;
>>
>> /* A target description. */
>>
>> @@ -393,17 +394,7 @@ struct target_desc : tdesc_element
>> target_desc ()
>> {}
>>
>> - virtual ~target_desc ()
>> - {
>> - struct tdesc_feature *feature;
>> - int ix;
>> -
>> - for (ix = 0;
>> - VEC_iterate (tdesc_feature_p, features, ix, feature);
>> - ix++)
>> - delete feature;
>> - VEC_free (tdesc_feature_p, features);
>> - }
>> + virtual ~target_desc () = default;
>>
>
> Can't we remove this line and use default (compiler generated)
> dtor?
If I do, I get the following error:
/home/emaisin/src/binutils-gdb/gdb/target-descriptions.c: In function âvoid free_target_description(void*)â:
/home/emaisin/src/binutils-gdb/gdb/target-descriptions.c:1714:10: error: deleting object of polymorphic class type âtarget_descâ which has non-virtual destructor might cause undefined behaviour [-Werror=delete-non-virtual-dtor]
Makefile:1929: recipe for target 'target-descriptions.o' failed
delete target_desc;
^
>> target_desc (const target_desc &) = delete;
>> void operator= (const target_desc &) = delete;
>> @@ -422,17 +413,13 @@ struct target_desc : tdesc_element
>> std::vector<property> properties;
>>
>> /* The features associated with this target. */
>> - VEC(tdesc_feature_p) *features = NULL;
>> + std::vector<std::unique_ptr<tdesc_feature>> features;
>>
>
> std::vector<tdesc_feature_up> features;
>
> shorten the code.
Yes, I added the typedef later and forgot that instance.
Thanks, I fixed that one locally.
Simon
next prev parent reply other threads:[~2017-11-02 13:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 1:42 [PATCH 00/10] Use std::vector and std::string throughout target-descriptions.c Simon Marchi
2017-10-31 1:42 ` [PATCH 04/10] Make tdesc_feature::name an std::string Simon Marchi
2017-10-31 1:42 ` [PATCH 09/10] Make tdesc_type::u::u::fields an std::vector Simon Marchi
2017-11-02 10:02 ` Yao Qi
2017-11-02 13:27 ` Simon Marchi
2017-12-03 16:04 ` [PATCH 11/10] Split tdesc_type into multiple classes Simon Marchi
2017-12-05 16:46 ` Yao Qi
2017-12-05 21:42 ` Simon Marchi
2017-10-31 1:42 ` [PATCH 05/10] Make tdesc_feature::registers an std::vector Simon Marchi
2017-11-02 9:32 ` Yao Qi
2017-11-02 13:22 ` Simon Marchi
2017-10-31 1:42 ` [PATCH 08/10] Make tdesc_type::name an std::string Simon Marchi
2017-10-31 1:42 ` [PATCH 06/10] Make tdesc_reg string fields std::string Simon Marchi
2017-11-02 9:43 ` Yao Qi
2017-11-02 13:24 ` Simon Marchi
2017-10-31 1:42 ` [PATCH 01/10] Make target_desc::properties an std::vector Simon Marchi
2017-10-31 1:42 ` [PATCH 03/10] Make target_desc::features " Simon Marchi
2017-11-02 9:29 ` Yao Qi
2017-11-02 13:20 ` Simon Marchi [this message]
2017-10-31 1:42 ` [PATCH 07/10] Make tdesc_feature::types " Simon Marchi
2017-10-31 1:42 ` [PATCH 10/10] Make tdesc_arch_data::arch_regs " Simon Marchi
2017-10-31 1:43 ` [PATCH 02/10] Make target_desc::compatible " Simon Marchi
2017-11-02 10:16 ` [PATCH 00/10] Use std::vector and std::string throughout target-descriptions.c Yao Qi
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=249cbd02-0ec3-63e0-1c3e-8946e261af82@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
--cc=simon.marchi@polymtl.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).