[RFA 0/5] Some random C++-ification
Pedro Alves
palves@redhat.com
Thu Sep 22 19:10:00 GMT 2016
On 09/22/2016 06:50 PM, Tom Tromey wrote:
> I was feeling inspired by Pedro's Cauldron slides, so I found a few
Awesome! :-)
> random spots that could be converted from cleanups to self-managing
> data structures from libstdc++ -- in these cases, std::string and
> std::vector.
>
> I saw a note in one of the C++ conversion documents about perhaps not
> using std::vector, since GCC did not. However, I think often GCC's
> uses are unusual, and I don't think there is any reason to avoid
> std::vector in (most of) gdb.
Agreed.
>
> This should probably not go in until after Pedro's "new" patch.
Does that patch look OK to you?
>
> Built and regtested on x86-64 Fedora 24.
>
> A few reflections on these changes:
>
> * First, I think it's a nice improvement. The examples here aren't so
> dramatic, but if you dig a bit it's easy to find cases where the
> cleanup logic is complicated; and this approach eventually lets one
> delegate all that work to the compiler.
Agreed.
>
> * Speaking of, I have a patch to convert uses of the ensure_python_env
> to use RAII. However, I don't think this is ready to go in --
> because the cleanups installed by this are order-sensitive with
> respect to other cleanups that might be created in the various
> Python-calling functions. My belief is that cleanups have to all be
> run before any destructors, so any ordering issues are a subtlety
> that, in the short term, will have to be accounted for in code
> review.
>
> * It wasn't actually clear to me that this kind of change is
> desirable.
I think it is. We need to eliminate _all_ cleanups in order to
get rid of the TRY/CATCH macros... I think there's a lot of
value in getting the codebase rid of the C -> C++ partial
transition and inviting to work on.
>
> * I was unclear on the coding style to use so I just used the gdb C
> style. Maybe there are some spaces that shouldn't be there now.
Looked fine to me.
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list