]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Replace gdb::optional with std::optional
authorLancelot Six <lancelot.six@amd.com>
Fri, 13 Oct 2023 09:27:48 +0000 (09:27 +0000)
committerLancelot Six <lancelot.six@amd.com>
Tue, 21 Nov 2023 11:52:35 +0000 (11:52 +0000)
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>
147 files changed:
gdb/aarch64-linux-tdep.c
gdb/ada-lang.c
gdb/ada-lex.l
gdb/ada-valprint.c
gdb/amd-dbgapi-target.c
gdb/annotate.c
gdb/arm-fbsd-tdep.c
gdb/arm-fbsd-tdep.h
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/auto-load.c
gdb/auxv.c
gdb/auxv.h
gdb/avr-tdep.c
gdb/breakpoint.c
gdb/buildsym.c
gdb/cli/cli-cmds.c
gdb/cli/cli-cmds.h
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/cli/cli-option.c
gdb/cli/cli-option.h
gdb/command.h
gdb/compile/compile.c
gdb/darwin-nat.c
gdb/debuginfod-support.c
gdb/disasm.c
gdb/disasm.h
gdb/dwarf2/attribute.h
gdb/dwarf2/cu.h
gdb/dwarf2/die.h
gdb/dwarf2/index-cache.h
gdb/dwarf2/index-write.c
gdb/dwarf2/line-header.c
gdb/dwarf2/macro.c
gdb/dwarf2/macro.h
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/read.c
gdb/dwarf2/read.h
gdb/eval.c
gdb/event-top.c
gdb/exceptions.c
gdb/extension-priv.h
gdb/extension.c
gdb/extension.h
gdb/f-lang.c
gdb/fbsd-nat.c
gdb/fbsd-nat.h
gdb/fbsd-tdep.c
gdb/gdbthread.h
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/guile/scm-ports.c
gdb/ia64-tdep.c
gdb/inf-child.c
gdb/inf-child.h
gdb/infcmd.c
gdb/inferior.c
gdb/inferior.h
gdb/inflow.c
gdb/infrun.c
gdb/interps.c
gdb/interps.h
gdb/jit.c
gdb/linux-nat.c
gdb/linux-nat.h
gdb/linux-tdep.c
gdb/linux-tdep.h
gdb/linux-thread-db.c
gdb/main.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-cmds.c
gdb/mi/mi-cmds.h
gdb/mi/mi-interp.c
gdb/mi/mi-interp.h
gdb/mi/mi-main.c
gdb/nat/linux-osdata.c
gdb/nat/windows-nat.c
gdb/nat/windows-nat.h
gdb/observable.h
gdb/osdata.c
gdb/parse.c
gdb/ppc-linux-nat.c
gdb/ppc-linux-tdep.c
gdb/ppc-tdep.h
gdb/printcmd.c
gdb/probe.c
gdb/procfs.c
gdb/psymtab.c
gdb/psymtab.h
gdb/python/py-disasm.c
gdb/python/py-framefilter.c
gdb/python/py-inferior.c
gdb/python/py-mi.c
gdb/python/py-utils.c
gdb/python/python-internal.h
gdb/python/python.c
gdb/ravenscar-thread.c
gdb/record-btrace.c
gdb/regcache.c
gdb/remote.c
gdb/riscv-tdep.c
gdb/s390-linux-tdep.c
gdb/skip.c
gdb/solib-aix.c
gdb/solib-dsbt.c
gdb/solib-svr4.c
gdb/solib-target.c
gdb/source-cache.c
gdb/stack.c
gdb/stack.h
gdb/symfile.c
gdb/symtab.c
gdb/symtab.h
gdb/target.c
gdb/target.h
gdb/thread.c
gdb/tracefile-tfile.c
gdb/tracepoint.c
gdb/tui/tui-disasm.c
gdb/tui/tui-layout.c
gdb/unittests/optional-selftests.c
gdb/utils.c
gdb/valarith.c
gdb/valops.c
gdb/value.c
gdb/value.h
gdb/windows-nat.c
gdb/xml-support.c
gdb/xml-support.h
gdb/xml-syscall.c
gdb/xml-tdesc.c
gdb/xml-tdesc.h
gdbserver/linux-aarch64-low.cc
gdbserver/regcache.cc
gdbserver/regcache.h
gdbserver/win32-low.cc
gdbsupport/common-debug.h
gdbsupport/event-loop.cc
gdbsupport/filestuff.cc
gdbsupport/filestuff.h
gdbsupport/forward-scope-exit.h
gdbsupport/range-chain.h
gdbsupport/scoped_ignore_sigttou.h
gdbsupport/thread-pool.cc
gdbsupport/thread-pool.h

index f1fcce9b9eb418a3e51a4214e031f09d9951952c..cd99b33fed25afd3f09824d8d2d4b25aac637432 100644 (file)
@@ -1609,7 +1609,7 @@ static const struct target_desc *
 aarch64_linux_core_read_description (struct gdbarch *gdbarch,
                                     struct target_ops *target, bfd *abfd)
 {
-  gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
+  std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
   CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
   CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
 
@@ -2427,7 +2427,7 @@ aarch64_linux_gcc_target_options (struct gdbarch *gdbarch)
 
    Return the allocation tag if successful and nullopt otherwise.  */
 
-static gdb::optional<CORE_ADDR>
+static std::optional<CORE_ADDR>
 aarch64_mte_get_atag (CORE_ADDR address)
 {
   gdb::byte_vector tags;
@@ -2481,7 +2481,7 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch,
   CORE_ADDR addr = value_as_address (address);
 
   /* Fetch the allocation tag for ADDRESS.  */
-  gdb::optional<CORE_ADDR> atag
+  std::optional<CORE_ADDR> atag
     = aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch, addr));
 
   if (!atag.has_value ())
@@ -2579,7 +2579,7 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address,
 
       /* Remove the top byte.  */
       addr = gdbarch_remove_non_address_bits (gdbarch, addr);
-      gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
+      std::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
 
       if (!atag.has_value ())
        return nullptr;
@@ -2651,7 +2651,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
       uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
       uiout->text ("\n");
 
-      gdb::optional<CORE_ADDR> atag
+      std::optional<CORE_ADDR> atag
        = aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch,
                                                                 fault_addr));
       gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
index 9bb649e901d87c1be348e39a0e3cdf9214841560..58c70160d313035fb08493d7abc7b2e42507b692 100644 (file)
@@ -3098,7 +3098,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
                               type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
                               type0->field (0).bitsize ());
   int base_low =  ada_discrete_type_low_bound (type0->index_type ());
-  gdb::optional<LONGEST> base_low_pos, low_pos;
+  std::optional<LONGEST> base_low_pos, low_pos;
   CORE_ADDR base;
 
   low_pos = discrete_position (base_index_type, low);
@@ -3132,7 +3132,7 @@ ada_value_slice (struct value *array, int low, int high)
                              (alloc, type->target_type (), index_type,
                               type->dyn_prop (DYN_PROP_BYTE_STRIDE),
                               type->field (0).bitsize ());
-  gdb::optional<LONGEST> low_pos, high_pos;
+  std::optional<LONGEST> low_pos, high_pos;
 
 
   low_pos = discrete_position (base_index_type, low);
@@ -8792,7 +8792,7 @@ pos_atr (struct value *arg)
   if (!discrete_type_p (type))
     error (_("'POS only defined on discrete types"));
 
-  gdb::optional<LONGEST> result = discrete_position (type, value_as_long (val));
+  std::optional<LONGEST> result = discrete_position (type, value_as_long (val));
   if (!result.has_value ())
     error (_("enumeration value is invalid: can't find 'POS"));
 
index 0547b704eaf4d59a1b777eef708f2adb3ce3bcde..0576f361a42de5fc6b049e6ff99755ce2762da40 100644 (file)
@@ -713,7 +713,7 @@ processAttribute (const char *str)
     if (strcasecmp (str, item.name) == 0)
       return item.code;
 
