This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix the locale ctype widen tests on Windows
ClosedPublic

Authored by mstorsjo on Mar 4 2022, 9:04 AM.

Details

Summary

On Windows, like on macOS and FreeBSD, widening char(-5) succeeds
and produces L'\u00fb'.

This is the last instance of LIBCXX-WINDOWS-FIXME.

Unfortunately, this one can't be applied quite yet, it exposes
a bug in mingw-w64's btowc, fixed in
https://github.com/mingw-w64/mingw-w64/commit/707c3b81f77dd4d3b7124796a1e3f420b05c39e5. But once the CI environment is updated to a newer version
of the mingw toolchain (which we can do e.g. after LLVM 14.0.0
is released) we'll get this fix included. Putting it up for
review now already so that we can get it reviwed and done, ready
to land once the CI environment is updated.

Diff Detail

Event Timeline

mstorsjo created this revision.Mar 4 2022, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 9:04 AM
mstorsjo requested review of this revision.Mar 4 2022, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 9:04 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante accepted this revision as: Mordante.Mar 7 2022, 11:27 AM

Great that this completes the removal of LIBCXX-WINDOWS-FIXME!
LGTM!

Quuxplusone accepted this revision.Mar 7 2022, 2:17 PM

Sure, LGTM in principle. Please make sure you get a green CI run (or two!) before actually landing this, though. As you say above, that might take a while.

This revision is now accepted and ready to land.Mar 7 2022, 2:17 PM
mstorsjo updated this revision to Diff 420470.Apr 5 2022, 5:49 AM

Rebased, rerunning CI. The CI environment should have been updated to a newer version so that this should pass now.

In the previously failing mingw config, which now is mostly working, another minor difference was uncovered by the switch from old to new style windows testing configs as default (I previously tested it with the old style test configs when testing locally outside of CI).

The mingw implementation of btowc differs in how it widens \x85 compared to Microsoft CRT's implementation of the same function, which hadn't been noticed in test setups with the old test configs.

Therefore, switch widen_many to test using \xfb which is the same as the widen_1 test uses (which tests with char(-5)), which is unambiguous across the Windows implementations of btowc.

@Mordante, can you ack the updated tests, even if the patch itself already was preapproved a couple weeks ago?

Mordante accepted this revision.Apr 5 2022, 9:55 AM

Still LGTM!