On Jun 27, 2022, Alexandre Oliva <ol...@adacore.com> wrote: > On Jun 23, 2022, Jonathan Wakely <jwak...@redhat.com> wrote: >> The attached makes this a bit more efficient, and makes more of the >> code common to the mkstemp and non-mkstmp branches. I'll wait to hear >> back from you before pushing it (since it has Joel's name on the >> patch).
> Thanks, I've given it a spin, both trunk and gcc-11, and I confirm it > works for us. The bad news is that it broke on some other systems I didn't test back then. It turns out the type cast for the ::getpid result was not just because it was passed to printf before :-/ libstdc++: testsuite: cast getpid result On vxworks, in kernel mode, getpid's return type is a pointer type, so std::to_string on it fails overload resolution. Restore the type cast from the original patch that suggested adding the pid. Regstrapped on x86_64-linux-gnu, also tested on aarch64-rtems6.0 and ppc64-vx7r2. I'm going ahead and checking this in as obvious. Please let me know if you'd prefer this to be fixed in a different way. for libstdc++/ChangeLog * testsuite/util/testsuite_fs.h (nonexistent_path): Convert the getpid result to an integral type. --- libstdc++-v3/testsuite/util/testsuite_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index 908fcdbcaeed1..25f8f734dc792 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -163,7 +163,7 @@ namespace __gnu_test file.resize(64); // The combination of random counter and PID should be unique for a given // run of the testsuite. - file += std::to_string(::getpid()); + file += std::to_string((unsigned long) ::getpid()); p = std::move(file); if (test_fs::exists(p)) throw test_fs::filesystem_error("Failed to generate unique pathname", p, -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about <https://stallmansupport.org>