This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 03/25] Class-fy tdesc_reg tdesc_type and tdesc_feature


On 2017-06-12 10:41, Yao Qi wrote:
This patch class-fies them, adding ctor, dtor, and deleting
copy ctor and assignment operator.

gdb:

2017-05-20  Yao Qi  <yao.qi@linaro.org>

	* target-descriptions.c (tdesc_reg): Add ctor, dtor.
	Delete copy ctor and assignment operator.
	(tdesc_type): Likewise.
	(tdesc_feature): Likewise.
	(tdesc_free_reg): Remove.
	(tdesc_create_reg): Use new.
	(tdesc_free_type): Remove.
	(tdesc_create_vector): Use new.
	(tdesc_create_union): Likewise.
	(tdesc_create_flags): Likewise.
	(tdesc_create_enum): Likewise.
	(tdesc_free_feature): Delete.
	(free_target_description): Use delete.
---
gdb/target-descriptions.c | 200 +++++++++++++++++++++++-----------------------
 1 file changed, 100 insertions(+), 100 deletions(-)

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 9a7e2dd..e2dcd1d 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -48,6 +48,32 @@ DEF_VEC_O(property_s);

 typedef struct tdesc_reg
 {
+public:

Since you are using the "struct" keyword, members are public by default, so you don't have to put "public:". Same things for other types.

Otherwise it LGTM. Of course, more c++ification is always possible, but I think it's fine to go in small increments.

Just FYI, I tested this on top of my "poison-xnew" branch, which points out the invalid use of XNEW/xfree on non-POD types, and it built fine.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]