gdb: Replace gdb::optional with std::optional

Since GDB now requires a C++17, we don't need the internally maintained
gdb::optional implementation.  This patch does the following replacing:
  - gdb::optonal -> 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
This commit is contained in:
Lancelot Six
2023-10-13 09:27:48 +00:00
parent e7b38ccb82
commit f795c529a8
147 changed files with 413 additions and 412 deletions

View File

@@ -655,12 +655,12 @@ show_script_ext_mode (struct ui_file *file, int from_tty,
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
search for it in the source search path. */
gdb::optional<open_script>
std::optional<open_script>
find_and_open_script (const char *script_file, int search_path)
{
int fd;
openp_flags search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
gdb::optional<open_script> opened;
std::optional<open_script> opened;
gdb::unique_xmalloc_ptr<char> file (tilde_expand (script_file));
@@ -742,7 +742,7 @@ source_script_with_search (const char *file, int from_tty, int search_path)
if (file == NULL || *file == 0)
error (_("source command requires file name of file to source."));
gdb::optional<open_script> opened = find_and_open_script (file, search_path);
std::optional<open_script> opened = find_and_open_script (file, search_path);
if (!opened)
{
/* The script wasn't found, or was otherwise inaccessible.