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]

[PATCH 0/7] C++fy xml-support.c and more gdb::optional


I've been sitting on this series for a while now as part of the whole
"eliminate cleanups" effort, and since other folks are looking at
eliminating cleanups too, I thought I'd get this one over with to
avoid duplication.

In one of the patches (and also in [1] and in another larger series
I'm working on) I kept wanting to use gdb::optional, but finding
"opt.emplace(....)" a bit cumbersome compared to the more natural
ctor/op=.  So I bit the bullet and brought in a bit more of C++17's
std::optional API into gdb::optional.

I then tried to follow the "Unit tests or it didn't happen (TM)"
principle and added unit tests for gdb::optional.  That payed off and
caught some bugs in the new code I was adding.

[1] - https://sourceware.org/ml/gdb-patches/2017-03/msg00497.html

Tested on x86-64 Fedora 23, native and gdbserver.

Pedro Alves (7):
  C++-ify gdb/xml-support.c a bit to eliminate cleanups
  xml-support.c: Use std::vector
  More gdb::optional features
  gdb::optional unit tests
  xml-support.c: Use std::string for growing string buffer
  gdb_xml_parser: make data fields private and make more functions
    methods
  Eliminate obstack_printf

 gdb/Makefile.in                        |   6 +-
 gdb/common/gdb_optional.h              | 132 +++++++-
 gdb/common/traits.h                    |  26 ++
 gdb/tracefile-tfile.c                  |  14 +-
 gdb/unittests/optional-selftests.c     |  94 ++++++
 gdb/unittests/optional/assignment/1.cc | 195 +++++++++++
 gdb/unittests/optional/assignment/2.cc | 193 +++++++++++
 gdb/unittests/optional/assignment/3.cc | 156 +++++++++
 gdb/unittests/optional/assignment/4.cc | 156 +++++++++
 gdb/unittests/optional/assignment/5.cc |  80 +++++
 gdb/unittests/optional/assignment/6.cc |  90 +++++
 gdb/unittests/optional/assignment/7.cc |  29 ++
 gdb/unittests/optional/cons/copy.cc    | 126 +++++++
 gdb/unittests/optional/cons/default.cc |  58 ++++
 gdb/unittests/optional/cons/move.cc    | 124 +++++++
 gdb/unittests/optional/cons/value.cc   | 294 +++++++++++++++++
 gdb/unittests/optional/in_place.cc     |  65 ++++
 gdb/unittests/optional/observers/1.cc  |  31 ++
 gdb/unittests/optional/observers/2.cc  |  35 ++
 gdb/xml-support.c                      | 577 ++++++++++++++++-----------------
 gdb/xml-support.h                      |  36 +-
 gdb/xml-tdesc.c                        |  81 ++---
 gdb/xml-tdesc.h                        |  17 +-
 23 files changed, 2206 insertions(+), 409 deletions(-)
 create mode 100644 gdb/unittests/optional-selftests.c
 create mode 100644 gdb/unittests/optional/assignment/1.cc
 create mode 100644 gdb/unittests/optional/assignment/2.cc
 create mode 100644 gdb/unittests/optional/assignment/3.cc
 create mode 100644 gdb/unittests/optional/assignment/4.cc
 create mode 100644 gdb/unittests/optional/assignment/5.cc
 create mode 100644 gdb/unittests/optional/assignment/6.cc
 create mode 100644 gdb/unittests/optional/assignment/7.cc
 create mode 100644 gdb/unittests/optional/cons/copy.cc
 create mode 100644 gdb/unittests/optional/cons/default.cc
 create mode 100644 gdb/unittests/optional/cons/move.cc
 create mode 100644 gdb/unittests/optional/cons/value.cc
 create mode 100644 gdb/unittests/optional/in_place.cc
 create mode 100644 gdb/unittests/optional/observers/1.cc
 create mode 100644 gdb/unittests/optional/observers/2.cc

-- 
2.5.5


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