aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-option.c
diff options
context:
space:
mode:
authorLancelot Six <lancelot.six@amd.com>2023-10-13 09:27:48 +0000
committerLancelot Six <lancelot.six@amd.com>2023-11-21 11:52:35 +0000
commit6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b (patch)
tree07259601270022a6cbeb89826560262f015e1589 /gdb/cli/cli-option.c
parent6b62451ad08056f0ba02e192ec34ef67c4294ef4 (diff)
downloadbinutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.zip
binutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.gz
binutils-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/cli/cli-option.c')
-rw-r--r--gdb/cli/cli-option.c14
1 files changed, 7 insertions, 7 deletions
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<option_value> value;
+ std::optional<option_value> value;
/* Constructor. */
option_def_and_value (const option_def &option_, void *ctx_,
- gdb::optional<option_value> &&value_ = {})
+ std::optional<option_value> &&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<option_value> &value)
+ std::optional<option_value> &value)
{
if (value.has_value ())
{
@@ -109,7 +109,7 @@ private:
}
};
-static void save_option_value_in_ctx (gdb::optional<option_def_and_value> &ov);
+static void save_option_value_in_ctx (std::optional<option_def_and_value> &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<option_def_and_value>
+static std::optional<option_def_and_value>
parse_option (gdb::array_view<const option_def_group> options_group,
process_options_mode mode,
bool have_delimiter,
@@ -496,7 +496,7 @@ complete_options (completion_tracker &tracker,
}
else if (**args == '-')
{
- gdb::optional<option_def_and_value> ov
+ std::optional<option_def_and_value> 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<option_def_and_value> &ov)
+save_option_value_in_ctx (std::optional<option_def_and_value> &ov)
{
switch (ov->option.type)
{