aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-decode.c')
-rw-r--r--gdb/cli/cli-decode.c10
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"));