diff options
author | Tom Tromey <tom@tromey.com> | 2018-06-14 16:01:24 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-09-17 00:42:18 -0600 |
commit | c7c4d3fa80d2fef74fd4bd6b1e22c0399b19455f (patch) | |
tree | d42df5d986adb8a733883a1f1f66cbb159adf1b3 /gdb/inferior.h | |
parent | ee841dd8fee73c355587533027aecc8983bd5478 (diff) | |
download | binutils-gdb-c7c4d3fa80d2fef74fd4bd6b1e22c0399b19455f.tar.gz |
Remove two infrun cleanups
This removes a couple of cleanups from infrun by introducing a couple
of unique_ptr specializations.
gdb/ChangeLog
2018-09-17 Tom Tromey <tom@tromey.com>
* inferior.h (struct infcall_suspend_state_deleter): New.
(infcall_suspend_state_up): New typedef.
(struct infcall_control_state_deleter): New.
(infcall_control_state_up): New typedef.
(make_cleanup_restore_infcall_suspend_state)
(make_cleanup_restore_infcall_control_state): Don't declare.
* infcall.c (call_function_by_hand_dummy): Update.
* infrun.c (do_restore_infcall_suspend_state_cleanup)
(make_cleanup_restore_infcall_suspend_state): Remove.
(do_restore_infcall_control_state_cleanup)
(make_cleanup_restore_infcall_control_state): Remove.
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r-- | gdb/inferior.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h index 9f431de7bf4..5c8ef33dfef 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -63,10 +63,33 @@ extern struct infcall_control_state *save_infcall_control_state (void); extern void restore_infcall_suspend_state (struct infcall_suspend_state *); extern void restore_infcall_control_state (struct infcall_control_state *); -extern struct cleanup *make_cleanup_restore_infcall_suspend_state - (struct infcall_suspend_state *); -extern struct cleanup *make_cleanup_restore_infcall_control_state - (struct infcall_control_state *); +/* A deleter for infcall_suspend_state that calls + restore_infcall_suspend_state. */ +struct infcall_suspend_state_deleter +{ + void operator() (struct infcall_suspend_state *state) const + { + restore_infcall_suspend_state (state); + } +}; + +/* A unique_ptr specialization for infcall_suspend_state. */ +typedef std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter> + infcall_suspend_state_up; + +/* A deleter for infcall_control_state that calls + restore_infcall_control_state. */ +struct infcall_control_state_deleter +{ + void operator() (struct infcall_control_state *state) const + { + restore_infcall_control_state (state); + } +}; + +/* A unique_ptr specialization for infcall_control_state. */ +typedef std::unique_ptr<infcall_control_state, infcall_control_state_deleter> + infcall_control_state_up; extern void discard_infcall_suspend_state (struct infcall_suspend_state *); extern void discard_infcall_control_state (struct infcall_control_state *); |