-  gdb::optional<int> found;
+  std::optional<int> found;
   for (const auto &item : attributes)
     if (subseqMatch (str, item.name))
       {
index b32f1e506d1ae1581c597e30c04f54d64b53b3ac..f1c4e8b0b706443c478ddfdcef69bf8ec7f9d075 100644 (file)
@@ -385,7 +385,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
 
     case TYPE_CODE_ENUM:
       {
-       gdb::optional<LONGEST> posn = discrete_position (type, val);
+       std::optional<LONGEST> posn = discrete_position (type, val);
        if (posn.has_value ())
          fputs_styled (ada_enum_name (type->field (*posn).name ()),
                        variable_name_style.style (), stream);
@@ -827,7 +827,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
   int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
 
   val = unpack_long (type, valaddr + offset_aligned);
-  gdb::optional<LONGEST> posn = discrete_position (type, val);
+  std::optional<LONGEST> posn = discrete_position (type, val);
   if (posn.has_value ())
     {
       const char *name = ada_enum_name (type->field (*posn).name ());
index c03b64ce190883cb60be1fe45eca6e9afacb793a..18c0543c40eacded69f607bbfd12f8b2d7c5b022 100644 (file)
@@ -528,7 +528,7 @@ amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
                               ULONGEST offset, ULONGEST requested_len,
                               ULONGEST *xfered_len)
 {
-  gdb::optional<scoped_restore_current_thread> maybe_restore_thread;
+  std::optional<scoped_restore_current_thread> maybe_restore_thread;
 
   if (!ptid_is_gpu (inferior_ptid))
     return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
@@ -1901,7 +1901,7 @@ static void
 amd_dbgapi_log_message_callback (amd_dbgapi_log_level_t level,
                                 const char *message)
 {
-  gdb::optional<target_terminal::scoped_restore_terminal_state> tstate;
+  std::optional<target_terminal::scoped_restore_terminal_state> tstate;
 
   if (target_supports_terminal_ours ())
     {
index 8385429042d3e12db00cad1904ba52aa94785092..f3ead9e3ce2997dab26f115d61318220cd63e4e8 100644 (file)
@@ -233,7 +233,7 @@ annotate_thread_changed (void)
 
 static void
 annotate_thread_exited (thread_info *t,
-                       gdb::optional<ULONGEST> exit_code,
+                       std::optional<ULONGEST> exit_code,
                        bool /* silent */)
 {
   if (annotation_level > 1)
index 90273a3f5ef8d5924abfebdd22481904b5c6d41c..391afec9e670d303a2800a0a90f7ca24729e7d26 100644 (file)
@@ -215,7 +215,7 @@ arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
 /* See arm-fbsd-tdep.h.  */
 
 const struct target_desc *
-arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
+arm_fbsd_read_description_auxv (const std::optional<gdb::byte_vector> &auxv,
                                target_ops *target, gdbarch *gdbarch, bool tls)
 {
   CORE_ADDR arm_hwcap = 0;
@@ -244,7 +244,7 @@ arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
 const struct target_desc *
 arm_fbsd_read_description_auxv (bool tls)
 {
-  const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
+  const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
   return arm_fbsd_read_description_auxv (auxv,
                                         current_inferior ()->top_target (),
                                         current_inferior ()->arch (),
@@ -260,7 +260,7 @@ arm_fbsd_core_read_description (struct gdbarch *gdbarch,
 {
   asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
 
-  gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
+  std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
   return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr);
 }
 
index 3478e4b6860d248f90f427bc713dffe326b7f310..7eb1850c1a7fdfc444c412dc97b5904ea4abad73 100644 (file)
@@ -47,7 +47,7 @@ extern const struct regset arm_fbsd_tls_regset;
    AUXV.  */
 
 extern const struct target_desc *
-  arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
+  arm_fbsd_read_description_auxv (const std::optional<gdb::byte_vector> &auxv,
                                  target_ops *target, gdbarch *gdbarch,
                                  bool tls);
 
index 86fa3de0fd29756e1f6997a59cfae8c24a0218b9..8117d35a4d371379b09639eafee0374da09806b2 100644 (file)
@@ -732,7 +732,7 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
                                 struct target_ops *target,
                                 bfd *abfd)
 {
-  gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
+  std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
   CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
 
   if (arm_hwcap & HWCAP_VFP)
index d4047ddbb868bfbe6f0448c78daa9c561b1a3469..7a93b09824782b13b88618d9002fa3902aa271fe 100644 (file)
@@ -302,7 +302,7 @@ struct arm_prologue_cache
   int framereg;
 
   /* True if the return address is signed, false otherwise.  */
-  gdb::optional<bool> ra_signed_state;
+  std::optional<bool> ra_signed_state;
 
   /* Saved register offsets.  */
   trad_frame_saved_reg *saved_regs;
@@ -1035,7 +1035,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
   while (start < limit)
     {
       unsigned short insn;
-      gdb::optional<bool> ra_signed_state;
+      std::optional<bool> ra_signed_state;
 
       insn = read_code_unsigned_integer (start, 2, byte_order_for_code);
 
index 8bbe6696dccfa48bf4d024873b1725a64a779350..daea75b743733929aaaa88bacc10350f2e21e2fc 100644 (file)
@@ -914,7 +914,7 @@ source_script_file (struct auto_load_pspace_info *pspace_info,
       return;
     }
 
-  gdb::optional<open_script> opened = find_and_open_script (file,
+  std::optional<open_script> opened = find_and_open_script (file,
                                                            1 /*search_path*/);
 
   if (opened)
index 61acd48fc98540378f0a5e3cec25068d54df1c81..994d97c1a2c84e86f7aa646c12427eb93e515bd0 100644 (file)
@@ -331,7 +331,7 @@ parse_auxv (target_ops *ops, gdbarch *gdbarch, const gdb_byte **readptr,
     overhead of transfering data from a remote target to the local host.  */
 struct auxv_info
 {
-  gdb::optional<gdb::byte_vector> data;
+  std::optional<gdb::byte_vector> data;
 };
 
 /* Per-inferior data key for auxv.  */
@@ -357,7 +357,7 @@ auxv_all_objfiles_removed (program_space *pspace)
 
 /* See auxv.h.  */
 
-const gdb::optional<gdb::byte_vector> &
+const std::optional<gdb::byte_vector> &
 target_read_auxv ()
 {
   inferior *inf = current_inferior ();
@@ -374,7 +374,7 @@ target_read_auxv ()
 
 /* See auxv.h.  */
 
-gdb::optional<gdb::byte_vector>
+std::optional<gdb::byte_vector>
 target_read_auxv_raw (target_ops *ops)
 {
   return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL);
@@ -413,7 +413,7 @@ target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops,
 int
 target_auxv_search (CORE_ADDR match, CORE_ADDR *valp)
 {
-  const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
+  const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
 
   if (!auxv.has_value ())
     return -1;
@@ -572,7 +572,7 @@ fprint_target_auxv (struct ui_file *file)
   gdbarch *gdbarch = current_inferior ()->arch ();
   CORE_ADDR type, val;
   int ents = 0;
-  const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
+  const std::optional<gdb::byte_vector> &auxv = target_read_auxv ();
 
   if (!auxv.has_value ())
     return -1;
index a920f7a5da8a22ceb5b82547b36b91ce32b42491..10f31dc84e80745921fb63fd4f9d9f19602e02ad 100644 (file)
@@ -48,11 +48,11 @@ extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
 
 /* Read auxv data from the current inferior's target stack.  */
 
-extern const gdb::optional<gdb::byte_vector> &target_read_auxv ();
+extern const std::optional<gdb::byte_vector> &target_read_auxv ();
 
 /* Read auxv data from OPS.  */
 
-extern gdb::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
+extern std::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
 
 /* Search AUXV for an entry with a_type matching MATCH.
 
index 92aec3b510f55c8d8060ed0b926e11f3b4788a73..598d740883c6cd3c3ebf3ea6d79dd2a198ac92d3 100644 (file)
@@ -1566,7 +1566,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
   unsigned int val;
 
   /* Find out how many io registers the target has.  */
-  gdb::optional<gdb::byte_vector> buf
+  std::optional<gdb::byte_vector> buf
     = target_read_alloc (current_inferior ()->top_target (),
                         TARGET_OBJECT_AVR, "avr.io_reg");
 
index cd8f36fbf05e19f9a2847b518e33f1f7efdfd636..af395fde14a906c22056b3da68ba833b3a8570e0 100644 (file)
@@ -82,7 +82,7 @@
 #include <algorithm>
 #include "progspace-and-thread.h"
 #include "gdbsupport/array-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/common-utils.h"
 
 /* Prototypes for local functions.  */
@@ -2067,7 +2067,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
   if (b->disposition == disp_del_at_next_stop)
     return;
 
-  gdb::optional<scoped_restore_selected_frame> restore_frame;
+  std::optional<scoped_restore_selected_frame> restore_frame;
 
   /* Determine if the watchpoint is within scope.  */
   if (b->exp_valid_block == NULL)
@@ -3365,7 +3365,7 @@ remove_breakpoints (void)
 
 static void
 remove_threaded_breakpoints (thread_info *tp,
-                            gdb::optional<ULONGEST> /* exit_code */,
+                            std::optional<ULONGEST> /* exit_code */,
                             int /* silent */)
 {
   for (breakpoint &b : all_breakpoints_safe ())
@@ -6776,8 +6776,8 @@ print_one_breakpoint_location (struct breakpoint *b,
        (uiout->test_flags (fix_breakpoint_script_output)
         || fix_breakpoint_script_output_globally);
 
-      gdb::optional<ui_out_emit_tuple> tuple_emitter;
-      gdb::optional<ui_out_emit_list> list_emitter;
+      std::optional<ui_out_emit_tuple> tuple_emitter;
+      std::optional<ui_out_emit_list> list_emitter;
 
       if (use_fixed_output)
        list_emitter.emplace (uiout, "script");
@@ -6850,7 +6850,8 @@ print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
     = (uiout->test_flags (fix_multi_location_breakpoint_output)
        || fix_multi_location_breakpoint_output_globally);
 
-  gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
+  std::optional<ui_out_emit_tuple> bkpt_tuple_emitter (std::in_place, uiout,
+                                                      "bkpt");
   bool printed = print_one_breakpoint_location (b, NULL, 0, last_loc,
                                                allflag, false);
 
@@ -6885,7 +6886,7 @@ print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
                      || !b->first_loc ().enabled
                      || b->first_loc ().disabled_by_cond))))
        {
-         gdb::optional<ui_out_emit_list> locations_list;
+         std::optional<ui_out_emit_list> locations_list;
 
          /* For MI version <= 2, keep the behavior where GDB outputs an invalid
             MI record.  For later versions, place breakpoint locations in a
@@ -9950,7 +9951,7 @@ watchpoint::print_it (const bpstat *bs) const
 
   string_file stb;
 
-  gdb::optional<ui_out_emit_tuple> tuple_emitter;
+  std::optional<ui_out_emit_tuple> tuple_emitter;
   switch (this->type)
     {
     case bp_watchpoint:
@@ -10928,7 +10929,7 @@ until_break_command (const char *arg, int from_tty, int anywhere)
 
   std::vector<breakpoint_up> breakpoints;
 
-  gdb::optional<delete_longjmp_breakpoint_cleanup> lj_deleter;
+  std::optional<delete_longjmp_breakpoint_cleanup> lj_deleter;
 
   if (frame_id_p (caller_frame_id))
     {
index b982afea3d27e208218251052abcef03fd72a604..32d60cc22d43ccb651a3c5f701762be853c7cadf 100644 (file)
@@ -643,7 +643,7 @@ buildsym_compunit::record_line (struct subfile *subfile, int line,
      anyway.  */
   if (line == 0)
     {
-      gdb::optional<int> last_line;
+      std::optional<int> last_line;
 
       while (!subfile->line_vector_entries.empty ())
        {
index fd93e5b4ccbb2c14fbf0b648159a031e72b6de4d..cb9ff5548849de41f0460f3fdc683f299919c861 100644 (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.
index 429574426ac2503b7983356a2d8fc602df704c85..a2579dc25f2df2194a48a753a2c8c83b60697723 100644 (file)
@@ -18,7 +18,7 @@
 #define CLI_CLI_CMDS_H
 
 #include "gdbsupport/filestuff.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "completer.h"
 
 /* Chain containing all defined commands.  */
@@ -179,7 +179,7 @@ struct open_script
   }
 };
 
-extern gdb::optional<open_script>
+extern std::optional<open_script>
     find_and_open_script (const char *file, int search_path);
 
 /* Command tracing state.  */
index 0bbe96b5334253c4c899bec02ac0fb13415d1c3a..940cd6a2c8e52661ee8528eb06164f7fdeec4174 100644 (file)
@@ -24,7 +24,7 @@
 #include "cli/cli-cmds.h"
 #include "cli/cli-decode.h"
 #include "cli/cli-style.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 /* Prototypes for local functions.  */
 
@@ -2727,7 +2727,7 @@ cmd_func (struct cmd_list_element *cmd, const char *args, int from_tty)
 {
   if (!cmd->is_command_class_help ())
     {
-      gdb::optional<scoped_restore_tmpl<bool>> restore_suppress;
+      std::optional<scoped_restore_tmpl<bool>> restore_suppress;
 
       if (cmd->suppress_notification != NULL)
        restore_suppress.emplace (cmd->suppress_notification, true);
index 8fe9325c2da3b25a4b3c01bc6023df9fd589b0f8..14d9c29b464f2c3a9f9b4c253792e3820e0c30de 100644 (file)
@@ -233,7 +233,7 @@ struct cmd_list_element
   void (*destroyer) (struct cmd_list_element *self, void *context) = nullptr;
 
   /* Setting affected by "set" and "show".  Not used if type is not_set_cmd.  */
-  gdb::optional<setting> var;
+  std::optional<setting> var;
 
   /* Pointer to NULL terminated list of enumerated values (like
      argv).  */
index 9b303b1304ef8341a8a2d32f307fae674910f07a..d2d489b72198783fc86d36f651a218d22edcb930 100644 (file)
@@ -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)
     {
index 7b015b89f47cd3e87698355d96dbc4cc353932f7..4c62227f31c3edd789468d136611e8638b23835c 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef CLI_OPTION_H
 #define CLI_OPTION_H 1
 
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/array-view.h"
 #include "completer.h"
 #include <string>
index 467bb283cdc0013bdaa1e6b91b64681309dfcfb0..1ab953b996b9e1339a2dea7b1d28716a047f215c 100644 (file)
@@ -126,7 +126,7 @@ struct literal_def
   LONGEST use;
 
   /* An optional number accepted that stands for the literal.  */
-  gdb::optional<LONGEST> val;
+  std::optional<LONGEST> val;
 };
 
 /* Return true if a setting of type VAR_TYPE is backed with type T.
index a93c9404660038af71d3a582ad6dbb098db42227..be1bcca47b449acaeb18f482327633a7a55cddfb 100644 (file)
@@ -40,7 +40,7 @@
 #include "osabi.h"
 #include "gdbsupport/gdb_wait.h"
 #include "valprint.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/gdb_unlinker.h"
 #include "gdbsupport/pathstuff.h"
 #include "gdbsupport/scoped_ignore_signal.h"
@@ -768,7 +768,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
 
   compile_file_names fnames = get_new_file_names ();
 
-  gdb::optional<gdb::unlinker> source_remover;
+  std::optional<gdb::unlinker> source_remover;
 
   {
     gdb_file_up src = gdb_fopen_cloexec (fnames.source_file (), "w");
index 0de476b022bbc493dad1d97b1f041f3221c134d0..f5624956e76f5e7c7641d832f7b579c2ba11a171 100644 (file)
@@ -1968,7 +1968,7 @@ darwin_nat_target::create_inferior (const char *exec_file,
                                    const std::string &allargs,
                                    char **env, int from_tty)
 {
-  gdb::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
+  std::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
   darwin_nat_target *the_target = this;
 
   if (startup_with_shell && may_have_sip ())
index 902af405cc692c15531bf9ddeeab1c9a1c6d686d..1ebd98ca705e96a64995fab3c66c25ab9b71f8f9 100644 (file)
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include "gdbsupport/scoped_fd.h"
 #include "debuginfod-support.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "cli/cli-cmds.h"
 #include "cli/cli-style.h"
 #include "cli-out.h"
@@ -320,7 +320,7 @@ debuginfod_source_query (const unsigned char *build_id,
 
   char *dname = nullptr;
   scoped_fd fd;
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
 
   {
     user_data data ("source file", srcpath);
@@ -366,7 +366,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
 
   char *dname = nullptr;
   scoped_fd fd;
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
 
   {
     user_data data ("separate debug info for", filename);
@@ -409,7 +409,7 @@ debuginfod_exec_query (const unsigned char *build_id,
 
   char *dname = nullptr;
   scoped_fd fd;
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
 
   {
     user_data data ("executable for", filename);
@@ -458,7 +458,7 @@ debuginfod_section_query (const unsigned char *build_id,
   char *dname = nullptr;
   std::string desc = std::string ("section ") + section_name + " for";
   scoped_fd fd;
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
 
   {
     user_data data (desc.c_str (), filename);
index 2e866f6865e12dd04eba9479a8b88bd1ad757115..82b7e990ff9d5f863d87b47434a20a21351d76c0 100644 (file)
@@ -29,7 +29,7 @@
 #include "source.h"
 #include "gdbsupport/gdb-safe-ctype.h"
 #include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "valprint.h"
 #include "cli/cli-style.h"
 #include "objfiles.h"
@@ -653,8 +653,8 @@ do_mixed_source_and_assembly_deprecated
 
   ui_out_emit_list asm_insns_list (uiout, "asm_insns");
 
-  gdb::optional<ui_out_emit_tuple> outer_tuple_emitter;
-  gdb::optional<ui_out_emit_list> inner_list_emitter;
+  std::optional<ui_out_emit_tuple> outer_tuple_emitter;
+  std::optional<ui_out_emit_list> inner_list_emitter;
 
   for (i = 0; i < newlines; i++)
     {
@@ -810,8 +810,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
 
   ui_out_emit_list asm_insns_emitter (uiout, "asm_insns");
 
-  gdb::optional<ui_out_emit_tuple> tuple_emitter;
-  gdb::optional<ui_out_emit_list> list_emitter;
+  std::optional<ui_out_emit_tuple> tuple_emitter;
+  std::optional<ui_out_emit_list> list_emitter;
 
   last_symtab = NULL;
   last_line = 0;
@@ -1093,7 +1093,7 @@ gdb_print_insn_1 (struct gdbarch *gdbarch, CORE_ADDR vma,
                  struct disassemble_info *info)
 {
   /* Call into the extension languages to do the disassembly.  */
-  gdb::optional<int> length = ext_lang_print_insn (gdbarch, vma, info);
+  std::optional<int> length = ext_lang_print_insn (gdbarch, vma, info);
   if (length.has_value ())
     return *length;
 
@@ -1125,7 +1125,7 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
      this output.  */
   if (length > 0 && use_ext_lang_for_styling ())
     {
-      gdb::optional<std::string> ext_contents;
+      std::optional<std::string> ext_contents;
       ext_contents = ext_lang_colorize_disasm (m_buffer.string (), arch ());
       if (ext_contents.has_value ())
        m_buffer = std::move (*ext_contents);
index dbc63e52ed25d94f01648aa14ec2f63ac88a16d9..5596bd62a108cda881da1833f2be8f1bae83004b 100644 (file)
@@ -275,7 +275,7 @@ private:
      negative value (which indicates an error), then, if this variable has
      a value, we report a memory error to the user, otherwise, we report a
      non-memory error.  */
-  gdb::optional<CORE_ADDR> m_err_memaddr;
+  std::optional<CORE_ADDR> m_err_memaddr;
 
   /* The stream to which disassembler output will be written.  */
   ui_file *m_dest;
index 4cfdaa1e3551c034e04283935531565c92e46b2a..fdb579a368a35d61e975e9d8f05e923d0f111ebc 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "dwarf2.h"
 #include "dwarf2/types.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 /* Blocks are a bunch of untyped bytes.  */
 struct dwarf_block
index ef8db480e3f3bc2510a927c778e34ca9ce3e94bc..a8879de73e50facec7a3df0f62c9c0ddfd393b68 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "buildsym.h"
 #include "dwarf2/comp-unit-head.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "language.h"
 
 /* Type used for delaying computation of method physnames.
@@ -101,7 +101,7 @@ struct dwarf2_cu
   struct comp_unit_head header;
 
   /* Base address of this compilation unit.  */
-  gdb::optional<unrelocated_addr> base_address;
+  std::optional<unrelocated_addr> base_address;
 
   /* The language we are debugging.  */
   const struct language_defn *language_defn = nullptr;
@@ -189,7 +189,7 @@ public:
 
   /* The DW_AT_addr_base (DW_AT_GNU_addr_base) attribute if present.
      Note this value comes from the Fission stub CU/TU's DIE.  */
-  gdb::optional<ULONGEST> addr_base;
+  std::optional<ULONGEST> addr_base;
 
   /* The DW_AT_GNU_ranges_base attribute, if present.
 
@@ -242,7 +242,7 @@ public:
      files, the value is implicitly zero.  For DWARF 5 version DWO files, the
      value is often implicit and is the size of the header of
      .debug_str_offsets section (8 or 4, depending on the address size).  */
-  gdb::optional<ULONGEST> str_offsets_base;
+  std::optional<ULONGEST> str_offsets_base;
 
   /* Mark used when releasing cached dies.  */
   bool m_mark : 1;
index cdee46996d6a34221b4923df4b9181dd6ece69f1..c7040776b077d27275a2beade7cd558494a217ca 100644 (file)
@@ -59,7 +59,7 @@ struct die_info
   /* Return the address base of the compile unit, which, if exists, is
      stored either at the attribute DW_AT_GNU_addr_base, or
      DW_AT_addr_base.  */
-  gdb::optional<ULONGEST> addr_base ()
+  std::optional<ULONGEST> addr_base ()
   {
     for (unsigned i = 0; i < num_attrs; ++i)
       if (attrs[i].name == DW_AT_addr_base
@@ -73,7 +73,7 @@ struct die_info
          complaint (_("address base attribute (offset %s) as wrong form"),
                     sect_offset_str (sect_off));
        }
-    return gdb::optional<ULONGEST> ();
+    return std::optional<ULONGEST> ();
   }
 
   /* Return the base address of the compile unit into the .debug_ranges section,
index cfa45435fbd04b6bf0e67fcc988de759c9647a62..023fc86fc899dcd0cefda83fab1df7effb11a274 100644 (file)
@@ -52,7 +52,7 @@ private:
   std::string build_id_str;
 
   /* Captured value of dwz build id.  */
-  gdb::optional<std::string> dwz_build_id_str;
+  std::optional<std::string> dwz_build_id_str;
 };
 
 /* Class to manage the access to the DWARF index cache.  */
index c9d6e633bf37ae2217ab31ae2b9ff26247aab9bc..d1b10a28823a04a7fb0b7343e6b284d6a65ada70 100644 (file)
@@ -1474,7 +1474,7 @@ struct index_wip_file
      FILENAME_TEMP is unlinked, because on MS-Windows one cannot
      delete a file that is still open.  So, we wrap the unlinker in an
      optional and emplace it once we know the file name.  */
-  gdb::optional<gdb::unlinker> unlink_file;
+  std::optional<gdb::unlinker> unlink_file;
 
   gdb_file_up out_file;
 };
@@ -1497,7 +1497,7 @@ write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir,
                              ? INDEX5_SUFFIX : INDEX4_SUFFIX);
 
   index_wip_file objfile_index_wip (dir, basename, index_suffix);
-  gdb::optional<index_wip_file> dwz_index_wip;
+  std::optional<index_wip_file> dwz_index_wip;
 
   if (dwz_basename != NULL)
       dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
index d072a91bac93eee90c3a1a7ad1f7bb0b7decc00a..ddaf7e4a52723295f2376af5c9f4ced6a79604e2 100644 (file)
@@ -160,8 +160,8 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
          ULONGEST form  = read_unsigned_leb128 (abfd, format, &bytes_read);
          format += bytes_read;
 
-         gdb::optional<const char *> string;
-         gdb::optional<unsigned int> uint;
+         std::optional<const char *> string;
+         std::optional<unsigned int> uint;
 
          switch (form)
            {
index 78cce2d69eb60f88ad844fca85663e744c7507ef..2e88e6702169581636dae4717fc0f5ef4e906ebd 100644 (file)
@@ -444,7 +444,7 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
                          unsigned int offset_size,
                          struct dwarf2_section_info *str_section,
                          struct dwarf2_section_info *str_offsets_section,
-                         gdb::optional<ULONGEST> str_offsets_base,
+                         std::optional<ULONGEST> str_offsets_base,
                          htab_t include_hash, struct dwarf2_cu *cu)
 {
   struct objfile *objfile = per_objfile->objfile;
@@ -805,7 +805,7 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
                     const struct line_header *lh, unsigned int offset_size,
                     unsigned int offset, struct dwarf2_section_info *str_section,
                     struct dwarf2_section_info *str_offsets_section,
-                    gdb::optional<ULONGEST> str_offsets_base,
+                    std::optional<ULONGEST> str_offsets_base,
                     int section_is_gnu, struct dwarf2_cu *cu)
 {
   bfd *abfd;
index d92994fef16111b2c046b63d3a3279cbbadff06e..7daf147033a406245748eed6e649bc3212c59f6e 100644 (file)
@@ -30,7 +30,7 @@ extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
                                 unsigned int offset,
                                 dwarf2_section_info *str_section,
                                 dwarf2_section_info *str_offsets_section,
-                                gdb::optional<ULONGEST> str_offsets_base,
+                                std::optional<ULONGEST> str_offsets_base,
                                 int section_is_gnu, struct dwarf2_cu *cu);
 
 #endif /* GDB_DWARF2_MACRO_H */
index 064a9f17b0e2d9df6a7b4c0cb50cd92f2922c37f..7788626b67a90f43d3d8fa647b7a3d532416c344 100644 (file)
@@ -181,7 +181,7 @@ struct dw2_symtab_iterator
   dwarf2_per_objfile *per_objfile;
   /* If set, only look for symbols that match that block.  Valid values are
      GLOBAL_BLOCK and STATIC_BLOCK.  */
-  gdb::optional<block_enum> block_index;
+  std::optional<block_enum> block_index;
   /* The kind of symbol we're looking for.  */
   domain_enum domain;
   /* The list of CUs from the index entry of the symbol,
@@ -203,7 +203,7 @@ struct dw2_symtab_iterator
 static void
 dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
                      dwarf2_per_objfile *per_objfile,
-                     gdb::optional<block_enum> block_index,
+                     std::optional<block_enum> block_index,
                      domain_enum domain, offset_type namei,
                      mapped_gdb_index &index)
 {
index 2a7fd8f5de5e78d40e7b94cbdc5428fd16071c73..6d86d28d8c038a0bf5dac4ee50e5f52b0b54d7d4 100644 (file)
@@ -78,7 +78,7 @@
 #include "build-id.h"
 #include "namespace.h"
 #include "gdbsupport/function-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/hash_enum.h"
 #include "filename-seen-cache.h"
@@ -3916,7 +3916,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
 /* Return the signature of the compile unit, if found. In DWARF 4 and before,
    the signature is in the DW_AT_GNU_dwo_id attribute. In DWARF 5 and later, the
    signature is part of the header.  */
-static gdb::optional<ULONGEST>
+static std::optional<ULONGEST>
 lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
 {
   if (cu->header.version >= 5)
@@ -3924,7 +3924,7 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
   struct attribute *attr;
   attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
   if (attr == nullptr || !attr->form_is_unsigned ())
-    return gdb::optional<ULONGEST> ();
+    return std::optional<ULONGEST> ();
   return attr->as_unsigned ();
 }
 
@@ -3957,7 +3957,7 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
     dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir);
   else
     {
-      gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
+      std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
 
       if (!signature.has_value ())
        error (_("Dwarf Error: missing dwo_id for dwo_name %s"
@@ -7829,7 +7829,7 @@ create_dwo_cu_reader (const struct die_reader_specs *reader,
   sect_offset sect_off = cu->per_cu->sect_off;
   struct dwarf2_section_info *section = cu->per_cu->section;
 
-  gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
+  std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
   if (!signature.has_value ())
     {
       complaint (_("Dwarf Error: debug entry at offset %s is missing"
@@ -10633,7 +10633,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
   struct objfile *objfile = per_objfile->objfile;
   bfd *obfd = objfile->obfd.get ();
   /* Base address selection entry.  */
-  gdb::optional<unrelocated_addr> base;
+  std::optional<unrelocated_addr> base;
   const gdb_byte *buffer;
   bool overflow = false;
   ULONGEST addr_index;
@@ -10839,7 +10839,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
   unsigned int addr_size = cu_header->addr_size;
   CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
   /* Base address selection entry.  */
-  gdb::optional<unrelocated_addr> base;
+  std::optional<unrelocated_addr> base;
   unsigned int dummy;
   const gdb_byte *buffer;
 
@@ -16070,8 +16070,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
   bool is_declaration = false;
   sect_offset origin_offset {};
 
-  gdb::optional<unrelocated_addr> low_pc;
-  gdb::optional<unrelocated_addr> high_pc;
+  std::optional<unrelocated_addr> low_pc;
+  std::optional<unrelocated_addr> high_pc;
   bool high_pc_relative = false;
 
   for (int i = 0; i < abbrev->num_attrs; ++i)
@@ -17448,7 +17448,7 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
 
 static unrelocated_addr
 read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index,
-                  gdb::optional<ULONGEST> addr_base, int addr_size)
+                  std::optional<ULONGEST> addr_base, int addr_size)
 {
   struct objfile *objfile = per_objfile->objfile;
   bfd *abfd = objfile->obfd.get ();
@@ -17501,7 +17501,7 @@ dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
                        unsigned int addr_index)
 {
   struct dwarf2_cu *cu = per_objfile->get_cu (per_cu);
-  gdb::optional<ULONGEST> addr_base;
+  std::optional<ULONGEST> addr_base;
   int addr_size;
 
   /* We need addr_base and addr_size.
@@ -21270,7 +21270,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
 
   struct dwarf2_section_info *str_offsets_section;
   struct dwarf2_section_info *str_section;
-  gdb::optional<ULONGEST> str_offsets_base;
+  std::optional<ULONGEST> str_offsets_base;
 
   if (cu->dwo_unit != nullptr)
     {
index da907729320381d5f905f91e048fe21b3615beb6..7bb6d4c4d4b8f90676139072e2bfe7685a5c686c 100644 (file)
@@ -524,7 +524,7 @@ public:
 
   /* The shared '.dwz' file, if one exists.  This is used when the
      original data was compressed using 'dwz -m'.  */
-  gdb::optional<std::unique_ptr<struct dwz_file>> dwz_file;
+  std::optional<std::unique_ptr<struct dwz_file>> dwz_file;
 
   /* Whether copy relocations are supported by this object format.  */
   bool can_copy;
@@ -743,7 +743,7 @@ struct dwarf2_per_objfile
   dwarf2_cu *sym_cu = nullptr;
 
   /* CUs that are queued to be read.  */
-  gdb::optional<std::queue<dwarf2_queue_item>> queue;
+  std::optional<std::queue<dwarf2_queue_item>> queue;
 
 private:
   /* Hold the corresponding compunit_symtab for each CU or TU.  This
index b859e825925b435e3ef79032055c7b0c7752ad2d..3358b0d8d32a29e1f89e9daa2138c6d4494f78ef 100644 (file)
@@ -102,7 +102,7 @@ expression::uses_objfile (struct objfile *objfile) const
 struct value *
 expression::evaluate (struct type *expect_type, enum noside noside)
 {
-  gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
+  std::optional<enable_thread_stack_temporaries> stack_temporaries;
   if (target_has_execution () && inferior_ptid != null_ptid
       && language_defn->la_language == language_cplus
       && !thread_stack_temporaries_enabled_p (inferior_thread ()))
index 6ce5370453931bfa16cfbe2334b07faa6f284d81..d47e703d961239df9f6af7c984af5278f69d6f9d 100644 (file)
@@ -706,7 +706,7 @@ void
 gdb_rl_deprep_term_function (void)
 {
 #ifdef RL_STATE_EOF
-  gdb::optional<scoped_restore_tmpl<int>> restore_eof_found;
+  std::optional<scoped_restore_tmpl<int>> restore_eof_found;
 
   if (RL_ISSTATE (RL_STATE_EOF))
     {
index 2ba5a9c9fad1574334e558c18483c9876db09ec8..61fe74f648cf9e23127396be52ddaf6437726748 100644 (file)
@@ -27,7 +27,7 @@
 #include "serial.h"
 #include "gdbthread.h"
 #include "ui.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 static void
 print_flush (void)
@@ -38,7 +38,7 @@ print_flush (void)
   if (deprecated_error_begin_hook)
     deprecated_error_begin_hook ();
 
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
   if (target_supports_terminal_ours ())
     {
       term_state.emplace ();
index e71eac20d4e9cd2eb41764cbf787e7eb0bbcf90b..ccb63e694a5e28e6b18a9592372bf8aa92557de4 100644 (file)
@@ -256,13 +256,13 @@ struct extension_language_ops
      CONTENTS is the contents of the file.  This should either return
      colorized (using ANSI terminal escapes) version of the contents,
      or an empty option.  */
-  gdb::optional<std::string> (*colorize) (const std::string &name,
+  std::optional<std::string> (*colorize) (const std::string &name,
                                          const std::string &contents);
 
   /* Colorize a single line of disassembler output, CONTENT.  This should
      either return colorized (using ANSI terminal escapes) version of the
      contents, or an empty optional.  */
-  gdb::optional<std::string> (*colorize_disasm) (const std::string &content,
+  std::optional<std::string> (*colorize_disasm) (const std::string &content,
                                                 gdbarch *gdbarch);
 
   /* Print a single instruction from ADDRESS in architecture GDBARCH.  INFO
@@ -276,7 +276,7 @@ struct extension_language_ops
      If no instruction can be disassembled then return an empty value and
      other extension languages will get a chance to perform the
      disassembly.  */
-  gdb::optional<int> (*print_insn) (struct gdbarch *gdbarch,
+  std::optional<int> (*print_insn) (struct gdbarch *gdbarch,
                                    CORE_ADDR address,
                                    struct disassemble_info *info);
 
index 9cb393e1d50e3f0bc690cf9f484a5f18f0145b23..2d7a381e426619aa87cbd37fbcb7416b9d415576 100644 (file)
@@ -939,10 +939,10 @@ xmethod_worker::get_result_type (value *object, gdb::array_view<value *> args)
 
 /* See extension.h.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 ext_lang_colorize (const std::string &filename, const std::string &contents)
 {
-  gdb::optional<std::string> result;
+  std::optional<std::string> result;
 
   for (const struct extension_language_defn *extlang : extension_languages)
     {
@@ -959,10 +959,10 @@ ext_lang_colorize (const std::string &filename, const std::string &contents)
 
 /* See extension.h.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
 {
-  gdb::optional<std::string> result;
+  std::optional<std::string> result;
 
   for (const struct extension_language_defn *extlang : extension_languages)
     {
@@ -979,7 +979,7 @@ ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
 
 /* See extension.h.  */
 
-gdb::optional<int>
+std::optional<int>
 ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
                     struct disassemble_info *info)
 {
@@ -988,7 +988,7 @@ ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
       if (extlang->ops == nullptr
          || extlang->ops->print_insn == nullptr)
        continue;
-      gdb::optional<int> length
+      std::optional<int> length
        = extlang->ops->print_insn (gdbarch, address, info);
       if (length.has_value ())
        return length;
index 282d591be437bfe76d687dd1c19ef54cda2a3df5..530f6ce72ac3c57ab8d40ef2a1c19d132ee31e10 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "mi/mi-cmds.h"
 #include "gdbsupport/array-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 struct breakpoint;
 struct command_line;
@@ -316,7 +316,7 @@ extern void get_matching_xmethod_workers
    either a colorized (using ANSI terminal escapes) version of the
    source code, or an empty value if colorizing could not be done.  */
 
-extern gdb::optional<std::string> ext_lang_colorize
+extern std::optional<std::string> ext_lang_colorize
   (const std::string &filename, const std::string &contents);
 
 /* Try to colorize a single line of disassembler output, CONTENT for
@@ -324,7 +324,7 @@ extern gdb::optional<std::string> ext_lang_colorize
    escapes) version of CONTENT, or an empty value if colorizing could not
    be done.  */
 
-extern gdb::optional<std::string> ext_lang_colorize_disasm
+extern std::optional<std::string> ext_lang_colorize_disasm
   (const std::string &content, gdbarch *gdbarch);
 
 /* Calls extension_language_ops::print_insn for each extension language,
@@ -334,7 +334,7 @@ extern gdb::optional<std::string> ext_lang_colorize_disasm
    All arguments are forwarded to extension_language_ops::print_insn, see
    that function for a full description.  */
 
-extern gdb::optional<int> ext_lang_print_insn
+extern std::optional<int> ext_lang_print_insn
   (struct gdbarch *gdbarch, CORE_ADDR address, struct disassemble_info *info);
 
 /* When GDB calls into an extension language because an objfile was
index fc0614e576170967f1396455ec4d6d3750a04aa4..ebcca7adea3eca07ea7fad8ab5c23551c288135b 100644 (file)
@@ -306,7 +306,7 @@ protected:
 
   /* Set and reset to handle removing intermediate values from the
      value chain.  */
-  gdb::optional<scoped_value_mark> m_mark;
+  std::optional<scoped_value_mark> m_mark;
 };
 
 /* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
index 0e0d0cdf621d17219595e40592a2a75d0f0dcfc8..211b83f555af23db108cbc30035bf5bc4cc68a3f 100644 (file)
@@ -99,7 +99,7 @@ fbsd_nat_target::have_pending_event (ptid_t filter)
 
 /* See fbsd-nat.h.  */
 
-gdb::optional<fbsd_nat_target::pending_event>
+std::optional<fbsd_nat_target::pending_event>
 fbsd_nat_target::take_pending_event (ptid_t filter)
 {
   for (auto it = m_pending_events.begin (); it != m_pending_events.end (); it++)
@@ -1663,7 +1663,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
                         target_options_to_string (target_options).c_str ());
 
   /* If there is a valid pending event, return it.  */
-  gdb::optional<pending_event> event = take_pending_event (ptid);
+  std::optional<pending_event> event = take_pending_event (ptid);
   if (event.has_value ())
     {
       /* Stop any other inferiors currently running.  */
@@ -1899,7 +1899,7 @@ fbsd_nat_target::detach_fork_children (inferior *inf)
 
   while (1)
     {
-      gdb::optional<pending_event> event = take_pending_event (ptid);
+      std::optional<pending_event> event = take_pending_event (ptid);
       if (!event.has_value ())
        break;
 
index 7016cc0242aecee255e07c2154a7e17b3243db0f..8118408bf4767803708257f3d3232f72ab486deb 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef FBSD_NAT_H
 #define FBSD_NAT_H
 
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "inf-ptrace.h"
 #include "regcache.h"
 #include "regset.h"
@@ -262,7 +262,7 @@ private:
      FILTER.  If there is a matching event, the event is removed from
      the pending list and returned.  */
 
-  gdb::optional<pending_event> take_pending_event (ptid_t filter);
+  std::optional<pending_event> take_pending_event (ptid_t filter);
 
   /* List of pending events.  */
 
index d166d7857365673da4737ab9906eb61c5804a94a..4ac33697082f5c3388909870529ab330a504f9e5 100644 (file)
@@ -650,10 +650,10 @@ find_signalled_thread (struct thread_info *info, void *data)
    the data is prefixed with a 32-bit integer size to match the format
    used in FreeBSD NT_PROCSTAT_* notes.  */
 
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
 fbsd_make_note_desc (enum target_object object, uint32_t structsize)
 {
-  gdb::optional<gdb::byte_vector> buf =
+  std::optional<gdb::byte_vector> buf =
     target_read_alloc (current_inferior ()->top_target (), object, NULL);
   if (!buf || buf->empty ())
     return {};
@@ -735,7 +735,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
 
   /* Auxiliary vector.  */
   uint32_t structsize = gdbarch_ptr_bit (gdbarch) / 4; /* Elf_Auxinfo  */
-  gdb::optional<gdb::byte_vector> note_desc =
+  std::optional<gdb::byte_vector> note_desc =
     fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
   if (note_desc && !note_desc->empty ())
     {
@@ -2340,7 +2340,7 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
   else
     {
       /* Fetch the list of address space entries from the running target. */
-      gdb::optional<gdb::byte_vector> buf =
+      std::optional<gdb::byte_vector> buf =
        target_read_alloc (current_inferior ()->top_target (),
                           TARGET_OBJECT_FREEBSD_VMMAP, nullptr);
       if (!buf || buf->empty ())
index 938a47ff012d586b40cfbc383d13bab980f6ed71..b2c6baf443226ba5b4555cad1a8bef1599c09286 100644 (file)
@@ -211,10 +211,10 @@ struct thread_suspend_state
 
      - If the thread is running, then this field has its value removed by
        calling stop_pc.reset() (see thread_info::set_executing()).
-       Attempting to read a gdb::optional with no value is undefined
+       Attempting to read a std::optional with no value is undefined
        behaviour and will trigger an assertion error when _GLIBCXX_DEBUG is
        defined, which should make error easier to track down.  */
-  gdb::optional<CORE_ADDR> stop_pc;
+  std::optional<CORE_ADDR> stop_pc;
 };
 
 /* Base class for target-specific thread data.  */
@@ -661,7 +661,7 @@ extern void delete_thread_silent (struct thread_info *thread);
    available.  If SILENT, then don't inform the CLI about the
    exit.  */
 extern void set_thread_exited (thread_info *tp,
-                              gdb::optional<ULONGEST> exit_code = {},
+                              std::optional<ULONGEST> exit_code = {},
                               bool silent = false);
 
 /* Delete a step_resume_breakpoint from the thread database.  */
@@ -1058,7 +1058,7 @@ extern bool switch_to_thread_if_alive (thread_info *thr);
    exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails.  */
 
 extern void thread_try_catch_cmd (thread_info *thr,
-                                 gdb::optional<int> ada_task,
+                                 std::optional<int> ada_task,
                                  const char *cmd, int from_tty,
                                  const qcs_flags &flags);
 
index e424077c1c0f095c8a0890731343a7c297c5be87..04598c6f4bed33a6ae3bae3e6567b0b1a475e4ae 100644 (file)
@@ -1045,7 +1045,7 @@ has_static_range (const struct range_bounds *bounds)
 
 /* See gdbtypes.h.  */
 
-gdb::optional<LONGEST>
+std::optional<LONGEST>
 get_discrete_low_bound (struct type *type)
 {
   type = check_typedef (type);
@@ -1061,7 +1061,7 @@ get_discrete_low_bound (struct type *type)
 
        if (type->target_type ()->code () == TYPE_CODE_ENUM)
          {
-           gdb::optional<LONGEST> low_pos
+           std::optional<LONGEST> low_pos
              = discrete_position (type->target_type (), low);
 
            if (low_pos.has_value ())
@@ -1112,7 +1112,7 @@ get_discrete_low_bound (struct type *type)
 
 /* See gdbtypes.h.  */
 
-gdb::optional<LONGEST>
+std::optional<LONGEST>
 get_discrete_high_bound (struct type *type)
 {
   type = check_typedef (type);
@@ -1128,7 +1128,7 @@ get_discrete_high_bound (struct type *type)
 
        if (type->target_type ()->code () == TYPE_CODE_ENUM)
          {
-           gdb::optional<LONGEST> high_pos
+           std::optional<LONGEST> high_pos
              = discrete_position (type->target_type (), high);
 
            if (high_pos.has_value ())
@@ -1191,11 +1191,11 @@ get_discrete_high_bound (struct type *type)
 bool
 get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
 {
-  gdb::optional<LONGEST> low = get_discrete_low_bound (type);
+  std::optional<LONGEST> low = get_discrete_low_bound (type);
   if (!low.has_value ())
     return false;
 
-  gdb::optional<LONGEST> high = get_discrete_high_bound (type);
+  std::optional<LONGEST> high = get_discrete_high_bound (type);
   if (!high.has_value ())
     return false;
 
@@ -1243,7 +1243,7 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
    in which case the value of POS is unmodified.
 */
 
-gdb::optional<LONGEST>
+std::optional<LONGEST>
 discrete_position (struct type *type, LONGEST val)
 {
   if (type->code () == TYPE_CODE_RANGE)
@@ -2534,7 +2534,7 @@ compute_variant_fields_inner (struct type *type,
                              std::vector<bool> &flags)
 {
   /* Evaluate the discriminant.  */
-  gdb::optional<ULONGEST> discr_value;
+  std::optional<ULONGEST> discr_value;
   if (part.discriminant_index != -1)
     {
       int idx = part.discriminant_index;
@@ -2757,7 +2757,7 @@ resolve_dynamic_type_internal (struct type *type,
   if (!is_dynamic_type_internal (real_type, top_level))
     return type;
 
-  gdb::optional<CORE_ADDR> type_length;
+  std::optional<CORE_ADDR> type_length;
   prop = TYPE_DYNAMIC_LENGTH (type);
   if (prop != NULL
       && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
index 505c8ba12b59d70f138bee3679f2791824239701..d5bd6d2d2d7810b947cb7e5aeb51727fff35ee33 100644 (file)
@@ -47,7 +47,7 @@
 #include "hashtab.h"
 #include "gdbsupport/array-view.h"
 #include "gdbsupport/gdb-hashtab.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/offset-type.h"
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/underlying.h"
@@ -2663,11 +2663,11 @@ extern bool get_discrete_bounds (struct type *type, LONGEST *lowp,
 
 /* If TYPE's low bound is a known constant, return it, else return nullopt.  */
 
-extern gdb::optional<LONGEST> get_discrete_low_bound (struct type *type);
+extern std::optional<LONGEST> get_discrete_low_bound (struct type *type);
 
 /* If TYPE's high bound is a known constant, return it, else return nullopt.  */
 
-extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
+extern std::optional<LONGEST> get_discrete_high_bound (struct type *type);
 
 /* Assuming TYPE is a simple, non-empty array type, compute its upper
    and lower bound.  Save the low bound into LOW_BOUND if not NULL.
@@ -2679,7 +2679,7 @@ extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
 extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
                              LONGEST *high_bound);
 
-extern gdb::optional<LONGEST> discrete_position (struct type *type,
+extern std::optional<LONGEST> discrete_position (struct type *type,
                                                 LONGEST val);
 
 extern int class_types_same_p (const struct type *, const struct type *);
index a27ea8b3c80b6219298ff0cbfcdb7c95d135f2c2..ceca60b37e52224546b2f4a630f2e56e31905a6c 100644 (file)
@@ -26,7 +26,7 @@
 #include "ui.h"
 #include "target.h"
 #include "guile-internal.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 #ifdef HAVE_POLL
 #if defined (HAVE_POLL_H)
@@ -602,7 +602,7 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport,
                                                  ? &gdb_stderr : &gdb_stdout);
 
   {
-    gdb::optional<ui_out_redirect_pop> redirect_popper;
+    std::optional<ui_out_redirect_pop> redirect_popper;
     if (oport == GDB_STDERR)
       gdb_stderr = port_file.get ();
     else
index cdd5553cf5d3ef6c741aa2a51edaf77fd478e175..6d537c4c8d366a84f6bd515d6fec5d46bfafc747 100644 (file)
@@ -69,7 +69,7 @@ struct ia64_table_entry
   };
 
 static struct ia64_table_entry *ktab = NULL;
-static gdb::optional<gdb::byte_vector> ktab_buf;
+static std::optional<gdb::byte_vector> ktab_buf;
 
 #endif
 
@@ -2648,7 +2648,7 @@ ia64_access_mem (unw_addr_space_t as,
 }
 
 /* Call low-level function to access the kernel unwind table.  */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
 getunwind_table ()
 {
   /* FIXME drow/2005-09-10: This code used to call
index 25afdb2202e53ea5b40ac9c0c8d3243cd4819f36..4eeb68be8f0014390905d5e0d28b30f0411ca3fe 100644 (file)
@@ -352,7 +352,7 @@ inf_child_target::fileio_unlink (struct inferior *inf, const char *filename,
 
 /* Implementation of to_fileio_readlink.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
                                   fileio_error *target_errno)
 {
index 017e8e3568066547cf6ec1221cb0f04fd3a4ee4d..4aeb38980285bbe08b5af44d0a565b2995c78c12 100644 (file)
@@ -85,7 +85,7 @@ public:
   int fileio_unlink (struct inferior *inf,
                     const char *filename,
                     fileio_error *target_errno) override;
-  gdb::optional<std::string> fileio_readlink (struct inferior *inf,
+  std::optional<std::string> fileio_readlink (struct inferior *inf,
                                              const char *filename,
                                              fileio_error *target_errno) override;
   bool use_agent (bool use) override;
index 2fc0eb138a67d9e5b2f84074b074d10f0f54b60b..ec818bc6936f1ecb2c4b11d1e0723e1ea3a05ed0 100644 (file)
@@ -52,7 +52,7 @@
 #include "ui.h"
 #include "interps.h"
 #include "skip.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "source.h"
 #include "cli/cli-style.h"
 #include "dwarf2/loc.h"
@@ -2790,7 +2790,7 @@ notice_new_inferior (thread_info *thr, bool leave_running, int from_tty)
   enum attach_post_wait_mode mode
     = leave_running ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_NOTHING;
 
-  gdb::optional<scoped_restore_current_thread> restore_thread;
+  std::optional<scoped_restore_current_thread> restore_thread;
 
   if (inferior_ptid != null_ptid)
     restore_thread.emplace ();
index 927c5f16ae2a8a28067fce697f4c5f608e8b47a0..fbe27c8b8731660cc2751cbc10126e84fdb4e473 100644 (file)
@@ -728,10 +728,10 @@ switch_to_inferior_no_thread (inferior *inf)
 
 /* See regcache.h.  */
 
-gdb::optional<scoped_restore_current_thread>
+std::optional<scoped_restore_current_thread>
 maybe_switch_inferior (inferior *inf)
 {
-  gdb::optional<scoped_restore_current_thread> maybe_restore_thread;
+  std::optional<scoped_restore_current_thread> maybe_restore_thread;
   if (inf != current_inferior ())
     {
       maybe_restore_thread.emplace ();
index 33eff7a91418a8b291e5950c9985c697bb5647da..f8f9395aec4dde77aab829c865321d5de635c19a 100644 (file)
@@ -340,7 +340,7 @@ extern void switch_to_inferior_no_thread (inferior *inf);
 
    If the current inferior was changed, return an RAII object that will
    restore the original current context.  */
-extern gdb::optional<scoped_restore_current_thread> maybe_switch_inferior
+extern std::optional<scoped_restore_current_thread> maybe_switch_inferior
   (inferior *inf);
 
 /* Info about an inferior's target description.  There's one of these
index 095c5f03672242f027245b5098f2b48d7f932dd4..749f620739d7dcedb8f3cc81c36242e4e60e3e59 100644 (file)
@@ -113,9 +113,9 @@ static struct terminal_info *get_inflow_inferior_data (struct inferior *);
    we save our handlers in these two variables and set SIGINT and SIGQUIT
    to SIG_IGN.  */
 
-static gdb::optional<sighandler_t> sigint_ours;
+static std::optional<sighandler_t> sigint_ours;
 #ifdef SIGQUIT
-static gdb::optional<sighandler_t> sigquit_ours;
+static std::optional<sighandler_t> sigquit_ours;
 #endif
 
 /* The name of the tty (from the `tty' command) that we're giving to
index 70c33a9c39258646bc196abc1137b0cf55aaf049..a1543ab2443c938d0c460d1ac30365322d7ff7eb 100644 (file)
@@ -62,7 +62,7 @@
 #include "thread-fsm.h"
 #include "gdbsupport/enum-flags.h"
 #include "progspace-and-thread.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "arch-utils.h"
 #include "gdbsupport/scope-exit.h"
 #include "gdbsupport/forward-scope-exit.h"
@@ -713,7 +713,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
     {
       /* If FOLLOW_CHILD, we leave CHILD_INF as the current inferior
         (do not restore the parent as the current inferior).  */
-      gdb::optional<scoped_restore_current_thread> maybe_restore;
+      std::optional<scoped_restore_current_thread> maybe_restore;
 
       if (!follow_child && !sched_multi)
        maybe_restore.emplace ();
@@ -4587,7 +4587,7 @@ fetch_inferior_event ()
        debugging.  If we're looking at traceframes while the target is
        running, we're going to need to get back to that mode after
        handling the event.  */
-    gdb::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
+    std::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
     if (non_stop)
       {
        maybe_restore_traceframe.emplace ();
@@ -4960,7 +4960,7 @@ adjust_pc_after_break (struct thread_info *thread,
       || (target_is_non_stop_p ()
          && moribund_breakpoint_here_p (aspace, breakpoint_pc)))
     {
-      gdb::optional<scoped_restore_tmpl<int>> restore_operation_disable;
+      std::optional<scoped_restore_tmpl<int>> restore_operation_disable;
 
       if (record_full_is_used ())
        restore_operation_disable.emplace
@@ -7109,7 +7109,7 @@ handle_signal_stop (struct execution_control_state *ecs)
          decr_pc = gdbarch_decr_pc_after_break (gdbarch);
          if (decr_pc != 0)
            {
-             gdb::optional<scoped_restore_tmpl<int>>
+             std::optional<scoped_restore_tmpl<int>>
                restore_operation_disable;
 
              if (record_full_is_used ())
@@ -9343,7 +9343,7 @@ normal_stop ()
           && last.kind () != TARGET_WAITKIND_THREAD_EXITED)
     finish_ptid = inferior_ptid;
 
-  gdb::optional<scoped_finish_thread_state> maybe_finish_thread_state;
+  std::optional<scoped_finish_thread_state> maybe_finish_thread_state;
   if (finish_ptid != null_ptid)
     {
       maybe_finish_thread_state.emplace
index 2fbf92fa0a27f9d2b816d5bb0f623f6906b13513..bec2c85e2fdf48978112495d0b883b33755b8319 100644 (file)
@@ -430,7 +430,7 @@ interps_notify_new_thread (thread_info *t)
 
 void
 interps_notify_thread_exited (thread_info *t,
-                             gdb::optional<ULONGEST> exit_code,
+                             std::optional<ULONGEST> exit_code,
                              int silent)
 {
   interps_notify (&interp::on_thread_exited, t, exit_code, silent);
index 728155ae81b2a1d9e201349e1685b93b3759f92a..f662f54e950edd346fcdc338ad32c09a8d2dac5f 100644 (file)
@@ -123,7 +123,7 @@ public:
 
   /* Notify the interpreter that thread T has exited.  */
   virtual void on_thread_exited (thread_info *,
-                                gdb::optional<ULONGEST> exit_code,
+                                std::optional<ULONGEST> exit_code,
                                 int silent) {}
 
   /* Notify the interpreter that inferior INF was added.  */
@@ -292,7 +292,7 @@ extern void interps_notify_new_thread (thread_info *t);
 
 /* Notify all interpreters that thread T has exited.  */
 extern void interps_notify_thread_exited (thread_info *t,
-                                         gdb::optional<ULONGEST> exit_code,
+                                         std::optional<ULONGEST> exit_code,
                                          int silent);
 
 /* Notify all interpreters that inferior INF was added.  */
index 9e8325ab80347caaa7c065a6ef0949c3a1d0d57d..0e3a4285bdd8efe158ce800edcba8f7bde93bb52 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -76,7 +76,7 @@ maint_info_jit_cmd (const char *args, int from_tty)
   inferior *inf = current_inferior ();
   bool printed_header = false;
 
-  gdb::optional<ui_out_emit_table> table_emitter;
+  std::optional<ui_out_emit_table> table_emitter;
 
   /* Print a line for each JIT-ed objfile.  */
   for (objfile *obj : inf->pspace->objfiles ())
index d3e9560c2fc53de9b7c5687c943c1fc2e9fe8749..7b0562cf89b4d9281379fc865b894001995b6c24 100644 (file)
@@ -1295,7 +1295,7 @@ get_detach_signal (struct lwp_info *lp)
 
 /* If LP has a pending fork/vfork/clone status, return it.  */
 
-static gdb::optional<target_waitstatus>
+static std::optional<target_waitstatus>
 get_pending_child_status (lwp_info *lp)
 {
   LINUX_NAT_SCOPED_DEBUG_ENTER_EXIT;
@@ -1369,7 +1369,7 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
      event, there is a process/thread GDB is attached to that the core
      of GDB doesn't know about.  Detach from it.  */
 
-  gdb::optional<target_waitstatus> ws = get_pending_child_status (lp);
+  std::optional<target_waitstatus> ws = get_pending_child_status (lp);
   if (ws.has_value ())
     detach_one_pid (ws->child_ptid ().lwp (), 0);
 
@@ -3616,7 +3616,7 @@ kill_wait_callback (struct lwp_info *lp)
 static int
 kill_unfollowed_child_callback (lwp_info *lp)
 {
-  gdb::optional<target_waitstatus> ws = get_pending_child_status (lp);
+  std::optional<target_waitstatus> ws = get_pending_child_status (lp);
   if (ws.has_value ())
     {
       ptid_t child_ptid = ws->child_ptid ();
@@ -4074,7 +4074,7 @@ linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
 static bool
 proc_mem_file_is_writable ()
 {
-  static gdb::optional<bool> writable;
+  static std::optional<bool> writable;
 
   if (writable.has_value ())
     return *writable;
@@ -4463,7 +4463,7 @@ linux_nat_target::fileio_open (struct inferior *inf, const char *filename,
 
 /* Implementation of to_fileio_readlink.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
                                   fileio_error *target_errno)
 {
index cce8bb3ddcc568d1169aade4c778e7131dbc8e94..428bb9f1628912a2f9703814d3fe89ab0c064d93 100644 (file)
@@ -103,7 +103,7 @@ public:
                   int flags, int mode, int warn_if_slow,
                   fileio_error *target_errno) override;
 
-  gdb::optional<std::string>
+  std::optional<std::string>
     fileio_readlink (struct inferior *inf,
                     const char *filename,
                     fileio_error *target_errno) override;
index eff7a0ca42e6f541031ad901405c6430423ba222..db29b0320189e3e07a9b2fd6c67b13cd1c20bb32 100644 (file)
@@ -38,7 +38,7 @@
 #include "gdbcmd.h"
 #include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/enum-flags.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gcore.h"
 #include "gcore-elf.h"
 #include "solib-svr4.h"
@@ -229,7 +229,7 @@ struct linux_info
   int vsyscall_range_p = 0;
 
   /* Inferior's displaced step buffers.  */
-  gdb::optional<displaced_step_buffers> disp_step_bufs;
+  std::optional<displaced_step_buffers> disp_step_bufs;
 };
 
 /* Per-inferior data key.  */
@@ -589,7 +589,7 @@ struct mapping_regexes
 static int
 mapping_is_anonymous_p (const char *filename)
 {
-  static gdb::optional<mapping_regexes> regexes;
+  static std::optional<mapping_regexes> regexes;
   static int init_regex_p = 0;
 
   if (!init_regex_p)
@@ -873,7 +873,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
   if (cwd_f)
     {
       xsnprintf (filename, sizeof filename, "/proc/%ld/cwd", pid);
-      gdb::optional<std::string> contents
+      std::optional<std::string> contents
        = target_fileio_readlink (NULL, filename, &target_errno);
       if (contents.has_value ())
        gdb_printf ("cwd = '%s'\n", contents->c_str ());
@@ -883,7 +883,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
   if (exe_f)
     {
       xsnprintf (filename, sizeof filename, "/proc/%ld/exe", pid);
-      gdb::optional<std::string> contents
+      std::optional<std::string> contents
        = target_fileio_readlink (NULL, filename, &target_errno);
       if (contents.has_value ())
        gdb_printf ("exe = '%s'\n", contents->c_str ());
@@ -2108,7 +2108,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     return NULL;
 
   /* Auxillary vector.  */
-  gdb::optional<gdb::byte_vector> auxv =
+  std::optional<gdb::byte_vector> auxv =
     target_read_alloc (current_inferior ()->top_target (),
                       TARGET_OBJECT_AUXV, NULL);
   if (auxv && !auxv->empty ())
@@ -2675,7 +2675,7 @@ linux_displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t ptid)
 /* Helper for linux_get_hwcap and linux_get_hwcap2.  */
 
 static CORE_ADDR
-linux_get_hwcap_helper (const gdb::optional<gdb::byte_vector> &auxv,
+linux_get_hwcap_helper (const std::optional<gdb::byte_vector> &auxv,
                        target_ops *target, gdbarch *gdbarch, CORE_ADDR match)
 {
   CORE_ADDR field;
@@ -2688,7 +2688,7 @@ linux_get_hwcap_helper (const gdb::optional<gdb::byte_vector> &auxv,
 /* See linux-tdep.h.  */
 
 CORE_ADDR
-linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv,
+linux_get_hwcap (const std::optional<gdb::byte_vector> &auxv,
                 target_ops *target, gdbarch *gdbarch)
 {
   return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP);
@@ -2707,7 +2707,7 @@ linux_get_hwcap ()
 /* See linux-tdep.h.  */
 
 CORE_ADDR
-linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv,
+linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
                  target_ops *target, gdbarch *gdbarch)
 {
   return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP2);
index e09a6ef32b1cf71efb8786ede4c6f28ae059ca05..819b221e599d22f2fc7f102351f089705556b547 100644 (file)
@@ -94,7 +94,7 @@ extern int linux_is_uclinux (void);
    parse auxv entries.
 
    On error, 0 is returned.  */
-extern CORE_ADDR linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv,
+extern CORE_ADDR linux_get_hwcap (const std::optional<gdb::byte_vector> &auxv,
                                  struct target_ops *target, gdbarch *gdbarch);
 
 /* Same as the above, but obtain all the inputs from the current inferior.  */
@@ -105,7 +105,7 @@ extern CORE_ADDR linux_get_hwcap ();
    parse auxv entries.
 
    On error, 0 is returned.  */
-extern CORE_ADDR linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv,
+extern CORE_ADDR linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
                                   struct target_ops *target, gdbarch *gdbarch);
 
 /* Same as the above, but obtain all the inputs from the current inferior.  */
index cef78f599be0cd6c5fbd32e0f8df9279e6be967a..c2ec422b7f328d7c31e289a054bf8bfe2f738cb6 100644 (file)
@@ -312,7 +312,7 @@ struct thread_db_thread_info : public private_thread_info
   /* Cached thread state.  */
   td_thrhandle_t th {};
   thread_t tid {};
-  gdb::optional<gdb::byte_vector> thread_handle;
+  std::optional<gdb::byte_vector> thread_handle;
 };
 
 static thread_db_thread_info *
index 2da39f89a90f3025f085d851d0ca80ea3cc7a971..486c1ffe0718991b3a6481a0f9ee8537af412cbf 100644 (file)
@@ -361,7 +361,7 @@ get_init_files (std::vector<std::string> *system_gdbinit,
 {
   /* Cache the file lookup object so we only actually search for the files
      once.  */
-  static gdb::optional<gdb_initfile_finder> init_files;
+  static std::optional<gdb_initfile_finder> init_files;
   if (!init_files.has_value ())
     init_files.emplace (GDBINIT, SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE,
                        SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE,
@@ -381,7 +381,7 @@ get_earlyinit_files (std::string *home_gdbearlyinit)
 {
   /* Cache the file lookup object so we only actually search for the files
      once.  */
-  static gdb::optional<gdb_initfile_finder> init_files;
+  static std::optional<gdb_initfile_finder> init_files;
   if (!init_files.has_value ())
     init_files.emplace (GDBEARLYINIT, nullptr, false, nullptr, false, false);
 
index e473be7d46505c2cd1ad26aae932513ca63b6393..6982338751aa14a64d94bc189f72b9f742bafedb 100644 (file)
@@ -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);
 
index 8b4dd6d0c96af3e85f9b07c9307a4f2f16ea54b0..87c54c8c95d60fed922fdc35b650307176803c57 100644 (file)
@@ -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,
index 5ea31fc98d1a485f4fd66dd8eb96ffb09600655f..dbee2d010ea6c6facb126c9013b3d234b6240604 100644 (file)
@@ -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)
index e67c486a99776c1ca0bd5cdd0111c69104b6c838..f99c24313b970745e4ba53d6bdeb7e3db095c4e4 100644 (file)
@@ -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:
 
index ebd7f150c49e3c5454caeb3373e5d8df010c35ea..afd2737e29ddb1abc1d0ed6716a3303aa8ead71e 100644 (file)
@@ -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;
index 3110c0a6a48a33ac86ff9dad4ab7b7b9a622fab0..25c25512fba75b7bf65d9c23330c62b42bf883d1 100644 (file)
@@ -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;
index 14ed2a1fae94b835c47f8f0dcedaf1a5bbb1c40e..487b0a920254189efa0395cf75e05b762fbb77c9 100644 (file)
@@ -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);
index 103b7ab26cd682b30c9a19115ef2ceb56175c345..e85384660d4dc63109611a7dbab2c6f264b18660 100644 (file)
@@ -66,7 +66,7 @@ linux_common_core_of_thread (ptid_t ptid)
   sprintf (filename, "/proc/%lld/task/%lld/stat",
           (PID_T) ptid.pid (), (PID_T) ptid.lwp ());
 
-  gdb::optional<std::string> content = read_text_file_to_string (filename);
+  std::optional<std::string> content = read_text_file_to_string (filename);
   if (!content.has_value ())
     return -1;
 
@@ -257,10 +257,10 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
 
 /* get_core_array_size helper that uses /sys/devices/system/cpu/possible.  */
 
-static gdb::optional<size_t>
+static std::optional<size_t>
 get_core_array_size_using_sys_possible ()
 {
-  gdb::optional<std::string> possible
+  std::optional<std::string> possible
     = read_text_file_to_string ("/sys/devices/system/cpu/possible");
 
   if (!possible.has_value ())
@@ -310,7 +310,7 @@ get_core_array_size ()
      we are in a container that has access to a subset of the host's cores.
      It will return a size that considers all the CPU cores available to the
      host.  If that fails for some reason, fall back to sysconf.  */
-  gdb::optional<size_t> count = get_core_array_size_using_sys_possible ();
+  std::optional<size_t> count = get_core_array_size_using_sys_possible ();
   if (count.has_value ())
     return *count;
 
index 8028494de20b4957c5038deec1cc946eb1e8c634..bf4c43878863277ef02188e71379433b3974480f 100644 (file)
@@ -698,10 +698,10 @@ windows_process_info::matching_pending_stop (bool debug_events)
 
 /* See nat/windows-nat.h.  */
 
-gdb::optional<pending_stop>
+std::optional<pending_stop>
 windows_process_info::fetch_pending_stop (bool debug_events)
 {
-  gdb::optional<pending_stop> result;
+  std::optional<pending_stop> result;
   for (auto iter = pending_stops.begin ();
        iter != pending_stops.end ();
        ++iter)
@@ -818,7 +818,7 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
          InitializeProcThreadAttributeList (info_ex.lpAttributeList,
                                             1, 0, &size);
 
-         gdb::optional<BOOL> return_value;
+         std::optional<BOOL> return_value;
          DWORD attr_flags = relocate_aslr_flags;
          if (!UpdateProcThreadAttribute (info_ex.lpAttributeList, 0,
                                          mitigation_policy,
index e3ea7dbb52578234423ceb0d77d5199b5be238cf..0dc37b2970579bf09ebb13087384bd8331895eef 100644 (file)
@@ -23,7 +23,7 @@
 #include <psapi.h>
 #include <vector>
 
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "target/waitstatus.h"
 
 #define STATUS_WX86_BREAKPOINT 0x4000001F
@@ -246,7 +246,7 @@ struct windows_process_info
      remove it from the list of pending stops, set 'current_event', and
      return it.  Otherwise, return an empty optional.  */
 
-  gdb::optional<pending_stop> fetch_pending_stop (bool debug_events);
+  std::optional<pending_stop> fetch_pending_stop (bool debug_events);
 
   const char *pid_to_exec_file (int);
 
index 5869489bcff4289d2e17750f851a6fff25ca418a..32ef65435ccb315a8fe7c7528207de8729847aa4 100644 (file)
@@ -123,7 +123,7 @@ extern observable<struct thread_info */* t */> new_thread;
    removing the thread from its tables without wanting to notify the
    CLI about it.  */
 extern observable<thread_info */* t */,
-                 gdb::optional<ULONGEST> /* exit_code */,
+                 std::optional<ULONGEST> /* exit_code */,
                  bool /* silent */> thread_exit;
 
 /* An explicit stop request was issued to PTID.  If PTID equals
index 21b8eb01f6b11f152a8a76785c6efbbd66b425a6..cb1e950df5cb7d4c193c554f22b6b37c53752c7a 100644 (file)
@@ -162,7 +162,7 @@ std::unique_ptr<osdata>
 get_osdata (const char *type)
 {
   std::unique_ptr<osdata> osdata;
-  gdb::optional<gdb::char_vector> xml = target_get_osdata (type);
+  std::optional<gdb::char_vector> xml = target_get_osdata (type);
 
   if (xml)
     {
index c69b53addff026139e9a981f71d81bbd1e1affbc..b57d112fafd9515ff9d2ea09af6e0be7ccdd2d74 100644 (file)
@@ -49,7 +49,7 @@
 #include "objfiles.h"
 #include "user-regs.h"
 #include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "c-exp.h"
 
 static unsigned int expressiondebug = 0;
@@ -471,7 +471,7 @@ parse_expression (const char *string, innermost_block_tracker *tracker,
 expression_up
 parse_expression_with_language (const char *string, enum language lang)
 {
-  gdb::optional<scoped_restore_current_language> lang_saver;
+  std::optional<scoped_restore_current_language> lang_saver;
   if (current_language->la_language != lang)
     {
       lang_saver.emplace ();
index a0205119f005534bae14612b111d75be77e0100b..f34de9cb6666ee25caeb49986b4db913ca509acf 100644 (file)
@@ -464,7 +464,7 @@ private:
     };
 
   /* The interface option.  Initialized if has_value () returns true.  */
-  gdb::optional<enum debug_reg_interface> m_interface;
+  std::optional<enum debug_reg_interface> m_interface;
 
   /* The info returned by the kernel with PPC_PTRACE_GETHWDBGINFO.  Only
      valid if we determined that the interface is HWDEBUG.  */
@@ -485,7 +485,7 @@ struct ppc_linux_process_info
   /* The watchpoint value that GDB requested for this process.
 
      Only used when the interface is DEBUGREG.  */
-  gdb::optional<long> requested_wp_val;
+  std::optional<long> requested_wp_val;
 };
 
 struct ppc_linux_nat_target final : public linux_nat_target
index 1cc26ed69a56394372c4238fb26ab61644849689..24e1b455afd7ff1d569715b7c6489f84e92853d1 100644 (file)
@@ -1611,7 +1611,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
   if (vsx)
     features.vsx = true;
 
-  gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
+  std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
   CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
 
   features.isa205 = ppc_linux_has_isa205 (hwcap);
index ddeb810f35b8ce555b4d84705fcdd249218e1e55..b24154998ec71e6923341221d6980fff03c42589 100644 (file)
@@ -447,7 +447,7 @@ struct ppc_inferior_data
   /* This is an optional in case we add more fields to ppc_inferior_data, we
      don't want it instantiated as soon as we get the ppc_inferior_data for an
      inferior.  */
-  gdb::optional<displaced_step_buffers> disp_step_buf;
+  std::optional<displaced_step_buffers> disp_step_buf;
 };
 
 extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
index c5e6a8155800698651ec203f4644f39a908b9db2..98f38b2598d85393f30fb3c70e23518e4e9d8234 100644 (file)
@@ -52,7 +52,7 @@
 #include "gdbsupport/format.h"
 #include "source.h"
 #include "gdbsupport/byte-vector.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/gdb-safe-ctype.h"
 #include "gdbsupport/rsp-low.h"
 #include "inferior.h"
@@ -435,7 +435,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
   /* Some cases below will unpack the value again.  In the biased
      range case, we want to avoid this, so we store the unpacked value
      here for possible use later.  */
-  gdb::optional<LONGEST> val_long;
+  std::optional<LONGEST> val_long;
   if ((is_fixed_point_type (type)
        && (options->format == 'o'
           || options->format == 'x'
@@ -2452,7 +2452,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
   struct type *wctype = lookup_typename (current_language,
                                         "wchar_t", NULL, 0);
   int wcwidth = wctype->length ();
-  gdb::optional<gdb::byte_vector> tem_str;
+  std::optional<gdb::byte_vector> tem_str;
 
   if (value->lval () == lval_internalvar
       && c_is_string_type_p (value->type ()))
index 13e95bcfb2076de41e7940247e7731789b5a1a90..d9079be4d6211d4b1704d7fdf9e27068b73e1db9 100644 (file)
@@ -36,7 +36,7 @@
 #include "location.h"
 #include <ctype.h>
 #include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 /* Class that implements the static probe methods for "any" probe.  */
 
@@ -280,7 +280,7 @@ collect_probes (const std::string &objname, const std::string &provider,
                const std::string &probe_name, const static_probe_ops *spops)
 {
   std::vector<bound_probe> result;
-  gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
+  std::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
 
   if (!provider.empty ())
     prov_pat.emplace (provider.c_str (), REG_NOSUB,
@@ -683,9 +683,9 @@ disable_probes_command (const char *arg, int from_tty)
 static bool ignore_probes_p = false;
 static bool ignore_probes_idx = 0;
 static bool ignore_probes_verbose_p;
-static gdb::optional<compiled_regex> ignore_probes_prov_pat[2];
-static gdb::optional<compiled_regex> ignore_probes_name_pat[2];
-static gdb::optional<compiled_regex> ignore_probes_obj_pat[2];
+static std::optional<compiled_regex> ignore_probes_prov_pat[2];
+static std::optional<compiled_regex> ignore_probes_name_pat[2];
+static std::optional<compiled_regex> ignore_probes_obj_pat[2];
 
 /* See comments in probe.h.  */
 
@@ -696,11 +696,11 @@ ignore_probe_p (const char *provider, const char *name,
   if (!ignore_probes_p)
     return false;
 
-  gdb::optional<compiled_regex> &re_prov
+  std::optional<compiled_regex> &re_prov
     = ignore_probes_prov_pat[ignore_probes_idx];
-  gdb::optional<compiled_regex> &re_name
+  std::optional<compiled_regex> &re_name
     = ignore_probes_name_pat[ignore_probes_idx];
-  gdb::optional<compiled_regex> &re_obj
+  std::optional<compiled_regex> &re_obj
     = ignore_probes_obj_pat[ignore_probes_idx];
 
   bool res
@@ -755,11 +755,11 @@ ignore_probes_command (const char *arg, int from_tty)
   /* Parse the regular expressions, making sure that the old regular
      expressions are still valid if an exception is throw.  */
   int new_ignore_probes_idx = 1 - ignore_probes_idx;
-  gdb::optional<compiled_regex> &re_prov
+  std::optional<compiled_regex> &re_prov
     = ignore_probes_prov_pat[new_ignore_probes_idx];
-  gdb::optional<compiled_regex> &re_name
+  std::optional<compiled_regex> &re_name
     = ignore_probes_name_pat[new_ignore_probes_idx];
-  gdb::optional<compiled_regex> &re_obj
+  std::optional<compiled_regex> &re_obj
     = ignore_probes_obj_pat[new_ignore_probes_idx];
   re_prov.reset ();
   re_name.reset ();
index 3a5d173ee429ccffd44363b9c155ce84dac7b8e1..1a543a60202cd6b63251a3023b470248843781f4 100644 (file)
@@ -3615,7 +3615,7 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
   proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
                             &thread_args);
 
-  gdb::optional<gdb::byte_vector> auxv =
+  std::optional<gdb::byte_vector> auxv =
     target_read_alloc (current_inferior ()->top_target (),
                       TARGET_OBJECT_AUXV, NULL);
   if (auxv && !auxv->empty ())
index 41ecf31424be2564cf455a27e8725fe4501f3537..484d4eaa651a93b596054764c652ec4f27247e93 100644 (file)
@@ -1025,7 +1025,7 @@ psymbol_functions::expand_symtabs_matching
   for (partial_symtab *ps : partial_symbols (objfile))
     ps->searched_flag = PST_NOT_SEARCHED;
 
-  gdb::optional<lookup_name_info> psym_lookup_name;
+  std::optional<lookup_name_info> psym_lookup_name;
   if (lookup_name != nullptr)
     psym_lookup_name = lookup_name->make_ignore_params ();
 
index 41337d0db891841e4a9c2dfbf302c7a6bbf1777c..4bafc6e998e6cf797c3104fdc2cb2d22d5de9e7f 100644 (file)
@@ -131,7 +131,7 @@ private:
   /* The obstack where allocations are made.  This is lazily allocated
      so that we don't waste memory when there are no psymtabs.  */
 
-  gdb::optional<auto_obstack> m_obstack;
+  std::optional<auto_obstack> m_obstack;
 };
 
 /* A partial_symbol records the name, domain, and address class of
index 6f0fed137e6cb27e1ea60add975938baadb8e883..7a13b81a0c2d4fbd96bc7e75e82e8879cf06945c 100644 (file)
@@ -176,7 +176,7 @@ struct gdbpy_disassembler : public gdb_disassemble_info
   /* Return a reference to an optional that contains the address at which a
      memory error occurred.  The optional will only have a value if a
      memory error actually occurred.  */
-  const gdb::optional<CORE_ADDR> &memory_error_address () const
+  const std::optional<CORE_ADDR> &memory_error_address () const
   { return m_memory_error_address; }
 
   /* Return the content of the disassembler as a string.  The contents are
@@ -221,7 +221,7 @@ private:
 
   /* When the user indicates that a memory error has occurred then the
      address of the memory error is stored in here.  */
-  gdb::optional<CORE_ADDR> m_memory_error_address;
+  std::optional<CORE_ADDR> m_memory_error_address;
 
   /* When the user calls the builtin_disassemble function, if they pass a
      memory source object then a pointer to the object is placed in here,
@@ -245,7 +245,7 @@ private:
 
   /* Store a single exception.  This is used to pass Python exceptions back
      from ::memory_read to disasmpy_builtin_disassemble.  */
-  gdb::optional<gdbpy_err_fetch> m_stored_exception;
+  std::optional<gdbpy_err_fetch> m_stored_exception;
 };
 
 /* Return true if OBJ is still valid, otherwise, return false.  A valid OBJ
@@ -1215,7 +1215,7 @@ private:
 
 /* See python-internal.h.  */
 
-gdb::optional<int>
+std::optional<int>
 gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
                  disassemble_info *info)
 {
@@ -1294,7 +1294,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
            addr = disasm_info->address;
 
          info->memory_error_func (-1, addr, info);
-         return gdb::optional<int> (-1);
+         return std::optional<int> (-1);
        }
       else if (PyErr_ExceptionMatches (gdbpy_gdberror_exc))
        {
@@ -1302,12 +1302,12 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
          gdb::unique_xmalloc_ptr<char> msg = err.to_string ();
 
          info->fprintf_func (info->stream, "%s", msg.get ());
-         return gdb::optional<int> (-1);
+         return std::optional<int> (-1);
        }
       else
        {
          gdbpy_print_stack ();
-         return gdb::optional<int> (-1);
+         return std::optional<int> (-1);
        }
 
     }
@@ -1326,7 +1326,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
       PyErr_SetString (PyExc_TypeError,
                       _("Result is not a DisassemblerResult."));
       gdbpy_print_stack ();
-      return gdb::optional<int> (-1);
+      return std::optional<int> (-1);
     }
 
   /* The result from the Python disassembler has the correct type.  Convert
@@ -1345,7 +1345,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
        (PyExc_ValueError,
         _("Invalid length attribute: length must be greater than 0."));
       gdbpy_print_stack ();
-      return gdb::optional<int> (-1);
+      return std::optional<int> (-1);
     }
   if (length > max_insn_length)
     {
@@ -1354,7 +1354,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
         _("Invalid length attribute: length %d greater than architecture maximum of %d"),
         length, max_insn_length);
       gdbpy_print_stack ();
-      return gdb::optional<int> (-1);
+      return std::optional<int> (-1);
     }
 
   /* It is impossible to create a DisassemblerResult object with an empty
@@ -1390,7 +1390,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
        }
     }
 
-  return gdb::optional<int> (length);
+  return std::optional<int> (length);
 }
 
 /* The tp_dealloc callback for the DisassemblerResult type.  Takes care of
index e555dc3d8797f879bd7141c3d2c70cc618bb60d2..dc7e47d70f0625b67e8ed5ca44185086a75888d8 100644 (file)
@@ -32,7 +32,7 @@
 #include "demangle.h"
 #include "mi/mi-cmds.h"
 #include "python-internal.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "cli/cli-style.h"
 
 enum mi_print_types
@@ -322,7 +322,7 @@ py_print_single_arg (struct ui_out *out,
   else
     val = fv;
 
-  gdb::optional<ui_out_emit_tuple> maybe_tuple;
+  std::optional<ui_out_emit_tuple> maybe_tuple;
 
   /*  MI has varying rules for tuples, but generally if there is only
       one element in each item in the list, do not start a tuple.  The
@@ -562,7 +562,7 @@ enumerate_locals (PyObject *iter,
       struct symbol *sym;
       const struct block *sym_block;
       int local_indent = 8 + (8 * indent);
-      gdb::optional<ui_out_emit_tuple> tuple;
+      std::optional<ui_out_emit_tuple> tuple;
 
       gdbpy_ref<> item (PyIter_Next (iter));
       if (item == NULL)
@@ -773,7 +773,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
   get_user_print_options (&opts);
   if (print_frame_info)
     {
-      gdb::optional<enum print_what> user_frame_info_print_what;
+      std::optional<enum print_what> user_frame_info_print_what;
 
       get_user_print_what_frame_info (&user_frame_info_print_what);
       if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
@@ -808,7 +808,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
       return EXT_LANG_BT_OK;
     }
 
-  gdb::optional<ui_out_emit_tuple> tuple;
+  std::optional<ui_out_emit_tuple> tuple;
 
   /* -stack-list-locals does not require a
      wrapping frame attribute.  */
index c0bd6a698954261008a687dc41a24fab2f918e0f..ed153d668acf8c578f2425269e91201a84365e98 100644 (file)
@@ -364,7 +364,7 @@ add_thread_object (struct thread_info *tp)
 
 static void
 delete_thread_object (thread_info *tp,
-                     gdb::optional<ULONGEST> /* exit_code */,
+                     std::optional<ULONGEST> /* exit_code */,
                      bool /* silent */)
 {
   if (!gdb_python_initialized)
index aaa225da95e4765dae11ffa8d8e7e79713e459a9..d38a0ff172422e6bde4c5339d29cf6386e4726d6 100644 (file)
@@ -145,7 +145,7 @@ private:
 
   /* If an error occurred, this holds the exception information for
      use by the 'release' method.  */
-  gdb::optional<gdbpy_err_fetch> m_error;
+  std::optional<gdbpy_err_fetch> m_error;
 
   /* Return a reference to the object under construction.  */
   object_desc &current ()
index 15520849f15c94f92e2dfda487d672f45266a0b4..f1ca9ea0a5dbeaa4ab473aa1eba108f33ce4936d 100644 (file)
@@ -469,12 +469,12 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
      (user left a single stray space at the start of an otherwise blank
      line), we don't consider lines without content when updating the
      MIN_WHITESPACE value.  */
-  gdb::optional<int> min_whitespace;
+  std::optional<int> min_whitespace;
 
   /* The index into WS_INFO at which the processing of DOC can be
      considered "all done", that is, after this point there are no further
      lines with useful content and we should just stop.  */
-  gdb::optional<size_t> all_done_idx;
+  std::optional<size_t> all_done_idx;
 
   /* White-space information for each line in DOC.  */
   std::vector<line_whitespace> ws_info;
index 847bed84dfe2ede0385194ea6e0a1d7112e85098..86eb5436f2aa31842d22320d00d32eacb40da696 100644 (file)
@@ -732,7 +732,7 @@ class gdbpy_enter
 
   /* An optional is used here because we don't want to call
      PyErr_Fetch too early.  */
-  gdb::optional<gdbpy_err_fetch> m_error;
+  std::optional<gdbpy_err_fetch> m_error;
 };
 
 /* Like gdbpy_enter, but takes a varobj.  This is a subclass just to
@@ -953,7 +953,7 @@ extern gdb::unique_xmalloc_ptr<char> gdbpy_fix_doc_string_indentation
 
    If no instruction can be disassembled then return an empty value.  */
 
-extern gdb::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch,
+extern std::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch,
                                            CORE_ADDR address,
                                            disassemble_info *info);
 
index 7e48165db21abd3f4717e786f454ea90db788b1d..8a36673a3e4c0bef8533d259d8c13118e650df1a 100644 (file)
@@ -124,9 +124,9 @@ static void gdbpy_set_quit_flag (const struct extension_language_defn *);
 static int gdbpy_check_quit_flag (const struct extension_language_defn *);
 static enum ext_lang_rc gdbpy_before_prompt_hook
   (const struct extension_language_defn *, const char *current_gdb_prompt);
-static gdb::optional<std::string> gdbpy_colorize
+static std::optional<std::string> gdbpy_colorize
   (const std::string &filename, const std::string &contents);
-static gdb::optional<std::string> gdbpy_colorize_disasm
+static std::optional<std::string> gdbpy_colorize_disasm
 (const std::string &content, gdbarch *gdbarch);
 static ext_lang_missing_debuginfo_result gdbpy_handle_missing_debuginfo
   (const struct extension_language_defn *extlang, struct objfile *objfile);
@@ -1198,7 +1198,7 @@ gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
 
 /* This is the extension_language_ops.colorize "method".  */
 
-static gdb::optional<std::string>
+static std::optional<std::string>
 gdbpy_colorize (const std::string &filename, const std::string &contents)
 {
   if (!gdb_python_initialized)
@@ -1275,7 +1275,7 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
 
 /* This is the extension_language_ops.colorize_disasm "method".  */
 
-static gdb::optional<std::string>
+static std::optional<std::string>
 gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
 {
   if (!gdb_python_initialized)
index 3558cfd3875d4ef93b0e2a337c8facfe5b0ef14f..f147b66b3c60c16e9c5b5bd48dfc67ca866ba49d 100644 (file)
@@ -685,7 +685,7 @@ ravenscar_thread_target::fetch_registers (struct regcache *regcache,
       struct gdbarch *gdbarch = regcache->arch ();
       bool is_active = task_is_currently_active (ptid);
       struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
-      gdb::optional<fpu_state> fp_state;
+      std::optional<fpu_state> fp_state;
 
       int low_reg = regnum == -1 ? 0 : regnum;
       int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
@@ -731,7 +731,7 @@ ravenscar_thread_target::store_registers (struct regcache *regcache,
       struct gdbarch *gdbarch = regcache->arch ();
       bool is_active = task_is_currently_active (ptid);
       struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch);
-      gdb::optional<fpu_state> fp_state;
+      std::optional<fpu_state> fp_state;
 
       int low_reg = regnum == -1 ? 0 : regnum;
       int high_reg = regnum == -1 ? gdbarch_num_regs (gdbarch) : regnum + 1;
index f0e190f9bf7a0e560acdb2fc0737971c198a57f4..e084196b84174f48d98363e0d7703344dde7dc82 100644 (file)
@@ -758,8 +758,8 @@ btrace_find_line_range (CORE_ADDR pc)
 
 static void
 btrace_print_lines (struct btrace_line_range lines, struct ui_out *uiout,
-                   gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
-                   gdb::optional<ui_out_emit_list> *asm_list,
+                   std::optional<ui_out_emit_tuple> *src_and_asm_tuple,
+                   std::optional<ui_out_emit_list> *asm_list,
                    gdb_disassembly_flags flags)
 {
   print_source_lines_flags psl_flags;
@@ -798,8 +798,8 @@ btrace_insn_history (struct ui_out *uiout,
 
   ui_out_emit_list list_emitter (uiout, "asm_insns");
 
-  gdb::optional<ui_out_emit_tuple> src_and_asm_tuple;
-  gdb::optional<ui_out_emit_list> asm_list;
+  std::optional<ui_out_emit_tuple> src_and_asm_tuple;
+  std::optional<ui_out_emit_list> asm_list;
 
   gdb_pretty_print_disassembler disasm (gdbarch, uiout);
 
index 48d7db47c06eb9104902cb06611c1aad9d1220e9..9dc354ec2b3a40a7c31b0224580e4d63cdeca2bf 100644 (file)
@@ -578,7 +578,7 @@ regcache::raw_update (int regnum)
 
   if (get_register_status (regnum) == REG_UNKNOWN)
     {
-      gdb::optional<scoped_restore_current_thread> maybe_restore_thread
+      std::optional<scoped_restore_current_thread> maybe_restore_thread
        = maybe_switch_inferior (m_inf_for_target_calls);
 
       target_fetch_registers (this, regnum);
@@ -832,7 +832,7 @@ regcache::raw_write (int regnum, const gdb_byte *buf)
                  m_descr->sizeof_register[regnum]) == 0))
     return;
 
-  gdb::optional<scoped_restore_current_thread> maybe_restore_thread
+  std::optional<scoped_restore_current_thread> maybe_restore_thread
     = maybe_switch_inferior (m_inf_for_target_calls);
 
   target_prepare_to_store (this);
index 501270041d84d397c61e7a90528db475b8cfc132..1bc59928dcf847e811615987a23feed097823dbc 100644 (file)
@@ -930,7 +930,7 @@ public:
                     const char *filename,
                     fileio_error *target_errno) override;
 
-  gdb::optional<std::string>
+  std::optional<std::string>
     fileio_readlink (struct inferior *inf,
                     const char *filename,
                     fileio_error *target_errno) override;
@@ -4091,7 +4091,7 @@ remote_target::remote_get_threads_with_qxfer (threads_listing_context *context)
 #if defined(HAVE_LIBEXPAT)
   if (m_features.packet_support (PACKET_qXfer_threads) == PACKET_ENABLE)
     {
-      gdb::optional<gdb::char_vector> xml
+      std::optional<gdb::char_vector> xml
        = target_read_stralloc (this, TARGET_OBJECT_THREADS, NULL);
 
       if (xml && (*xml)[0] != '\0')
@@ -11913,7 +11913,7 @@ std::vector<mem_region>
 remote_target::memory_map ()
 {
   std::vector<mem_region> result;
-  gdb::optional<gdb::char_vector> text
+  std::optional<gdb::char_vector> text
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_MEMORY_MAP, NULL);
 
@@ -12878,7 +12878,7 @@ remote_target::fileio_unlink (struct inferior *inf, const char *filename,
 
 /* Implementation of to_fileio_readlink.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 remote_target::fileio_readlink (struct inferior *inf, const char *filename,
                                fileio_error *remote_errno)
 {
@@ -14145,7 +14145,7 @@ remote_target::set_circular_trace_buffer (int val)
 traceframe_info_up
 remote_target::traceframe_info ()
 {
-  gdb::optional<gdb::char_vector> text
+  std::optional<gdb::char_vector> text
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_TRACEFRAME_INFO,
                            NULL);
@@ -14686,7 +14686,7 @@ btrace_read_config (thread_info *tp, btrace_config *conf)
   scoped_restore_current_thread restore_thread;
   switch_to_thread (tp);
 
-  gdb::optional<gdb::char_vector> xml
+  std::optional<gdb::char_vector> xml
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_BTRACE_CONF, "");
   if (xml)
@@ -14886,7 +14886,7 @@ remote_target::read_btrace (struct btrace_data *btrace,
                      (unsigned int) type);
     }
 
-  gdb::optional<gdb::char_vector> xml
+  std::optional<gdb::char_vector> xml
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_BTRACE, annex);
   if (!xml)
@@ -14926,7 +14926,7 @@ remote_target::load (const char *name, int from_tty)
 const char *
 remote_target::pid_to_exec_file (int pid)
 {
-  static gdb::optional<gdb::char_vector> filename;
+  static std::optional<gdb::char_vector> filename;
   char *annex = NULL;
 
   if (m_features.packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
index 3a2891c2c9201510e653870e241bd1614df6104e..3725be4427667bf71ab113866e7bf767c79f6a32 100644 (file)
@@ -1676,7 +1676,7 @@ private:
      passed, is the value to place in rs1, otherwise rd is duplicated into
      rs1.  */
   void decode_ci_type_insn (enum opcode opcode, ULONGEST ival,
-                           gdb::optional<int> rs1_regnum = {})
+                           std::optional<int> rs1_regnum = {})
   {
     m_opcode = opcode;
     m_rd = decode_register_index (ival, OP_SH_CRS1S);
index 414238a4db23ebf3cd3731b29e1bf9e7763d3103..ae45ec6b5df93afed4a63aab0c681be4df3a9eb8 100644 (file)
@@ -332,7 +332,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
                            struct target_ops *target, bfd *abfd)
 {
   asection *section = bfd_get_section_by_name (abfd, ".reg");
-  gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
+  std::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
   CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
   bool high_gprs, v1, v2, te, vx, gs;
 
index 28902a6d326f3c6585e1c9ba8945389cda4d0a84..465978ff9cce005923df6a8e13528818d4868d24 100644 (file)
@@ -34,7 +34,7 @@
 #include "filenames.h"
 #include "fnmatch.h"
 #include "gdbsupport/gdb_regex.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include <list>
 #include "cli/cli-style.h"
 #include "gdbsupport/buildargv.h"
@@ -113,7 +113,7 @@ private: /* data */
   std::string m_function;
 
   /* If this is a function regexp, the compiled form.  */
-  gdb::optional<compiled_regex> m_compiled_function_regexp;
+  std::optional<compiled_regex> m_compiled_function_regexp;
 
   /* Enabled/disabled state.  */
   bool m_enabled = true;
index 0fc3a1539739aea04d1d919fd44b79cefb6ad9b0..1a70f98ba59d08b64db04db696fdba74f2785613 100644 (file)
@@ -65,7 +65,7 @@ struct solib_aix_inferior_data
      the same principles applied to shared libraries also apply
      to the main executable.  So it's simpler to keep it as part
      of this list.  */
-  gdb::optional<std::vector<lm_info_aix>> library_list;
+  std::optional<std::vector<lm_info_aix>> library_list;
 };
 
 /* Key to our per-inferior data.  */
@@ -91,7 +91,7 @@ get_solib_aix_inferior_data (struct inferior *inf)
 
 /* Dummy implementation if XML support is not compiled in.  */
 
-static gdb::optional<std::vector<lm_info_aix>>
+static std::optional<std::vector<lm_info_aix>>
 solib_aix_parse_libraries (const char *library)
 {
   static int have_warned;
@@ -201,7 +201,7 @@ static const struct gdb_xml_element library_list_elements[] =
 
    Return an empty option if the parsing failed.  */
 
-static gdb::optional<std::vector<lm_info_aix>>
+static std::optional<std::vector<lm_info_aix>>
 solib_aix_parse_libraries (const char *library)
 {
   std::vector<lm_info_aix> result;
@@ -225,7 +225,7 @@ solib_aix_parse_libraries (const char *library)
    is not NULL, then print a warning including WARNING_MSG and
    a description of the error.  */
 
-static gdb::optional<std::vector<lm_info_aix>> &
+static std::optional<std::vector<lm_info_aix>> &
 solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
 {
   struct solib_aix_inferior_data *data;
@@ -235,7 +235,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
   if (data->library_list.has_value ())
     return data->library_list;
 
-  gdb::optional<gdb::char_vector> library_document
+  std::optional<gdb::char_vector> library_document
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_LIBRARIES_AIX,
                            NULL);
@@ -421,7 +421,7 @@ solib_aix_solib_create_inferior_hook (int from_tty)
 
   /* We need to relocate the main executable...  */
 
-  gdb::optional<std::vector<lm_info_aix>> &library_list
+  std::optional<std::vector<lm_info_aix>> &library_list
     = solib_aix_get_library_list (current_inferior (), warning_msg);
   if (!library_list.has_value ())
     return;  /* Warning already printed.  */
@@ -448,7 +448,7 @@ solib_aix_solib_create_inferior_hook (int from_tty)
 static intrusive_list<shobj>
 solib_aix_current_sos ()
 {
-  gdb::optional<std::vector<lm_info_aix>> &library_list
+  std::optional<std::vector<lm_info_aix>> &library_list
     = solib_aix_get_library_list (current_inferior (), NULL);
   if (!library_list.has_value ())
     return {};
index ef561466945dcfb911428eb50566fe20ff1f2aed..0d98ae85cc0df1072074df3bef922c7936a939ba 100644 (file)
@@ -276,7 +276,7 @@ static void
 dsbt_get_initial_loadmaps (void)
 {
   dsbt_info *info = get_dsbt_info (current_program_space);
-  gdb::optional<gdb::byte_vector> buf
+  std::optional<gdb::byte_vector> buf
     = target_read_alloc (current_inferior ()->top_target (),
                         TARGET_OBJECT_FDPIC, "exec");
 
index 5882a4e0070fffc853e150f6bb59f41aa4e49140..d7fd199703ce0241595d8b3468c55c8f4e17d3a7 100644 (file)
@@ -454,7 +454,7 @@ static int match_main (const char *);
    architecture size (32-bit or 64-bit) is returned to *P_ARCH_SIZE.  Likewise,
    the base address of the section is returned in *BASE_ADDR.  */
 
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
 read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
 {
   bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
@@ -587,7 +587,7 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
 
 
 /* Return program interpreter string.  */
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
 find_program_interpreter (void)
 {
   /* If we have a current exec_bfd, use its section table.  */
@@ -632,7 +632,7 @@ scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr,
   CORE_ADDR base_addr;
 
   /* Read in .dynamic section.  */
-  gdb::optional<gdb::byte_vector> ph_data
+  std::optional<gdb::byte_vector> ph_data
     = read_program_header (PT_DYNAMIC, &arch_size, &base_addr);
   if (!ph_data)
     return 0;
@@ -1159,7 +1159,7 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
   gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
 
   /* Fetch the list of shared libraries.  */
-  gdb::optional<gdb::char_vector> svr4_library_document
+  std::optional<gdb::char_vector> svr4_library_document
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_LIBRARIES_SVR4,
                            annex);
@@ -2309,7 +2309,7 @@ enable_break (struct svr4_info *info, int from_tty)
 
   /* Find the program interpreter; if not found, warn the user and drop
      into the old breakpoint at symbol code.  */
-  gdb::optional<gdb::byte_vector> interp_name_holder
+  std::optional<gdb::byte_vector> interp_name_holder
     = find_program_interpreter ();
   if (interp_name_holder)
     {
@@ -2519,7 +2519,7 @@ enable_break (struct svr4_info *info, int from_tty)
 
 /* Read the ELF program headers from ABFD.  */
 
-static gdb::optional<gdb::byte_vector>
+static std::optional<gdb::byte_vector>
 read_program_headers_from_bfd (bfd *abfd)
 {
   Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd);
@@ -2632,9 +2632,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
         really do not match.  */
       int arch_size;
 
-      gdb::optional<gdb::byte_vector> phdrs_target
+      std::optional<gdb::byte_vector> phdrs_target
        = read_program_header (-1, &arch_size, NULL);
-      gdb::optional<gdb::byte_vector> phdrs_binary
+      std::optional<gdb::byte_vector> phdrs_binary
        = read_program_headers_from_bfd (current_program_space->exec_bfd ());
       if (phdrs_target && phdrs_binary)
        {
index c612507281249fb6cf5e60299eadd80bbea97f6c..b311c76965d825a885273a92a6dd54c25be05a03 100644 (file)
@@ -233,7 +233,7 @@ solib_target_current_sos (void)
   intrusive_list<shobj> sos;
 
   /* Fetch the list of shared libraries.  */
-  gdb::optional<gdb::char_vector> library_document
+  std::optional<gdb::char_vector> library_document
     = target_read_stralloc (current_inferior ()->top_target (),
                            TARGET_OBJECT_LIBRARIES, NULL);
   if (!library_document)
index c955929b543d5ffafe16917ea2b05a8d6ded9a39..eb467fd3da5ecbefb9d3f60edb09d7299245cdc2 100644 (file)
@@ -343,7 +343,7 @@ source_cache::ensure (struct symtab *s)
 
       if (!already_styled)
        {
-         gdb::optional<std::string> ext_contents;
+         std::optional<std::string> ext_contents;
          ext_contents = ext_lang_colorize (fullname, contents);
          if (ext_contents.has_value ())
            {
index ef565445c164c8415b6f3fe3508647aca2945d89..20bb85efd19e38ccb6dadf22c00075c6c428c19e 100644 (file)
@@ -97,7 +97,7 @@ static const char *const print_frame_info_choices[] =
 
 /* print_frame_info_print_what[i] maps a choice to the corresponding
    print_what enum.  */
-static const gdb::optional<enum print_what> print_frame_info_print_what[] =
+static const std::optional<enum print_what> print_frame_info_print_what[] =
   {{}, /* Empty value for "auto".  */
    SRC_LINE, LOCATION, SRC_AND_LOC, LOC_AND_ADDRESS, SHORT_LOCATION};
 
@@ -973,7 +973,7 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
    Value not present indicates to the caller to use default values
    specific to the command being executed.  */
 
-static gdb::optional<enum print_what>
+static std::optional<enum print_what>
 print_frame_info_to_print_what (const char *print_frame_info)
 {
   for (int i = 0; print_frame_info_choices[i] != NULL; i++)
@@ -1004,7 +1004,7 @@ print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info_ptr frame,
 /* See stack.h.  */
 
 void
-get_user_print_what_frame_info (gdb::optional<enum print_what> *what)
+get_user_print_what_frame_info (std::optional<enum print_what> *what)
 {
   *what
     = print_frame_info_to_print_what
@@ -2261,8 +2261,8 @@ iterate_over_block_local_vars (const struct block *block,
 
 struct print_variable_and_value_data
 {
-  gdb::optional<compiled_regex> preg;
-  gdb::optional<compiled_regex> treg;
+  std::optional<compiled_regex> preg;
+  std::optional<compiled_regex> treg;
   struct frame_id frame_id;
   int num_tabs;
   struct ui_file *stream;
@@ -2307,7 +2307,7 @@ print_variable_and_value_data::operator() (const char *print_name,
    If REGEXP is NULL, it results in an empty regular expression.  */
 
 static void
-prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
+prepare_reg (const char *regexp, std::optional<compiled_regex> *reg)
 {
   if (regexp != NULL)
     {
@@ -2499,8 +2499,8 @@ print_frame_arg_vars (frame_info_ptr frame,
   struct print_variable_and_value_data cb_data;
   struct symbol *func;
   CORE_ADDR pc;
-  gdb::optional<compiled_regex> preg;
-  gdb::optional<compiled_regex> treg;
+  std::optional<compiled_regex> preg;
+  std::optional<compiled_regex> treg;
 
   if (!get_frame_pc_if_available (frame, &pc))
     {
index 1b0c2b342a46e440845831d220ab25977ad16480..a64abaf52b5014ad2d4aaeec82c87835919e127f 100644 (file)
@@ -38,7 +38,7 @@ void iterate_over_block_local_vars (const struct block *block,
    information to print, otherwise the printing function should print
    the relevant information.  */
 
-void get_user_print_what_frame_info (gdb::optional<enum print_what> *what);
+void get_user_print_what_frame_info (std::optional<enum print_what> *what);
 
 /* Return true if we should display the address in addition to the location,
    because we are in the middle of a statement.  */
index bbac6ad9df1d02cf3913d1366e61049f7c90dbe8..c5af186ad33c3344e3f1233d52b424a802d06785 100644 (file)
@@ -913,7 +913,7 @@ syms_from_objfile_1 (struct objfile *objfile,
 
   /* Make sure that partially constructed symbol tables will be cleaned up
      if an error occurs during symbol reading.  */
-  gdb::optional<clear_symtab_users_cleanup> defer_clear_users;
+  std::optional<clear_symtab_users_cleanup> defer_clear_users;
 
   objfile_up objfile_holder (objfile);
 
index 5ec56f4f2afe3297a06168bc2fa16e4e77a6c90f..17d1987608f502138dd33559bc5ad1eab8972444 100644 (file)
@@ -66,7 +66,7 @@
 #include "parser-defs.h"
 #include "completer.h"
 #include "progspace-and-thread.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "filename-seen-cache.h"
 #include "arch-utils.h"
 #include <algorithm>
@@ -943,7 +943,7 @@ void
 general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
                                            bool copy_name,
                                            objfile_per_bfd_storage *per_bfd,
-                                           gdb::optional<hashval_t> hash)
+                                           std::optional<hashval_t> hash)
 {
   struct demangled_name_entry **slot;
 
@@ -3714,7 +3714,7 @@ skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
    the function starting at FUNC_ADDR which has prologue_end set to true if
    such entry exist, otherwise return an empty optional.  */
 
-static gdb::optional<CORE_ADDR>
+static std::optional<CORE_ADDR>
 skip_prologue_using_linetable (CORE_ADDR func_addr)
 {
   CORE_ADDR start_pc, end_pc;
@@ -3838,7 +3838,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
         be placed to skip the prologue.  */
       if (!ignore_prologue_end_flag && skip)
        {
-         gdb::optional<CORE_ADDR> linetable_pc
+         std::optional<CORE_ADDR> linetable_pc
            = skip_prologue_using_linetable (pc);
          if (linetable_pc)
            {
@@ -4450,8 +4450,8 @@ info_sources_worker (struct ui_out *uiout,
   output_source_filename_data data (uiout, filter);
 
   ui_out_emit_list results_emitter (uiout, "files");
-  gdb::optional<ui_out_emit_tuple> output_tuple;
-  gdb::optional<ui_out_emit_list> sources_list;
+  std::optional<ui_out_emit_tuple> output_tuple;
+  std::optional<ui_out_emit_list> sources_list;
 
   gdb_assert (group_by_objfile || uiout->is_mi_like_p ());
 
@@ -4652,7 +4652,7 @@ global_symbol_searcher::is_suitable_msymbol
 
 bool
 global_symbol_searcher::expand_symtabs
-       (objfile *objfile, const gdb::optional<compiled_regex> &preg) const
+       (objfile *objfile, const std::optional<compiled_regex> &preg) const
 {
   enum search_domain kind = m_kind;
   bool found_msymbol = false;
@@ -4734,8 +4734,8 @@ global_symbol_searcher::expand_symtabs
 bool
 global_symbol_searcher::add_matching_symbols
        (objfile *objfile,
-        const gdb::optional<compiled_regex> &preg,
-        const gdb::optional<compiled_regex> &treg,
+        const std::optional<compiled_regex> &preg,
+        const std::optional<compiled_regex> &treg,
         std::set<symbol_search> *result_set) const
 {
   enum search_domain kind = m_kind;
@@ -4813,7 +4813,7 @@ global_symbol_searcher::add_matching_symbols
 
 bool
 global_symbol_searcher::add_matching_msymbols
-       (objfile *objfile, const gdb::optional<compiled_regex> &preg,
+       (objfile *objfile, const std::optional<compiled_regex> &preg,
         std::vector<symbol_search> *results) const
 {
   enum search_domain kind = m_kind;
@@ -4860,8 +4860,8 @@ global_symbol_searcher::add_matching_msymbols
 std::vector<symbol_search>
 global_symbol_searcher::search () const
 {
-  gdb::optional<compiled_regex> preg;
-  gdb::optional<compiled_regex> treg;
+  std::optional<compiled_regex> preg;
+  std::optional<compiled_regex> treg;
 
   gdb_assert (m_kind != ALL_DOMAIN);
 
index 8dfc873b1c9400ac7948583b7234634c0d32617a..0fb0c8683cbe0d6f505e2125b1d83d43e5b425d1 100644 (file)
@@ -30,7 +30,7 @@
 #include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/function-view.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/gdb_string_view.h"
 #include "gdbsupport/next-iterator.h"
 #include "gdbsupport/iterator-range.h"
@@ -364,10 +364,10 @@ private:
      around by const reference (see intro), and they're conceptually
      "cache" that can always be reconstructed from the non-mutable
      fields.  */
-  mutable gdb::optional<ada_lookup_name_info> m_ada;
-  mutable gdb::optional<demangle_for_lookup_info> m_cplus;
-  mutable gdb::optional<demangle_for_lookup_info> m_d;
-  mutable gdb::optional<demangle_for_lookup_info> m_go;
+  mutable std::optional<ada_lookup_name_info> m_ada;
+  mutable std::optional<demangle_for_lookup_info> m_cplus;
+  mutable std::optional<demangle_for_lookup_info> m_d;
+  mutable std::optional<demangle_for_lookup_info> m_go;
 
   /* The demangled hashes.  Stored in an array with one entry for each
      possible language.  The second array records whether we've
@@ -511,8 +511,8 @@ struct general_symbol_info
      copy_name must be set to true.  */
   void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
                              struct objfile_per_bfd_storage *per_bfd,
-                             gdb::optional<hashval_t> hash
-                               = gdb::optional<hashval_t> ());
+                             std::optional<hashval_t> hash
+                               = std::optional<hashval_t> ());
 
   CORE_ADDR value_address () const
   {
@@ -2598,7 +2598,7 @@ private:
      true if any msymbols were seen that we should later consider adding to
      the results list.  */
   bool expand_symtabs (objfile *objfile,
-                      const gdb::optional<compiled_regex> &preg) const;
+                      const std::optional<compiled_regex> &preg) const;
 
   /* Add symbols from symtabs in OBJFILE that match PREG, and TREG, and are
      of type M_KIND, to the results set RESULTS_SET.  Return false if we
@@ -2607,8 +2607,8 @@ private:
      Returning true does not indicate that any results were added, just
      that we didn't _not_ add a result due to reaching MAX_SEARCH_RESULTS.  */
   bool add_matching_symbols (objfile *objfile,
-                            const gdb::optional<compiled_regex> &preg,
-                            const gdb::optional<compiled_regex> &treg,
+                            const std::optional<compiled_regex> &preg,
+                            const std::optional<compiled_regex> &treg,
                             std::set<symbol_search> *result_set) const;
 
   /* Add msymbols from OBJFILE that match PREG and M_KIND, to the results
@@ -2618,7 +2618,7 @@ private:
      does not indicate that any results were added, just that we didn't
      _not_ add a result due to reaching MAX_SEARCH_RESULTS.  */
   bool add_matching_msymbols (objfile *objfile,
-                             const gdb::optional<compiled_regex> &preg,
+                             const std::optional<compiled_regex> &preg,
                              std::vector<symbol_search> *results) const;
 
   /* Return true if MSYMBOL is of type KIND.  */
@@ -2907,7 +2907,7 @@ private:
 
   /* A compiled version of M_REGEXP.  This object is only given a value if
      M_REGEXP is not nullptr and is not the empty string.  */
-  gdb::optional<compiled_regex> m_c_regexp;
+  std::optional<compiled_regex> m_c_regexp;
 };
 
 /* Perform the core of the 'info sources' command.
index 92aa1dd882e0a8b985b9bcd9340232c5250c55f7..c3dad38f3170d4baa98ce8458aa2ac5adf3ca619 100644 (file)
@@ -2231,7 +2231,7 @@ target_write (struct target_ops *ops,
    for details.  */
 
 template <typename T>
-gdb::optional<gdb::def_vector<T>>
+std::optional<gdb::def_vector<T>>
 target_read_alloc_1 (struct target_ops *ops, enum target_object object,
                     const char *annex)
 {
@@ -2280,7 +2280,7 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
 
 /* See target.h  */
 
-gdb::optional<gdb::byte_vector>
+std::optional<gdb::byte_vector>
 target_read_alloc (struct target_ops *ops, enum target_object object,
                   const char *annex)
 {
@@ -2289,11 +2289,11 @@ target_read_alloc (struct target_ops *ops, enum target_object object,
 
 /* See target.h.  */
 
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
 target_read_stralloc (struct target_ops *ops, enum target_object object,
                      const char *annex)
 {
-  gdb::optional<gdb::char_vector> buf
+  std::optional<gdb::char_vector> buf
     = target_read_alloc_1<char> (ops, object, annex);
 
   if (!buf)
@@ -2977,7 +2977,7 @@ target_supports_multi_process (void)
 
 /* See target.h.  */
 
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
 target_get_osdata (const char *type)
 {
   struct target_ops *t;
@@ -3206,7 +3206,7 @@ target_ops::fileio_unlink (struct inferior *inf, const char *filename,
   return -1;
 }
 
-gdb::optional<std::string>
+std::optional<std::string>
 target_ops::fileio_readlink (struct inferior *inf, const char *filename,
                             fileio_error *target_errno)
 {
@@ -3377,13 +3377,13 @@ target_fileio_unlink (struct inferior *inf, const char *filename,
 
 /* See target.h.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 target_fileio_readlink (struct inferior *inf, const char *filename,
                        fileio_error *target_errno)
 {
   for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
     {
-      gdb::optional<std::string> ret
+      std::optional<std::string> ret
        = t->fileio_readlink (inf, filename, target_errno);
 
       if (!ret.has_value () && *target_errno == FILEIO_ENOSYS)
index fca0bbbf66e29c137cbb89751841105138c78653..c54bd28c88c009a1a48b36bb17b1ce99d6458b5d 100644 (file)
@@ -345,7 +345,7 @@ LONGEST target_write_with_progress (struct target_ops *ops,
    size is known in advance.  Don't try to read TARGET_OBJECT_MEMORY
    through this function.  */
 
-extern gdb::optional<gdb::byte_vector> target_read_alloc
+extern std::optional<gdb::byte_vector> target_read_alloc
     (struct target_ops *ops, enum target_object object, const char *annex);
 
 /* Read OBJECT/ANNEX using OPS.  The result is a NUL-terminated character vector
@@ -355,7 +355,7 @@ extern gdb::optional<gdb::byte_vector> target_read_alloc
    the returned vector is guaranteed to have at least one element.  A warning is
    issued if the result contains any embedded NUL bytes.  */
 
-extern gdb::optional<gdb::char_vector> target_read_stralloc
+extern std::optional<gdb::char_vector> target_read_stralloc
     (struct target_ops *ops, enum target_object object, const char *annex);
 
 /* See target_ops->to_xfer_partial.  */
@@ -1001,7 +1001,7 @@ struct target_ops
        seen by the debugger (GDB or, for remote targets, the remote
        stub).  Return a string, or an empty optional if an error
        occurs (and set *TARGET_ERRNO).  */
-    virtual gdb::optional<std::string> fileio_readlink (struct inferior *inf,
+    virtual std::optional<std::string> fileio_readlink (struct inferior *inf,
                                                        const char *filename,
                                                        fileio_error *target_errno);
 
@@ -2206,7 +2206,7 @@ extern int target_fileio_unlink (struct inferior *inf,
    by the debugger (GDB or, for remote targets, the remote stub).
    Return a null-terminated string allocated via xmalloc, or NULL if
    an error occurs (and set *TARGET_ERRNO).  */
-extern gdb::optional<std::string> target_fileio_readlink
+extern std::optional<std::string> target_fileio_readlink
     (struct inferior *inf, const char *filename, fileio_error *target_errno);
 
 /* Read target file FILENAME, in the filesystem as seen by INF.  If
@@ -2469,7 +2469,7 @@ struct target_ops *find_target_at (enum strata stratum);
 /* Read OS data object of type TYPE from the target, and return it in XML
    format.  The return value follows the same rules as target_read_stralloc.  */
 
-extern gdb::optional<gdb::char_vector> target_get_osdata (const char *type);
+extern std::optional<gdb::char_vector> target_get_osdata (const char *type);
 
 /* Stuff that should be shared among the various remote targets.  */
 
index 810fdae18a8a0cd5c4581e9b7380b5d0d1c447b4..c0ed64e5f8bb4915ab8518d66c4d3e07c562c49d 100644 (file)
@@ -46,7 +46,7 @@
 #include "thread-fsm.h"
 #include "tid-parse.h"
 #include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "inline-frame.h"
 #include "stack.h"
 #include "interps.h"
@@ -194,7 +194,7 @@ clear_thread_inferior_resources (struct thread_info *tp)
 /* Notify interpreters and observers that thread T has exited.  */
 
 static void
-notify_thread_exited (thread_info *t, gdb::optional<ULONGEST> exit_code,
+notify_thread_exited (thread_info *t, std::optional<ULONGEST> exit_code,
                      int silent)
 {
   if (!silent && print_thread_events)
@@ -215,7 +215,7 @@ notify_thread_exited (thread_info *t, gdb::optional<ULONGEST> exit_code,
 /* See gdbthread.h.  */
 
 void
-set_thread_exited (thread_info *tp, gdb::optional<ULONGEST> exit_code,
+set_thread_exited (thread_info *tp, std::optional<ULONGEST> exit_code,
                   bool silent)
 {
   /* Dead threads don't need to step-over.  Remove from chain.  */
@@ -504,7 +504,7 @@ global_thread_step_over_chain_remove (struct thread_info *tp)
 /* Helper for the different delete_thread variants.  */
 
 static void
-delete_thread_1 (thread_info *thr, gdb::optional<ULONGEST> exit_code,
+delete_thread_1 (thread_info *thr, std::optional<ULONGEST> exit_code,
                 bool silent)
 {
   gdb_assert (thr != nullptr);
@@ -1112,8 +1112,8 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
     /* For backward compatibility, we make a list for MI.  A table is
        preferable for the CLI, though, because it shows table
        headers.  */
-    gdb::optional<ui_out_emit_list> list_emitter;
-    gdb::optional<ui_out_emit_table> table_emitter;
+    std::optional<ui_out_emit_list> list_emitter;
+    std::optional<ui_out_emit_table> table_emitter;
 
     /* We'll be switching threads temporarily below.  */
     scoped_restore_current_thread restore_thread;
@@ -1543,7 +1543,7 @@ tp_array_compar_descending (const thread_info_ref &a, const thread_info_ref &b)
 /* See gdbthread.h.  */
 
 void
-thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
+thread_try_catch_cmd (thread_info *thr, std::optional<int> ada_task,
                      const char *cmd, int from_tty,
                      const qcs_flags &flags)
 {
index b698b4004cc2a6acf52ca1433d8a387e5778d552..a710246d7ad2012a49ca3608ece960073b7740c6 100644 (file)
@@ -305,7 +305,7 @@ tfile_write_tdesc (struct trace_file_writer *self)
   struct tfile_trace_file_writer *writer
     = (struct tfile_trace_file_writer *) self;
 
-  gdb::optional<std::string> tdesc
+  std::optional<std::string> tdesc
     = target_fetch_description_xml (current_inferior ()->top_target ());
 
   if (!tdesc)
index 750185341ea367333b472ae19663bdb6d30fb476..05b5f681571447cf6f6219f5d3d7a2987c200caf 100644 (file)
@@ -3732,7 +3732,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
                  void *ignore)
 {
   /* We need to read the whole object before we know its size.  */
-  gdb::optional<gdb::byte_vector> buf
+  std::optional<gdb::byte_vector> buf
     = target_read_alloc (current_inferior ()->top_target (),
                         TARGET_OBJECT_STATIC_TRACE_DATA,
                         NULL);
index ffcb95bb635fb6cf62c3aa9f7aa2cd39b1dac411..b5d5a4cc20fceee5ec922b5946e5a2babaddd040 100644 (file)
@@ -234,7 +234,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
         promising starting point then we record it in this structure.  If
         the next address we try is not a suitable starting point then we
         will fall back to the address held here.  */
-      gdb::optional<CORE_ADDR> possible_new_low;
+      std::optional<CORE_ADDR> possible_new_low;
 
       /* The previous value of NEW_LOW so we know if the new value is
         different or not.  */
index 159445dc52079df5678d8dedf306dbb7b139fb96..b932649b3ac2f51502fbd8006bc065108af51d4f 100644 (file)
@@ -819,7 +819,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
   };
 
   /* This is given a value only if we fix the size of the cmd window.  */
-  gdb::optional<old_size_info> old_cmd_info;
+  std::optional<old_size_info> old_cmd_info;
 
   std::vector<size_info> info (m_splits.size ());
 
index 8a727c02159e663f6b604fbbc81f2136a553070f..51135b8b98c10f27c2f0f6bfe91ed8ec337ebaed 100644 (file)
@@ -31,7 +31,7 @@
 #define VERIFY SELF_CHECK
 
 /* Used to disable testing features not supported by
-   gdb::optional.  */
+   std::optional.  */
 #define GDB_OPTIONAL
 
 namespace selftests {
@@ -41,7 +41,7 @@ namespace optional {
    copied over from libstdc++'s testsuite.  To preserve the structure
    and help with comparison with the original tests, the file names
    have been preserved, and only minimal modification was done to have
-   them compile against gdb::optional instead of std::optional:
+   them compile against std::optional instead of std::optional:
 
      - std::optional->gdb:optional, etc.
      - ATTRIBUTE_UNUSED in a few places
index f959af3219b7014c85010c3d88b54ecb4cdee45e..7a1841ba21e9ba0651769eab47b984c509cf5c73 100644 (file)
@@ -68,7 +68,7 @@
 #include "gdbsupport/gdb_regex.h"
 #include "gdbsupport/job-control.h"
 #include "gdbsupport/selftest.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "cp-support.h"
 #include <algorithm>
 #include "gdbsupport/pathstuff.h"
@@ -143,7 +143,7 @@ vwarning (const char *string, va_list args)
     (*deprecated_warning_hook) (string, args);
   else
     {
-      gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+      std::optional<target_terminal::scoped_restore_terminal_state> term_state;
       if (target_supports_terminal_ours ())
        {
          term_state.emplace ();
@@ -375,7 +375,7 @@ internal_vproblem (struct internal_problem *problem,
     }
 
   /* Try to get the message out and at the start of a new line.  */
-  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  std::optional<target_terminal::scoped_restore_terminal_state> term_state;
   if (target_supports_terminal_ours ())
     {
       term_state.emplace ();
index f3acf98c98bdbb0913aba83841e5f07c1acb0641..6cf56302aee7af9ce0a7f252265e15c05c18612a 100644 (file)
@@ -150,14 +150,14 @@ value_subscript (struct value *array, LONGEST index)
       || tarray->code () == TYPE_CODE_STRING)
     {
       struct type *range_type = tarray->index_type ();
-      gdb::optional<LONGEST> lowerbound = get_discrete_low_bound (range_type);
+      std::optional<LONGEST> lowerbound = get_discrete_low_bound (range_type);
       if (!lowerbound.has_value ())
        lowerbound = 0;
 
       if (array->lval () != lval_memory)
        return value_subscripted_rvalue (array, index, *lowerbound);
 
-      gdb::optional<LONGEST> upperbound
+      std::optional<LONGEST> upperbound
        = get_discrete_high_bound (range_type);
 
       if (!upperbound.has_value ())
index 70851cd40b4ff6a70b98e87e7341f624eecce46f..a8760ccf3e49206b6fba7dd887e7b1a8ddfee977 100644 (file)
@@ -52,7 +52,7 @@ static struct value *search_struct_field (const char *, struct value *,
                                          struct type *, int);
 
 static struct value *search_struct_method (const char *, struct value **,
-                                          gdb::optional<gdb::array_view<value *>>,
+                                          std::optional<gdb::array_view<value *>>,
                                           LONGEST, int *, struct type *);
 
 static int find_oload_champ_namespace (gdb::array_view<value *> args,
@@ -2196,7 +2196,7 @@ search_struct_field (const char *name, struct value *arg1,
 
 static struct value *
 search_struct_method (const char *name, struct value **arg1p,
-                     gdb::optional<gdb::array_view<value *>> args,
+                     std::optional<gdb::array_view<value *>> args,
                      LONGEST offset, int *static_memfuncp,
                      struct type *type)
 {
@@ -2332,7 +2332,7 @@ search_struct_method (const char *name, struct value **arg1p,
 
 struct value *
 value_struct_elt (struct value **argp,
-                 gdb::optional<gdb::array_view<value *>> args,
+                 std::optional<gdb::array_view<value *>> args,
                  const char *name, int *static_memfuncp, const char *err)
 {
   struct type *t;
index 17b7c53d0522210891ea28ec053ad83d70fd7736..7067ae94df0b25b97fd04e466516e12f605fc71e 100644 (file)
@@ -826,7 +826,7 @@ exceeds_max_value_size (ULONGEST length)
 /* When this has a value, it is used to limit the number of array elements
    of an array that are loaded into memory when an array value is made
    non-lazy.  */
-static gdb::optional<int> array_length_limiting_element_count;
+static std::optional<int> array_length_limiting_element_count;
 
 /* See value.h.  */
 scoped_array_length_limiting::scoped_array_length_limiting (int elements)
index e4912717684b04e17afc7d7df0bf62b0ba1e1a26..6d91e8eee7a99db346c9f71d72f950c27d6ab31f 100644 (file)
@@ -1269,7 +1269,7 @@ extern struct value *value_neg (struct value *arg1);
 extern struct value *value_complement (struct value *arg1);
 
 extern struct value *value_struct_elt (struct value **argp,
-                                      gdb::optional<gdb::array_view <value *>> args,
+                                      std::optional<gdb::array_view <value *>> args,
                                       const char *name, int *static_memfuncp,
                                       const char *err);
 
@@ -1635,7 +1635,7 @@ struct scoped_array_length_limiting
 
 private:
   /* Used to hold the previous array value element limit.  */
-  gdb::optional<int> m_old_value;
+  std::optional<int> m_old_value;
 };
 
 #endif /* !defined (VALUE_H) */
index 205bf01174fe67f32c53b93e746d4d1ade6edd86..b3440344c740c3d56c85a3fcf04fe9aaa2794215 100644 (file)
@@ -1335,7 +1335,7 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
        th->suspend ();
       }
 
-  gdb::optional<unsigned> err;
+  std::optional<unsigned> err;
   do_synchronously ([&] ()
     {
       if (!continue_last_debug_event (continue_status, debug_events))
@@ -1561,7 +1561,7 @@ windows_nat_target::get_windows_debug_event
   /* If there is a relevant pending stop, report it now.  See the
      comment by the definition of "pending_stops" for details on why
      this is needed.  */
-  gdb::optional<pending_stop> stop
+  std::optional<pending_stop> stop
     = windows_process.fetch_pending_stop (debug_events);
   if (stop.has_value ())
     {
@@ -2024,7 +2024,7 @@ windows_nat_target::attach (const char *args, int from_tty)
   windows_init_thread_list ();
   windows_process.saw_create = 0;
 
-  gdb::optional<unsigned> err;
+  std::optional<unsigned> err;
   do_synchronously ([&] ()
     {
       BOOL ok = DebugActiveProcess (pid);
@@ -2074,7 +2074,7 @@ windows_nat_target::detach (inferior *inf, int from_tty)
 {
   windows_continue (DBG_CONTINUE, -1, 0, true);
 
-  gdb::optional<unsigned> err;
+  std::optional<unsigned> err;
   do_synchronously ([&] ()
     {
       if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId))
@@ -2533,7 +2533,7 @@ windows_nat_target::create_inferior (const char *exec_file,
 #endif /* !__CYGWIN__ */
   const char *allargs = origallargs.c_str ();
   PROCESS_INFORMATION pi;
-  gdb::optional<unsigned> ret;
+  std::optional<unsigned> ret;
   DWORD flags = 0;
   const std::string &inferior_tty = current_inferior ()->tty ();
 
index 0c98dc7e6b493b9bfba1b2d4206e902612999d2b..2d231b6f4bba8d308247c75ebf8ee62d49e6343a 100644 (file)
@@ -785,7 +785,7 @@ xinclude_start_include (struct gdb_xml_parser *parser,
     gdb_xml_error (parser, _("Maximum XInclude depth (%d) exceeded"),
                   MAX_XINCLUDE_DEPTH);
 
-  gdb::optional<gdb::char_vector> text = data->fetcher (href);
+  std::optional<gdb::char_vector> text = data->fetcher (href);
   if (!text)
     gdb_xml_error (parser, _("Could not load XML document \"%s\""), href);
 
@@ -960,7 +960,7 @@ show_debug_xml (struct ui_file *file, int from_tty,
   gdb_printf (file, _("XML debugging is %s.\n"), value);
 }
 
-gdb::optional<gdb::char_vector>
+std::optional<gdb::char_vector>
 xml_fetch_content_from_file (const char *filename, const char *dirname)
 {
   gdb_file_up file;
index 1f9ac68b745c4950afdf7c36071f36916a54fbcd..8388276df25f2a991b63fcd356d280bad05125e4 100644 (file)
@@ -24,7 +24,7 @@
 #include "gdbsupport/gdb_obstack.h"
 #include "gdbsupport/xml-utils.h"
 #include "gdbsupport/byte-vector.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/function-view.h"
 
 struct gdb_xml_parser;
@@ -49,7 +49,7 @@ LONGEST xml_builtin_xfer_partial (const char *filename,
 
 /* Callback to fetch a new XML file, based on the provided HREF.  */
 
-using xml_fetch_another = gdb::function_view<gdb::optional<gdb::char_vector>
+using xml_fetch_another = gdb::function_view<std::optional<gdb::char_vector>
                                             (const char * /* href */)>;
 
 /* Append the expansion of TEXT after processing <xi:include> tags in
@@ -230,7 +230,7 @@ ULONGEST gdb_xml_parse_ulongest (struct gdb_xml_parser *parser,
    the text.  If something goes wrong, return an uninstantiated optional
    and warn.  */
 
-extern gdb::optional<gdb::char_vector> xml_fetch_content_from_file
+extern std::optional<gdb::char_vector> xml_fetch_content_from_file
     (const char *filename, const char *dirname);
 
 #endif
index da1211ef8e97005eb95384c51fd8e837616c7801..cfb54347431a264337ae8a36ca34bae755b60b7e 100644 (file)
@@ -314,7 +314,7 @@ syscall_parse_xml (const char *document, xml_fetch_another fetcher)
 static struct syscalls_info *
 xml_init_syscalls_info (const char *filename)
 {
-  gdb::optional<gdb::char_vector> full_file
+  std::optional<gdb::char_vector> full_file
     = xml_fetch_content_from_file (filename,
                                   const_cast<char *>(gdb_datadir.c_str ()));
   if (!full_file)
index a8b0b0566c72935739a80d53ff271607cb5d7af8..daf123af69df2412cfc6aea88033aa9f80215b06 100644 (file)
@@ -663,7 +663,7 @@ tdesc_parse_xml (const char *document, xml_fetch_another fetcher)
 const struct target_desc *
 file_read_description_xml (const char *filename)
 {
-  gdb::optional<gdb::char_vector> tdesc_str
+  std::optional<gdb::char_vector> tdesc_str
     = xml_fetch_content_from_file (filename, NULL);
   if (!tdesc_str)
     {
@@ -687,7 +687,7 @@ file_read_description_xml (const char *filename)
    is "target.xml".  Other calls may be performed for the DTD or
    for <xi:include>.  */
 
-static gdb::optional<gdb::char_vector>
+static std::optional<gdb::char_vector>
 fetch_available_features_from_target (const char *name, target_ops *ops)
 {
   /* Read this object as a string.  This ensures that a NUL
@@ -704,7 +704,7 @@ fetch_available_features_from_target (const char *name, target_ops *ops)
 const struct target_desc *
 target_read_description_xml (struct target_ops *ops)
 {
-  gdb::optional<gdb::char_vector> tdesc_str
+  std::optional<gdb::char_vector> tdesc_str
     = fetch_available_features_from_target ("target.xml", ops);
   if (!tdesc_str)
     return NULL;
@@ -721,7 +721,7 @@ target_read_description_xml (struct target_ops *ops)
    includes, but not parsing it.  Used to dump whole tdesc
    as a single XML file.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 target_fetch_description_xml (struct target_ops *ops)
 {
 #if !defined(HAVE_LIBEXPAT)
@@ -736,7 +736,7 @@ target_fetch_description_xml (struct target_ops *ops)
 
   return {};
 #else
-  gdb::optional<gdb::char_vector>
+  std::optional<gdb::char_vector>
     tdesc_str = fetch_available_features_from_target ("target.xml", ops);
   if (!tdesc_str)
     return {};
@@ -765,6 +765,6 @@ string_read_description_xml (const char *xml)
   return tdesc_parse_xml (xml, [] (const char *href)
     {
       error (_("xincludes are unsupported with this method"));
-      return gdb::optional<gdb::char_vector> ();
+      return std::optional<gdb::char_vector> ();
     });
 }
index 0fbfc7e043e92d26b3a0910dc04e76b7a716533e..0ffca92ed7a37e651161b7a5c0ba304837c7028e 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef XML_TDESC_H
 #define XML_TDESC_H
 
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include <string>
 
 struct target_ops;
@@ -42,7 +42,7 @@ const struct target_desc *target_read_description_xml (struct target_ops *);
    but not parsing it.  Used to dump whole tdesc as a single XML file.
    Returns the description on success, and a disengaged optional
    otherwise.  */
-gdb::optional<std::string> target_fetch_description_xml (target_ops *ops);
+std::optional<std::string> target_fetch_description_xml (target_ops *ops);
 
 /* Take an xml string, parse it, and return the parsed description.  Does not
    handle a string containing includes.  */
index fcbe7bb64d7743c551a629bf4c3b137fe3c9161e..70454652720bb2bda569893bb4dcac826fa1d42f 100644 (file)
@@ -299,7 +299,7 @@ aarch64_fill_tlsregset (struct regcache *regcache, void *buf)
   collect_register (regcache, tls_regnum, tls_buf);
 
   /* Read TPIDR2, if it exists.  */
-  gdb::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
+  std::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
 
   if (regnum.has_value ())
     collect_register (regcache, *regnum, tls_buf + sizeof (uint64_t));
@@ -316,7 +316,7 @@ aarch64_store_tlsregset (struct regcache *regcache, const void *buf)
   supply_register (regcache, tls_regnum, tls_buf);
 
   /* Write TPIDR2, if it exists.  */
-  gdb::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
+  std::optional<int> regnum = find_regno_no_throw (regcache->tdesc, "tpidr2");
 
   if (regnum.has_value ())
     supply_register (regcache, *regnum, tls_buf + sizeof (uint64_t));
index 0b1141662ac692977d526f3d05a304532c0805d1..2e75a948a198834858fc501e11be2d377e1acb9f 100644 (file)
@@ -249,7 +249,7 @@ registers_from_string (struct regcache *regcache, char *buf)
 
 /* See regcache.h */
 
-gdb::optional<int>
+std::optional<int>
 find_regno_no_throw (const struct target_desc *tdesc, const char *name)
 {
   for (int i = 0; i < tdesc->reg_defs.size (); ++i)
@@ -263,7 +263,7 @@ find_regno_no_throw (const struct target_desc *tdesc, const char *name)
 int
 find_regno (const struct target_desc *tdesc, const char *name)
 {
-  gdb::optional<int> regnum = find_regno_no_throw (tdesc, name);
+  std::optional<int> regnum = find_regno_no_throw (tdesc, name);
 
   if (regnum.has_value ())
     return *regnum;
index 7248bcf5808a3880d630a46dda9449908cf45912..4700c03f104e0e30bcee15df4726f3c9d5feb64a 100644 (file)
@@ -112,7 +112,7 @@ int register_size (const struct target_desc *tdesc, int n);
 
 /* No throw version of find_regno.  If NAME is not a known register, return
    an empty value.  */
-gdb::optional<int> find_regno_no_throw (const struct target_desc *tdesc,
+std::optional<int> find_regno_no_throw (const struct target_desc *tdesc,
                                        const char *name);
 
 int find_regno (const struct target_desc *tdesc, const char *name);
index 3246957ec447ddd39b5c685206b7f841a86b4d26..3842c80daff8c9ca9ce3fc402935c9343a34d4c8 100644 (file)
@@ -1019,7 +1019,7 @@ get_child_debug_event (DWORD *continue_status,
 
   windows_process.attaching = 0;
   {
-    gdb::optional<pending_stop> stop
+    std::optional<pending_stop> stop
       = windows_process.fetch_pending_stop (debug_threads);
     if (stop.has_value ())
       {
index 33b15a005f113bf47951ca8f9c7afa3503e02009..8908669696cbf5ebcdf2619dd8f81246d2cb5a30 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef COMMON_COMMON_DEBUG_H
 #define COMMON_COMMON_DEBUG_H
 
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/preprocessor.h"
 
 #include <stdarg.h>
@@ -200,7 +200,7 @@ private:
   const char *m_end_prefix;
 
   /* The result of formatting the format string in the constructor.  */
-  gdb::optional<std::string> m_msg;
+  std::optional<std::string> m_msg;
 
   /* True is a non-nullptr format was passed to the constructor.  */
   bool m_with_format;
index 52e7fd2223fa90a7224e3ddd72466652b6ab3d57..031c2ff500f70a27f822ab5a7f9e6f38571a734b 100644 (file)
@@ -33,7 +33,7 @@
 #include <sys/types.h>
 #include "gdbsupport/gdb_sys_time.h"
 #include "gdbsupport/gdb_select.h"
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "gdbsupport/scope-exit.h"
 
 /* See event-loop.h.  */
@@ -246,7 +246,7 @@ gdb_do_one_event (int mstimeout)
      When the timeout is reached, events are not monitored again:
      they already have been checked in the loop above. */
 
-  gdb::optional<int> timer_id;
+  std::optional<int> timer_id;
 
   SCOPE_EXIT 
     {
@@ -258,7 +258,7 @@ gdb_do_one_event (int mstimeout)
     timer_id = create_timer (mstimeout,
                             [] (gdb_client_data arg)
                             {
-                              ((gdb::optional<int> *) arg)->reset ();
+                              ((std::optional<int> *) arg)->reset ();
                             },
                             &timer_id);
   return gdb_wait_for_event (1);
index 9e61fea1195121d302553516f668d779d941647e..334bae88dce8e2af8361d0f8da50597cc6efc4fe 100644 (file)
@@ -504,7 +504,7 @@ mkdir_recursive (const char *dir)
 
 /* See gdbsupport/filestuff.h.  */
 
-gdb::optional<std::string>
+std::optional<std::string>
 read_text_file_to_string (const char *path)
 {
   gdb_file_up file = gdb_fopen_cloexec (path, "r");
index 48bef51f2593ae89f2b09829ee8f1ef3b69b88fe..206b51e50e9a8b12b7555d9f16cea1a9e79cf3cf 100644 (file)
@@ -131,6 +131,6 @@ extern bool mkdir_recursive (const char *dir);
 
 /* Read the entire content of file PATH into an std::string.  */
 
-extern gdb::optional<std::string> read_text_file_to_string (const char *path);
+extern std::optional<std::string> read_text_file_to_string (const char *path);
 
 #endif /* COMMON_FILESTUFF_H */
index bf591ddf17046475c144453e7af8a0f55a16c75f..0552e1132f0acddbc56a661d7b88c418f105ca66 100644 (file)
@@ -52,9 +52,9 @@
       obj.release ();  // Optional cancel if needed.
 
    forward_scope_exit is also handy when you would need to wrap a
-   scope_exit in a gdb::optional:
+   scope_exit in a std::optional:
 
-      gdb::optional<longjmp_breakpoint_cleanup> cleanup;
+      std::optional<longjmp_breakpoint_cleanup> cleanup;
       if (some condition)
        cleanup.emplace (thread);
       ...
@@ -62,7 +62,7 @@
        cleanup->release ();
 
    since with scope exit, you would have to know the scope_exit's
-   callable template type when you create the gdb::optional:
+   callable template type when you create the std::optional:
 
      gdb:optional<scope_exit<what goes here?>>
 
index 01d6cf0e4fca4f8b55b20df7f76916e2bb490903..3cebce014ad0fd5c78d150aa13b166f9283098e8 100644 (file)
@@ -90,7 +90,7 @@ struct range_chain
     /* The current iterator into one of the vector ranges.  If no
        value then this (outer) iterator is at the end of the overall
        range.  */
-    gdb::optional<typename Range::iterator> m_current;
+    std::optional<typename Range::iterator> m_current;
     /* Vector of ranges.  */
     const std::vector<Range> &m_ranges;
   };
index a3f8361512a03dc570c1e71de0e50f6e5e365b1f..558fb7f0a297a23b1d49f86dc56d98c1c832b994 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef SIGTTOU
 
 /* Simple wrapper that allows lazy initialization / destruction of T.
-   Slightly more efficient than gdb::optional, because it doesn't
+   Slightly more efficient than std::optional, because it doesn't
    carry storage to track whether the object has been initialized.  */
 template<typename T>
 class lazy_init
index 1c871ed378ff77cc4b39553f3af120170fd350d9..bbe043dc0a3bce5110bebc3b4f72aff43d79190c 100644 (file)
@@ -225,7 +225,7 @@ thread_pool::thread_function ()
 
   while (true)
     {
-      optional<task_t> t;
+      std::optional<task_t> t;
 
       {
        /* We want to hold the lock while examining the task list, but
index cb8696e1fa46e29bc546e9899087ebfde86213d7..d5e1dc7fce101a9a2d676c7d3e30caf7444d63d9 100644 (file)
@@ -30,7 +30,7 @@
 #include <condition_variable>
 #include <future>
 #endif
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 
 namespace gdb
 {
@@ -198,7 +198,7 @@ private:
      to represent a task.  If the optional is empty, then this means
      that the receiving thread should terminate.  If the optional is
      non-empty, then it is an actual task to evaluate.  */
-  std::queue<optional<task_t>> m_tasks;
+  std::queue<std::optional<task_t>> m_tasks;
 
   /* A condition variable and mutex that are used for communication
      between the main thread and the worker threads.  */