From: Andrew Pinski <[email protected]>
open_memstream is a POSIX call which is not available on mingw platform.
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (generate_tree_str): Remove opem_memstream
and print_generic_stmt call with call to dump_generic_node.
Signed-off-by: Andrew Pinski <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/6e146f812266b6e39e68d322623a6e538b1f81e3
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4487
gcc/rust/typecheck/rust-tyty.cc | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 161c15e78..e27577e31 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -3517,18 +3517,9 @@ ParamType::is_implicit_self_trait () const
static std::string
generate_tree_str (tree value)
{
- char *buf = nullptr;
- size_t size = 0;
-
- FILE *stream = open_memstream (&buf, &size);
- if (!stream)
- return "<error>";
-
- print_generic_stmt (stream, value, TDF_NONE);
- fclose (stream);
-
- std::string result = (buf ? std::string (buf, size) : "<error>");
- free (buf);
+ pretty_printer pp;
+ dump_generic_node (&pp, value, 0, TDF_NONE, true);
+ std::string result = pp_formatted_text (&pp);
if (!result.empty () && result.back () == '\n')
result.pop_back ();
base-commit: 954d47464f8beb7ac820b7cb0780f0156e75a8f0
--
2.53.0