This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA v2 10/17] C++ify mi_parse
On 04/12/2017 05:15 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> The patch made mi_parse be a non-POD (non-trivial dtor), so I
> Pedro> think we should get rid of that memset at the same time.
>
> This change was a little bigger than the others. I've added this
> constructor:
>
> mi_parse::mi_parse ()
> : op (MI_COMMAND),
> command (NULL),
> token (NULL),
> cmd (NULL),
> cmd_start (NULL),
> args (NULL),
> argv (NULL),
> argc (0),
> all (0),
> thread_group (-1),
> thread (-1),
> frame (-1),
> language (language_unknown)
> {
> }
>
Thanks. Totally fine with me. If you prefer, using in-class
initialization is also fine. (We've been using it more in recent patches.)
> ... and changed the construction of the object like:
>
> @@ -241,12 +241,5 @@
>
> - memset (parse, 0, sizeof (*parse));
> - parse->all = 0;
> - parse->thread_group = -1;
> - parse->thread = -1;
> - parse->frame = -1;
> - parse->language = language_unknown;
> -
> - cleanup = make_cleanup (mi_parse_cleanup, parse);
> + std::unique_ptr<struct mi_parse> parse (new struct mi_parse);
>
Perfect.
Thanks,
Pedro Alves