diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-07 15:37:25 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-04-12 11:16:19 -0600 |
commit | 156d9eab863f40fc812245cf1213abbe12d192b3 (patch) | |
tree | d4ac157ce5cd9fe88f8906f233c00f6ccebf3e12 /gdb/cli/cli-decode.c | |
parent | 4d89769a7b4e38e94a6e027281b36eff71fc8214 (diff) | |
download | gdb-156d9eab863f40fc812245cf1213abbe12d192b3.zip gdb-156d9eab863f40fc812245cf1213abbe12d192b3.tar.gz gdb-156d9eab863f40fc812245cf1213abbe12d192b3.tar.bz2 |
Use scoped_restore in more places
This changes a few more places to use scoped_restore, allowing some
cleanup removals.
gdb/ChangeLog
2017-04-12 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (exec_direction_forward): Remove.
(exec_reverse_continue, mi_execute_command): Use scoped_restore.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Use
scoped_restore.
* guile/guile.c (guile_repl_command, guile_command)
(gdbscm_execute_gdb_command): Use scoped_restore.
* go-exp.y (go_parse): Use scoped_restore.
* d-exp.y (d_parse): Use scoped_restore.
* cli/cli-decode.c (cmd_func): Use scoped_restore.
* c-exp.y (c_parse): Use scoped_restore.
Diffstat (limited to 'gdb/cli/cli-decode.c')
-rw-r--r-- | gdb/cli/cli-decode.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index fc14465..d45733e 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -23,6 +23,7 @@ #include "ui-out.h" #include "cli/cli-cmds.h" #include "cli/cli-decode.h" +#include "common/gdb_optional.h" /* Prototypes for local functions. */ @@ -1878,17 +1879,12 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty) { if (cmd_func_p (cmd)) { - struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); + gdb::optional<scoped_restore_tmpl<int>> restore_suppress; if (cmd->suppress_notification != NULL) - { - make_cleanup_restore_integer (cmd->suppress_notification); - *cmd->suppress_notification = 1; - } + restore_suppress.emplace (cmd->suppress_notification, 1); (*cmd->func) (cmd, args, from_tty); - - do_cleanups (cleanups); } else error (_("Invalid command")); |