From 6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b Mon Sep 17 00:00:00 2001 From: Lancelot Six Date: Fri, 13 Oct 2023 09:27:48 +0000 Subject: 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 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 Approved-By: Pedro Alves --- gdb/cli/cli-option.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/cli/cli-option.c') diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c index 9b303b1..d2d489b 100644 --- a/gdb/cli/cli-option.c +++ b/gdb/cli/cli-option.c @@ -58,11 +58,11 @@ struct option_def_and_value void *ctx; /* The option's value, if any. */ - gdb::optional value; + std::optional value; /* Constructor. */ option_def_and_value (const option_def &option_, void *ctx_, - gdb::optional &&value_ = {}) + std::optional &&value_ = {}) : option (option_), ctx (ctx_), value (std::move (value_)) @@ -99,7 +99,7 @@ private: allocated on the heap, so we must clear the pointer in the source, to avoid a double free. */ static void clear_value (const option_def &option, - gdb::optional &value) + std::optional &value) { if (value.has_value ()) { @@ -109,7 +109,7 @@ private: } }; -static void save_option_value_in_ctx (gdb::optional &ov); +static void save_option_value_in_ctx (std::optional &ov); /* Info passed around when handling completion. */ struct parse_option_completion_info @@ -177,7 +177,7 @@ complete_on_all_options (completion_tracker &tracker, /* Parse ARGS, guided by OPTIONS_GROUP. HAVE_DELIMITER is true if the whole ARGS line included the "--" options-terminator delimiter. */ -static gdb::optional +static std::optional parse_option (gdb::array_view options_group, process_options_mode mode, bool have_delimiter, @@ -496,7 +496,7 @@ complete_options (completion_tracker &tracker, } else if (**args == '-') { - gdb::optional ov + std::optional ov = parse_option (options_group, mode, have_delimiter, args, &completion_info); if (!ov && !tracker.have_completions ()) @@ -589,7 +589,7 @@ complete_options (completion_tracker &tracker, /* Save the parsed value in the option's context. */ static void -save_option_value_in_ctx (gdb::optional &ov) +save_option_value_in_ctx (std::optional &ov) { switch (ov->option.type) { -- cgit v1.1