Use SCOPE_EXIT in gdbarch-selftest.c
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:04:07 +0000 (19:04 +0000)
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.

gdb/ChangeLog
gdb/gdbarch-selftests.c

index 008208e6ec31a16e3e6cd34e43c788afc0f9519b..63957911c8b25e62bc11ebb795da949ed46de027 100644 (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>
 
index 50062abe8ae401803e956f4ac300230c77397b5f..64d1e543e4507ec4b27b78e48fc2bab82e4f384b 100644 (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