diff options
author | Lancelot Six <lancelot.six@amd.com> | 2023-10-13 09:27:48 +0000 |
---|---|---|
committer | Lancelot Six <lancelot.six@amd.com> | 2023-11-21 11:52:35 +0000 |
commit | 6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b (patch) | |
tree | 07259601270022a6cbeb89826560262f015e1589 /gdb/mi | |
parent | 6b62451ad08056f0ba02e192ec34ef67c4294ef4 (diff) | |
download | gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.zip gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.gz gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.bz2 |
gdb: Replace gdb::optional with std::optional
Since GDB now requires C++17, we don't need the internally maintained
gdb::optional implementation. This patch does the following replacing:
- gdb::optional -> std::optional
- gdb::in_place -> std::in_place
- #include "gdbsupport/gdb_optional.h" -> #include <optional>
This change has mostly been done automatically. One exception is
gdbsupport/thread-pool.* which did not use the gdb:: prefix as it
already lives in the gdb namespace.
Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9
Approved-By: Tom Tromey <tom@tromey.com>
Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 4 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-var.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 8 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-interp.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 12 |
7 files changed, 16 insertions, 16 deletions
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index e473be7..6982338 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -34,7 +34,7 @@ #include "extension.h" #include <ctype.h> #include "mi-parse.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "gdbsupport/gdb-safe-ctype.h" #include "inferior.h" #include "observable.h" @@ -515,7 +515,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, arg->val->type ()->length ())))) return; - gdb::optional<ui_out_emit_tuple> tuple_emitter; + std::optional<ui_out_emit_tuple> tuple_emitter; if (values != PRINT_NO_VALUES || what == all) tuple_emitter.emplace (uiout, nullptr); diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 8b4dd6d..87c54c8 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -30,7 +30,7 @@ #include "mi-getopt.h" #include "gdbthread.h" #include "mi-parse.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "inferior.h" static void varobj_update_one (struct varobj *var, diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 5ea31fc..dbee2d0 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -183,7 +183,7 @@ mi_command::mi_command (const char *name, int *suppress_notification) /* See mi-cmds.h. */ -gdb::optional<scoped_restore_tmpl<int>> +std::optional<scoped_restore_tmpl<int>> mi_command::do_suppress_notification () const { if (m_suppress_notification != nullptr) diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index e67c486..f99c243 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -23,7 +23,7 @@ #define MI_MI_CMDS_H #include "gdbsupport/function-view.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "mi/mi-main.h" enum print_values { @@ -180,12 +180,12 @@ struct mi_command /* If this command was created with a suppress notifications pointer, then this function will set the suppress flag and return a - gdb::optional with its value set to an object that will restore the + std::optional with its value set to an object that will restore the previous value of the suppress notifications flag. If this command was created without a suppress notifications points, - then this function returns an empty gdb::optional. */ - gdb::optional<scoped_restore_tmpl<int>> do_suppress_notification () const; + then this function returns an empty std::optional. */ + std::optional<scoped_restore_tmpl<int>> do_suppress_notification () const; private: diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index ebd7f15..afd2737 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -278,7 +278,7 @@ mi_interp::on_new_thread (thread_info *t) void mi_interp::on_thread_exited (thread_info *t, - gdb::optional<ULONGEST> /* exit_code */, + std::optional<ULONGEST> /* exit_code */, int /* silent */) { target_terminal::scoped_restore_terminal_state term_state; diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 3110c0a..25c2551 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -51,7 +51,7 @@ public: void on_command_error () override; void on_user_selected_context_changed (user_selected_what selection) override; void on_new_thread (thread_info *t) override; - void on_thread_exited (thread_info *t, gdb::optional<ULONGEST> exit_code, + void on_thread_exited (thread_info *t, std::optional<ULONGEST> exit_code, int silent) override; void on_inferior_added (inferior *inf) override; void on_inferior_appeared (inferior *inf) override; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 14ed2a1..487b0a9 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -52,7 +52,7 @@ #include "extension.h" #include "gdbcmd.h" #include "observable.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "gdbsupport/byte-vector.h" #include <ctype.h> @@ -2095,7 +2095,7 @@ mi_cmd_execute (struct mi_parse *parse) user_selected_context current_user_selected_context; - gdb::optional<scoped_restore_current_thread> thread_saver; + std::optional<scoped_restore_current_thread> thread_saver; if (parse->thread != -1) { thread_info *tp = find_thread_global_id (parse->thread); @@ -2112,7 +2112,7 @@ mi_cmd_execute (struct mi_parse *parse) switch_to_thread (tp); } - gdb::optional<scoped_restore_selected_frame> frame_saver; + std::optional<scoped_restore_selected_frame> frame_saver; if (parse->frame != -1) { frame_info_ptr fid; @@ -2130,7 +2130,7 @@ mi_cmd_execute (struct mi_parse *parse) error (_("Invalid frame id: %d"), frame); } - gdb::optional<scoped_restore_current_language> lang_saver; + std::optional<scoped_restore_current_language> lang_saver; if (parse->language != language_unknown) { lang_saver.emplace (); @@ -2141,7 +2141,7 @@ mi_cmd_execute (struct mi_parse *parse) gdb_assert (parse->cmd != nullptr); - gdb::optional<scoped_restore_tmpl<int>> restore_suppress_notification + std::optional<scoped_restore_tmpl<int>> restore_suppress_notification = parse->cmd->do_suppress_notification (); parse->cmd->invoke (parse); @@ -2512,7 +2512,7 @@ print_variable_or_computed (const char *expression, enum print_values values) else val = expr->evaluate (); - gdb::optional<ui_out_emit_tuple> tuple_emitter; + std::optional<ui_out_emit_tuple> tuple_emitter; if (values != PRINT_NO_VALUES) tuple_emitter.emplace (uiout, nullptr); uiout->field_string ("name", expression); |