[PATCH] C++-fy struct interp/cli_interp/tui_interp/mi_interp
Simon Marchi
simon.marchi@polymtl.ca
Fri Feb 3 04:32:00 GMT 2017
On 2017-02-02 18:14, Pedro Alves wrote:
> Since "struct interp"-related things showed up on the radar, I decided
> to convert the interp hierarchy to real C++ classes...
>
> I didn't want to spend much time on this at this time, so I resisted
> doing any significant redesign. I went for 1-1 conversion. I also
> didn't try to do the obvious next step of making the class data fields
> private. We can probably do more cleaning up and merging of the CLI
> and TUI interpreters. Anyhow, I think this is a sufficient
> improvement as is.
>
> - The interp->data field disappears, since we can put data in the
> interpreter directly now. I left the "init" method in place, but it
> now returns void.
>
> - A few places check if the interpreter method is NULL before calling
> it, and also check whether the method returns true/false. While
> removing the NULL check, I noticed that for some methods, all
> implementations always return true. For those cases, I made the
> C++-fied method return void instead. I didn't bother splitting that
> to a separate patch since it would require touching the exact same
> lines twice.
Thanks, even though it's not a complete OO redesign, it's still a good
step.
> @@ -236,28 +197,17 @@ interp_set (struct interp *interp, int top_level)
> if (!interp->inited)
> {
> - if (interp->procs->init_proc != NULL)
> - {
> - interp->data = interp->procs->init_proc (interp, top_level);
> - }
> - interp->inited = 1;
> + interp->init (top_level);
> + interp->inited = true;
There's a comment just above this block that you can update:
/* Run the init proc. If it fails, try to restore the old interp.
*/
More information about the Gdb-patches
mailing list