On Tue, 5 Jul 2022 at 10:10, Alexandre Oliva via Libstdc++ <libstd...@gcc.gnu.org> wrote: > > 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 :-/
Ah, whoops. I did check that POSIX requires pid_t to be a signed integer type, but that doesn't mean it's always true for all GCC targets. > > > 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. The cast itself is fine, but I'd like a comment like "N.B. pid_t is a pointer on vxworks" so I don't "simplify" it again. Thanks.