Use SCOPE_EXIT in gdbarch-selftest.c

Replace the custom local class with a SCOPE_EXIT.

gdb/ChangeLog:
2019-01-23  Pedro Alves  <palves@redhat.com>

	* gdbarch-selftests.c (struct on_exit): Use SCOPE_EXIT.
This commit is contained in:
Pedro Alves 2019-01-23 18:58:30 +00:00
parent 77f0e74cbe
commit e587ef421e
2 changed files with 5 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2019-01-23 Pedro Alves <palves@redhat.com>
* gdbarch-selftests.c (struct on_exit): Use SCOPE_EXIT.
2019-01-23 Pedro Alves <palves@redhat.com>
Andrew Burgess <andrew.burgess@embecosm.com>

View File

@ -104,13 +104,7 @@ register_to_value_test (struct gdbarch *gdbarch)
push_target (&mock_target);
/* Pop it again on exit (return/exception). */
struct on_exit
{
~on_exit ()
{
pop_all_targets_at_and_above (process_stratum);
}
} pop_targets;
SCOPE_EXIT { pop_all_targets_at_and_above (process_stratum); };
/* Switch to the mock thread. */
scoped_restore restore_inferior_ptid