public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 0/5] Some random C++-ification
@ 2016-09-22 17:51 Tom Tromey
  2016-09-22 17:51 ` [RFA 3/5] Use std::string, std::vector in rust-lang.c Tom Tromey
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Tom Tromey @ 2016-09-22 17:51 UTC (permalink / raw)
  To: gdb-patches

I was feeling inspired by Pedro's Cauldron slides, so I found a few
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.

This should probably not go in until after Pedro's "new" patch.

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.

* 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 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.

Tom


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-09-23 16:14 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 17:51 [RFA 0/5] Some random C++-ification Tom Tromey
2016-09-22 17:51 ` [RFA 3/5] Use std::string, std::vector in rust-lang.c Tom Tromey
2016-09-22 19:03   ` Pedro Alves
2016-09-22 19:24     ` Tom Tromey
2016-09-22 19:35       ` Pedro Alves
2016-09-22 20:37         ` Pierre Muller
     [not found]         ` <57e4328a.c3c4620a.59d5b.803fSMTPIN_ADDED_BROKEN@mx.google.com>
2016-09-23  9:44           ` Pedro Alves
2016-09-23 15:56             ` Tom Tromey
2016-09-23 16:15               ` Pedro Alves
2016-09-22 17:51 ` [RFA 1/5] Use std::string in break-catch-sig.c Tom Tromey
2016-09-23 13:17   ` Yao Qi
2016-09-22 17:51 ` [RFA 4/5] Use std::vector in objfiles.c Tom Tromey
2016-09-22 17:51 ` [RFA 2/5] Use std::string in cp-namespace.c Tom Tromey
2016-09-22 19:08   ` Pedro Alves
2016-09-22 20:56     ` Tom Tromey
2016-09-22 19:03 ` [RFA 5/5] Use std::string rather than dyn-string Tom Tromey
2016-09-22 19:10 ` [RFA 0/5] Some random C++-ification Pedro Alves
2016-09-22 19:15   ` Pedro Alves
2016-09-22 23:10   ` Trevor Saunders
2016-09-23 15:47   ` Tom Tromey
2016-09-23 15:49     ` Pedro Alves

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).