Hello, Attached is a patch for fixing build issues on *-w64-mingw32. Please check and update at your leisure.
'gcc/system.h' contains a macro called `mkdir()` and there is no need to invoke `_mkdir()` within a conditional block.
-- Best regards, LIU Hao
diff --git a/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
b/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
index 5daa7eb8ded..aff0c372789 100644
--- a/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
+++ b/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
@@ -28,13 +28,7 @@ void
mkdir_wrapped (const std::string &dirname)
{
int ret;
-#ifdef _WIN32
- ret = _mkdir (dirname.c_str ());
-#elif unix
ret = mkdir (dirname.c_str (), 0775);
-#elif __APPLE__
- ret = mkdir (dirname.c_str (), 0775);
-#endif
(void) ret;
}
diff --git a/gcc/rust/expand/rust-proc-macro.cc
b/gcc/rust/expand/rust-proc-macro.cc
index 09680733e98..3518bffaf03 100644
--- a/gcc/rust/expand/rust-proc-macro.cc
+++ b/gcc/rust/expand/rust-proc-macro.cc
@@ -102,6 +102,7 @@ static_assert (
} // namespace
+#ifndef _WIN32
template <typename Symbol, typename Callback>
bool
register_callback (void *handle, Symbol, std::string symbol_name,
@@ -125,6 +126,7 @@ register_callback (void *handle, Symbol, std::string
symbol_name,
#define REGISTER_CALLBACK(HANDLE, SYMBOL, CALLBACK)
\
register_callback (HANDLE, SYMBOL, #SYMBOL, CALLBACK)
+#endif // _WIN32
const ProcMacro::ProcmacroArray *
load_macros_array (std::string path)
diff --git a/gcc/rust/parse/rust-parse.cc b/gcc/rust/parse/rust-parse.cc
index 504a409cc4d..b78ac524f61 100644
--- a/gcc/rust/parse/rust-parse.cc
+++ b/gcc/rust/parse/rust-parse.cc
@@ -89,7 +89,7 @@ extract_module_path (const AST::AttrVec &inner_attrs,
// Source: rustc compiler
//
(https://github.com/rust-lang/rust/blob/9863bf51a52b8e61bcad312f81b5193d53099f9f/compiler/rustc_expand/src/module.rs#L174)
#if defined(HAVE_DOS_BASED_FILE_SYSTEM)
- path.replace ('/', '\\');
+ std::replace(path.begin(), path.end(), '/', '\\');
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
return path;
OpenPGP_signature.asc
Description: OpenPGP digital signature
