This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v3 05/17] Use SCOPE_EXIT in gdbarch-selftest.c
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>, Andrew Burgess <andrew dot burgess at embecosm dot com>
- Date: Wed, 23 Jan 2019 15:21:19 +0000
- Subject: [PATCH v3 05/17] Use SCOPE_EXIT in gdbarch-selftest.c
- References: <20190123152131.29893-1-palves@redhat.com>
Replace the custom local class with a SCOPE_EXIT.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* gdbarch-selftests.c (struct on_exit): Use SCOPE_EXIT.
---
gdb/gdbarch-selftests.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index 50062abe8a..64d1e543e4 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -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
--
2.14.4