feat(libc): cover the codecvt, numpunct, num_put and time_put facets, their ids and std::clog #9038
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9038"
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 akkadbakkad89 on 2026-10-21T10:33:43Z.
What
Implements the four Dinkumware facet
_Getcatexports plus the two missing facetidobjects andstd::clog, all evidence-backed by the bundled consolelibc.prxfrom a shipping title'ssce_module(unwrapped withtools/unwrap_self.py, dynsym/NID-resolved, disassembled, and vtable-relocated):codecvt<char,char,_Mbstatet>::_Getcat(zyhiiLKndO8): console builds a bare 0x10-byte facet, category 2. Its virtuals were fully disassembled:always_noconv=true,encoding/max_length=1,in/outcopy the source range pointer through and returnnoconv(3),unshiftreturnsok(0),lengthreturnsmin(last1-first1, count).numpunct<char>::_Getcat(zCB24JBovnQ): console builds a 0x30-byte facet, category 4, with the C-locale table at fixed offsets — grouping""@0x10,'.'@0x18,','@0x19,"false"@0x20,"true"@0x28. The fivedo_*virtuals were disassembled and return guestStrings via the inline-capacity assignment path (vtable order: falsename before truename).num_put<char,...>::_Getcat(hNAh1l09UpA): console allocates a bare 0x10-byte facet, category 4; the formatting virtuals' exact behaviour is not yet proven, so they throwNotImplemented_nid_no_patchby name rather than fabricating output.time_put<char,...>::_Getcat(ec0YLGHS8cw): console allocates a 0xb8-byte facet, category 5, containing a_Locinfo-style time-format table after the facet header; formatting virtuals throw for the same reason.numpunct<char>::id(9iXtwvGVFRI) andtime_put<char,...>::id(BamOsNbUcn4): zeroed 8-bytestd::locale::idobjects matching the console data exports and the existingcollate/num_getids.std::clog(jSquWN7i7lc): zeroed stream storage likecout/cerr/cin.std::wclog(awr1A2VAVZQ): the same zeroed stream storage besidewcerr, completing the eightNSTDSTRslots (cin/cout/cerr/clogand their wide counterparts) thatios_base::_Addstdregisters.All facets use the established
GuestLocale::Facetrefcounted-vtable layout withstatic_assert-pinned offsets, and_Getcatfalls back to the C locale for an unknown locale argument — matching console behaviour, which does not reject by name (unlikecollate::_Getcat); recorded in the debt note.Tested
CheckFacetGetcat()incore/libs/tests/GuestLocale.cpp, now called from the testmain: category values, allocation shapes,codecvtconversion results (noconv/ok/length),numpunctC-locale strings and separators,idobjects, andretain/releaserefcounting. The unimplementednum_put/time_putformatting virtuals still throwNotImplemented_nid_no_patch, but the test no longer pins that behaviour.g++ -fsyntax-onlyonLocaleSupport.cppand the test: clean.LocaleSupport.o: all new checks pass. The pre-existingguest_localestub-harness failure reproduces identically on unmodifiedorigin/main(environmental, not a regression).python3 tools/check_conventions.py --base origin/main: pass.python3 tools/pr_overlap.py --branch feat/libc-facet-getcat: no same-export overlap. #7081 touchesLocaleSupport.cppforsceAmpr*symbols only; #8880 coversnum_get/time_get— disjoint from thisnum_put/time_put/numpunct/codecvtslice. Remaining flags aredocs/dev/debt/libc.mdtail edits.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T11:21:02Z.
CI note:
relinker (windows-latest, g++)failed on a timeout unrelated to this change —shader_cache_native_pathshit its 20 sTIMEOUTproperty (CMakeLists.txt:134); the test is a python/cmake path check incore/shader/recompiler, untouched by this diff (libc prx + locale test + debt doc only).main's own Build run also failed a job in the same window (linux, run 39586562576), so this looks like runner flakiness — a re-run should clear it. All other legs (ubuntu g++, macOS clang++, asan) passed.Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:38:14Z.
Review: COMMENTED
Checked against main
b607bfdc8band the NID calculator, plus MSVC/Dinkumware's<xlocale>/<xlocnum>facet declarations:time_put::idatLocaleSupport.cpp:387still hashes top0ahIkj6K-0rather thanBamOsNbUcn4._ZdlPvdelete, so numpunct's static strings are never freed, which is good.docs/dev/debt/libc.md:138looks like a bad splice: "zeroed as on the consoleing thedestroy/deleteObject/retain/releasebase used forcollate." is a broken sentence, and the clog/id sentence then appears a second time. Could you clean it up?std::wclog. It would help to add both.do_always_noconv, do_max_length, do_encodingand thendo_in, do_out, so if the console uses that order,CodecvtVtable's names at 0x28/0x30 and 0x38/0x40 (and theout == 0x38static_assert) are swapped. Behaviour is unaffected, since each pair shares one function.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T16:37:25Z.
Review: APPROVED
Re-checked head
c89baddeabagainst mainfeb5059ac4:time_put<char>::idis now spelled_ZNSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE(LocaleSupport.cpp:387), which hashes toBamOsNbUcn4, so @oneandonlydean's point is fixed too.std::wclog.CodecvtVtablefollows the MSVC/Dinkumware order (alwaysNoconv,maxLength,encoding,in,out, …), with the 0x38 static_assert onin; behaviour is unchanged since each pair shares one function.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.