feat(libc): implement collate<wchar_t>::_Getcat #3990
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3990"
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 Sam-mon7 on 2026-10-11T20:44:25Z.
What
Implements
std::collate<wchar_t>::_Getcat(libc), which was aNotImplementedstub.charfacet froma546bbef9(collate<char>::_Getcat) is generalised over the character type:GuestLocale::BasicString<TChar>andBasicCollateVtable<TChar>, withString/CollateVtablekept as aliases.do_compare,do_transformanddo_hashare templates; thecharbehaviour is unchanged and the existingguest_collatechecks still pass.wchar_t(char16_t, as elsewhere in libc):do_compareorders units as unsigned values, matching libc'swcscollin the C locale.do_hashis the FNV-1a of the range's bytes, which is what Dinkumware's_Hash_seq((const unsigned char*)first, (last - first) * sizeof(_Elem))gives for both facets; thecharfacet already matches it.do_transformbuilds abasic_string<wchar_t>with the same 0x28-byte layout (7 inline characters) and the same sizing as thecharfacet; it throws on embedded nulls and at the 4096-byte large-allocation threshold (2047 characters), as thecharfacet does at 4095.charexport: returnssize_t(the category, 1) and takesconst locale*(const Implementation* const*).collate<char>entry.Tested
Windows 11, WinLibs GCC 15.2.0 ucrt r7, Release, full build +
ctest -j 8: 836/837 passed. The one failure,guest_sce_net, times out on a host DNS lookup in my environment and does not touch libc locale code.guest_collatenow also covers the wide facet (unsigned ordering above U+00FF, byte-wise hash, inline/heap transform boundary at 7/8 characters, the 2046/2047 size limit, invalid ranges, reference counting and deletion).tools/check_conventions.pypasses.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 MarcZX10 on 2026-10-11T21:03:17Z.
Independent Linux check on PR head
8246a132: configured Release with GCC 12.2.0 andBUILD_TESTING=ON, builtguest_collate_tests, then ranctest --test-dir /tmp/AnyPS5-pr-3990-build -R "^guest_collate$" --output-on-failure. Result: 1/1 passed (0.04 s). This checks the registered test on Linux; it does not validate the Windows-specific layout behavior.Imported from boykopovar/AnyPS5. Originally posted by Sam-mon7 on 2026-10-11T21:13:59Z.
Thanks for checking on Linux!
Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-11T21:21:09Z.
Tested on Linux (CachyOS x86_64, GCC):
guest_collatepasses 100% (covering the new 16-bitwchar_twide facet, unsigned ordering above U+00FF, FNV-1a byte hash, and the inline/heap transform boundary).tools/check_conventions.pypasses clean.Confirms clean behavior on Linux beyond the Windows 11 MinGW environment. LGTM!
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T00:00:35Z.
Closing: same as #2333 and #1982. No title is shown to stop at
collate<wchar_t>::_Getcaton main, and the wide facet hasn't been compared with the console. Reopen with the title ID and the log line when one does.Pull request closed