diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-03-26 16:32:31 +0100 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-03-26 17:35:02 +0000 |
commit | 65f283df777fd05b5e45d054e457b271d12ec2dc (patch) | |
tree | 8ece2a8c9d06f2448654cd49ae172a608d52141e /gcc | |
parent | 2ac459165021725644e1c17b7dbec973dad13df0 (diff) | |
download | gcc-65f283df777fd05b5e45d054e457b271d12ec2dc.zip gcc-65f283df777fd05b5e45d054e457b271d12ec2dc.tar.gz gcc-65f283df777fd05b5e45d054e457b271d12ec2dc.tar.bz2 |
Change dfs function return type to support gcc 4.8
GCC 4.8 does not handle pair with references correctly. We need to use a
properly typed struct instead.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h: Change dfs function prototype and
declare dfs return type structure.
* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
type.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.h | 8 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.hxx | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 3dab45e..72b96bf 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -596,10 +596,14 @@ private: SegIterator<S> iterator); /* Helper functions for forward resolution (to_canonical_path, to_rib...) */ + struct DfsResult + { + Node &first; + std::string second; + }; // FIXME: Documentation - tl::optional<std::pair<Node &, std::string>> dfs (Node &starting_point, - NodeId to_find); + tl::optional<DfsResult> dfs (Node &starting_point, NodeId to_find); // FIXME: Documentation tl::optional<Rib &> dfs_rib (Node &starting_point, NodeId to_find); }; diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 6b622b8..2c3cba5 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -468,7 +468,7 @@ ForeverStack<N>::resolve_path (const std::vector<S> &segments) } template <Namespace N> -tl::optional<std::pair<typename ForeverStack<N>::Node &, std::string>> +tl::optional<typename ForeverStack<N>::DfsResult> ForeverStack<N>::dfs (ForeverStack<N>::Node &starting_point, NodeId to_find) { auto values = starting_point.rib.get_values (); @@ -498,7 +498,7 @@ ForeverStack<N>::to_canonical_path (NodeId id) // back up to the root (parent().parent().parent()...) accumulate link // segments reverse them that's your canonical path - return dfs (root, id).map ([this, id] (std::pair<Node &, std::string> tuple) { + return dfs (root, id).map ([this, id] (DfsResult tuple) { auto containing_node = tuple.first; auto name = tuple.second; |