binutils-gdb/gdb/common
Simon Marchi 30970df7d5 Add virtual destructor to selftest
Clang 6 shows this warning

  In file included from /home/emaisin/src/binutils-gdb/gdb/common/selftest.c:19:
  In file included from /home/emaisin/src/binutils-gdb/gdb/common/common-defs.h:92:
  In file included from /home/emaisin/src/binutils-gdb/gdb/common/gdb_unique_ptr.h:23:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/memory:81:
  /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:76:2: error: delete called on 'selftests::selftest' that is abstract but has non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
          delete __ptr;
          ^
  /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:236:4: note: in instantiation of member function 'std::default_delete<selftests::selftest>::operator()' requested here
            get_deleter()(__ptr);
            ^
  /home/emaisin/src/binutils-gdb/gdb/common/selftest.c:57:17: note: in instantiation of member function 'std::unique_ptr<selftests::selftest, std::default_delete<selftests::selftest> >::~unique_ptr' requested here
    tests[name] = std::unique_ptr<selftest> (test);
                  ^

The error is legitimate, we (the unique_ptr) are deleting selftest
objects through the base pointer, so technically the destructor should
be virtual, so that the destructor of the subclass is invoked.

gdb/ChangeLog:

	* common/selftest.h (struct selftest): Add virtual destructor.
2017-12-07 11:49:01 -05:00
..
agent.c
agent.h
array-view.h
ax.def
break-common.h
btrace-common.c
btrace-common.h
buffer.c Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00
buffer.h
byte-vector.h
cleanups.c
cleanups.h
common-debug.c
common-debug.h
common-defs.h
common-exceptions.c Eliminate catch_errors 2017-10-10 16:45:50 +01:00
common-exceptions.h Eliminate catch_exceptions/catch_exceptions_with_msg 2017-10-10 17:01:25 +01:00
common-gdbthread.h
common-inferior.h Extend "set cwd" to work on gdbserver 2017-10-04 02:01:45 -04:00
common-regcache.c
common-regcache.h
common-types.h
common-utils.c Poison XNEW and friends for types that should use new/delete 2017-11-24 10:42:25 -05:00
common-utils.h Poison XNEW and friends for types that should use new/delete 2017-11-24 10:42:25 -05:00
common.host
common.m4 Remove ioctl-based procfs support on Solaris 2017-11-30 16:05:30 +01:00
create-version.sh
def-vector.h
default-init-alloc.h
diagnostics.h
enum-flags.h
environ.c
environ.h
errors.c
errors.h
fileio.c
fileio.h
filestuff.c Make open_fds an std::vector 2017-11-17 13:03:34 -05:00
filestuff.h
format.c Target FP printing: Simplify and fix ui_printf 2017-10-24 18:00:50 +02:00
format.h Add include guards to common/format.h 2017-11-26 12:02:40 -07:00
function-view.h
gdb_assert.h Redefine gdb_static_assert as static_assert 2017-12-05 16:15:09 -05:00
gdb_locale.h
gdb_optional.h
gdb_ref_ptr.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h Remove free_splay_tree cleanup 2017-10-09 17:39:29 -06:00
gdb_sys_time.h
gdb_tilde_expand.c Introduce gdb_tilde_expand 2017-10-04 01:57:29 -04:00
gdb_tilde_expand.h Introduce gdb_tilde_expand 2017-10-04 01:57:29 -04:00
gdb_unique_ptr.h
gdb_unlinker.h
gdb_vecs.c
gdb_vecs.h Remove DEF_VEC_I (int) 2017-11-17 13:03:34 -05:00
gdb_wait.h
host-defs.h
job-control.c Assume termios is available, remove support for termio and sgtty 2017-11-06 15:36:46 +00:00
job-control.h
mingw-strerror.c
new-op.c
offset-type.h
poison.h Fix typo in poison.h 2017-12-02 20:28:41 -05:00
posix-strerror.c
preprocessor.h
print-utils.c
print-utils.h
ptid.c
ptid.h
queue.h
refcounted-object.h Use DISABLE_COPY_AND_ASSIGN 2017-09-19 10:10:03 +01:00
rsp-low.c remote: C++ify thread_item and threads_listing_context 2017-11-24 10:40:15 -05:00
rsp-low.h remote: C++ify thread_item and threads_listing_context 2017-11-24 10:40:15 -05:00
run-time-clock.c
run-time-clock.h
scoped_restore.h
selftest.c
selftest.h Add virtual destructor to selftest 2017-12-07 11:49:01 -05:00
signals-state-save-restore.c
signals-state-save-restore.h
signals.c
symbol.h
traits.h
underlying.h
valid-expr.h
vec.c
vec.h
version.h
x86-xstate.h
xml-utils.c Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00
xml-utils.h Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00