aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-disasm.c
diff options
context:
space:
mode:
authorLancelot Six <lancelot.six@amd.com>2023-10-13 09:27:48 +0000
committerLancelot Six <lancelot.six@amd.com>2023-11-21 11:52:35 +0000
commit6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b (patch)
tree07259601270022a6cbeb89826560262f015e1589 /gdb/python/py-disasm.c
parent6b62451ad08056f0ba02e192ec34ef67c4294ef4 (diff)
downloadbinutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.zip
binutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.gz
binutils-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.bz2
gdb: Replace gdb::optional with std::optional
Since GDB now requires C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optional -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include <optional> This change has mostly been done automatically. One exception is gdbsupport/thread-pool.* which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/python/py-disasm.c')
-rw-r--r--gdb/python/py-disasm.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c
index 6f0fed1..7a13b81 100644
--- a/gdb/python/py-disasm.c
+++ b/gdb/python/py-disasm.c
@@ -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