feat(libc): implement collate<wchar_t>::_Getcat for the C locale #4409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4409"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ahmad3a4 on 2026-10-12T09:48:11Z.
What
std::collate<wchar_t>::_Getcatwas aNotImplementedstub, souse_facet<collate<wchar_t>>(and anything built on it, such as widestd::regexorstd::locale::operator()onwstring) stopped the title.It now does what the narrow
collate<char>::_Getcatalready does: for the C locale it allocates aCollateFacetwithoperator newand returns category 1. Any other locale name throws, as on the narrow side. The facet gets a wide vtable that reuses the narrow destroy, delete, retain and release entries. Guestwchar_tischar16_t:do_compareorders UTF-16 code units lexicographically and returns -1, 0 or 1, the same code-unit order as the narrowmemcmppath.do_transformcopies the range into the guestwstring: inline up to 7 code units, otherwise a(length + 1) * 2byteoperator newblock. The narrow facet's limits apply: embedded nulls throw, and a result whose buffer would reach the 0x1000-byte large-allocation path (2047 code units or more) throws instead of guessing that allocator.do_hashis the narrow FNV-1a over code units, so a single-byte-ASCII string hashes the same in both facets.GuestLocale.hppgainsWideStringandWideCollateVtable, withstatic_asserts on the offsets the guest reads.guest_collatenow also covers the wide facet:_Getcatwith a null and an existing facet, a non-C locale, compare with equal, prefix, accented, non-BMP surrogate and embedded-null ranges, invalid ranges, hash, transform at 0, 5, 7 and 8 code units and at 2046 and 2047, embedded nulls, a null result, and retain, release and delete of the facet.Tested
Windows 11, WinLibs GCC 15.2.0 (UCRT), Release,
BUILD_TESTING=ON, based onmain9aa5fd29: full build and fullctestpass (943 tests, 6 of them skipped by their own environment checks), and the NID patch oflibc.prxsucceeds. Linux not tested. No title or homebrew run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:22:00Z.
Closing: Unblocks is none, and nothing shows a title stopping at
collate<wchar_t>::_Getcaton main; the wide vtable andwstringlayout also come with no source. The code can come back as it is once there is a title ID and its log line.Pull request closed