This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [Windows] Use the standard vsnprintf instead of _vsnprintf
ClosedPublic

Authored by mstorsjo on Jan 25 2022, 1:58 PM.

Details

Summary

In ancient Microsoft C runtimes, there might only have been
a nonstandard _vsnprintf instead of the standard vsnprintf, but
in modern versions (the only ones relevant for libc++), both
are available.

In MinGW configurations built with __USE_MINGW_ANSI_STDIO=1 (as it
is built in CI), vsnprintf provides a more standards compliant
behaviour than what Microsoft's CRT provides, while _vsnprintf retains
the Microsoft C runtime specific quirks.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Jan 25 2022, 1:58 PM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2022, 1:58 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone added inline comments.
libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
15–18

Is this XFAIL related to the "Microsoft C runtime specific quirks" you mention? It could use a comment to explain why we need to XFAIL here.

ldionne accepted this revision.Jan 31 2022, 8:59 AM
ldionne added inline comments.
libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
15–18

Yeah, agreed, but otherwise LGTM.

This revision is now accepted and ready to land.Jan 31 2022, 8:59 AM
mstorsjo added inline comments.Jan 31 2022, 9:06 AM
libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
15–18

Yes, it’s the same kind of quirks.

I have later follow-up patches to sort out exactly what these quirks are and try to make the test runnable in that mode, so I left out those details from this patch though.

But I can leave a fixme comment to make it clear that we’re not done here.