Use forward_scope_exit for scoped_finish_thread_state
authorPedro Alves <palves@redhat.com>
Wed, 23 Jan 2019 18:58:30 +0000 (18:58 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 23 Jan 2019 19:03:48 +0000 (19:03 +0000)
commit77f0e74cbe2ee7e874432776a0394a3d2a7a4342
tree9925e62f515f7c3ab9800a257ce0e2bc77187993
parent5b9b3e53a68f4568dc0b6907e34e763a6c3dd145
Use forward_scope_exit for scoped_finish_thread_state

This reimplements the manually-written scoped_finish_thread_state
class as a forward_scope_exit instantiation.  forward_scope_exit has
the same interface as scoped_finish_thread_state, so nothing else has
to change.

A forward_scope_exit is preferred over make_scope_exit here because
infrun.c:normal_stop needs to wrap scoped_finish_thread_state in a
gdb::optional.  Since we need the type there, might as well use it
everywhere.

gdb/ChangeLog:
2019-01-23  Pedro Alves  <palves@redhat.com>
    Andrew Burgess  <andrew.burgess@embecosm.com>

* gdbthread.h: Include "common/forward-scope-exit.h".
(scoped_finish_thread_state): Redefine custom class in terms of
forward_scope_exit.
gdb/ChangeLog
gdb/gdbthread.h