aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-05-24 13:59:58 -0600
committerTom Tromey <tromey@adacore.com>2023-06-09 07:42:44 -0600
commit894592027535633de9438a8ff1e62d48a64767b6 (patch)
treefa891178476351c3698bf15549f2e441f5657150 /gdb/f-lang.c
parent30711c89cc7dcd2bd4ea772b2f5dc639c5b1cfcc (diff)
downloadgdb-894592027535633de9438a8ff1e62d48a64767b6.zip
gdb-894592027535633de9438a8ff1e62d48a64767b6.tar.gz
gdb-894592027535633de9438a8ff1e62d48a64767b6.tar.bz2
Use scoped_value_mark in two more places
I found a couple of spots that could use scoped_value_mark. One of them is a spot that didn't consider the possibility that value_mark can return NULL. I tend to doubt this can be seen in this context, but nevertheless this is safer. Regression tested on x86-64 Fedora 36.
Diffstat (limited to 'gdb/f-lang.c')
-rw-r--r--gdb/f-lang.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 7ab2a7b..bb17700 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -271,8 +271,8 @@ public:
{
if (inner_p)
{
- gdb_assert (m_mark == nullptr);
- m_mark = value_mark ();
+ gdb_assert (!m_mark.has_value ());
+ m_mark.emplace ();
}
}
@@ -282,9 +282,8 @@ public:
{
if (inner_p)
{
- gdb_assert (m_mark != nullptr);
- value_free_to_mark (m_mark);
- m_mark = nullptr;
+ gdb_assert (m_mark.has_value ());
+ m_mark.reset ();
}
}
@@ -305,9 +304,9 @@ protected:
written. */
LONGEST m_dest_offset;
- /* Set with a call to VALUE_MARK, and then reset after calling
- VALUE_FREE_TO_MARK. */
- struct value *m_mark = nullptr;
+ /* Set and reset to handle removing intermediate values from the
+ value chain. */
+ gdb::optional<scoped_value_mark> m_mark;
};
/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array