Repository navigation
Conversation
…t<wchar_t>::put Each num_put<wchar_t>::put overload and time_put<wchar_t>::put(spec, mod) returns do_put through the facet's own vtable with the 16-bit fill. The pattern overload narrows through the stream's ctype<wchar_t>, copies ordinary characters to the wide stream buffer and calls do_put for each conversion, as the Dinkumware code in the first microsoft/STL commit does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for your contribution! Authors with no pull requests merged into |
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run this test on pull requests.
AI-assisted: yes. |
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements ten
libSceLibcInternalexports that threw throughNotImplemented_nid_no_patchonmain: the publicputmembers ofstd::num_put<wchar_t>andstd::time_put<wchar_t>(theostreambuf_iterator<wchar_t>instantiations), whichstd::wostreaminserters for numbers andstd::put_timeon a wide stream reach through the stream's facets. It is thewchar_tcounterpart of #15715 and is independent of it: no shared new file, no shared lines.mainnum_put<wchar_t>::put(..., bool)(...3putES3_RSt8ios_basewb)mY9FWooxqJYsceLibcInternalPending3_129(Err.cpp)do_put(bool)num_put<wchar_t>::put(..., long)(...basewl)USLhWp7sZoUsceLibcInternalPending3_132do_put(long)num_put<wchar_t>::put(..., unsigned long)(...basewm)qtpzdwMMCPcsceLibcInternalPending3_133do_put(unsigned long)num_put<wchar_t>::put(..., long long)(...basewx)ryykbHJ04CwsceLibcInternalPending3_134do_put(long long)num_put<wchar_t>::put(..., unsigned long long)(...basewy)lmb3oBpMNPUsceLibcInternalPending3_135do_put(unsigned long long)num_put<wchar_t>::put(..., double)(...basewd)V7aIsVIsIIAsceLibcInternalPending3_130do_put(double)num_put<wchar_t>::put(..., long double)(...basewe)vCIFGeI6adIsceLibcInternalPending3_131do_put(long double)num_put<wchar_t>::put(..., const void*)(...basewPKv)xfOSCbCiY44sceLibcInternalPending3_128do_put(const void*)time_put<wchar_t>::put(..., const tm*, char, char)(...basewPK2tmcc)Nt6eyVKm+Z4sceLibcInternalPending4_072(Export.cpp)do_put(spec, mod)time_put<wchar_t>::put(..., const tm*, const wchar_t*, const wchar_t*)(...basewPK2tmPKwSB_)Sc0lXhQG5KosceLibcInternalPending4_071Where the behaviour comes from:
num_put::putasReturns: do_put(out, str, fill, val)., and [locale.time.put.members] the(spec, mod)overload asReturns: do_put(s, str, fill, t, format, modifier).The Dinkumware templates in the first microsoft/STL commit219514876ea8, which servecharandwchar_talike, write them the same way:return do_put(_Dest, _Iosbase, _Fill, _Val);(stl/inc/xlocnumL1189-L1227) andreturn do_put(_Dest, _Iosbase, _Fill, _Pt, _Specifier, _Modifier);(stl/inc/xloctimeL680-L683).do_putis virtual, so each export calls the slot of the facet's own vtable. Thewchar_tfacets have the same slot order as thecharones already static_asserted onmain(NumPutVtable0x20 to 0x58,TimePutVtable::put0x20); only the fill differs, a 16-bitwchar_t(GuestLocale::WideNumpunctFacetonmainalready usesstd::uint16_tfor it).GuestLocale::WideNumPutVtableandGuestLocale::WideTimePutVtablegive those slots that fill type, with static_asserts.stl/inc/xloctimeL646-L678):use_facet<ctype<wchar_t>>(_Iosbase.getloc()), then for each characterif (_Ctype_fac.narrow(*_Fmtfirst) != '%')copies it; a trailing%is copied;E,O,Qand#after%are modifiers, and a modifier at the end is copied as the original percent followed by the narrowed modifier (*_Dest++ = _Percent; *_Dest++ = _Specifier;); every other specifier goes todo_put(_Dest, _Iosbase, _Fill, _Pt, _Specifier, _Modifier), whose returned iterator is used for the rest of the pattern. It isLibcWideTimePutPattern_nid_no_patchinlibc'sLocaleSupport.cpp, declared inGuestLocale.hpp(the feat(libSceLibcInternal): implement the numpunct<char> members #14373 pattern; no newlibcexport), because it useslibc's existingFindFacetlookup by_ZNSt5ctypeIwE2idE. The export inlibSceLibcInternalcalls it.do_narrow(c, '\0'), the eleventhctype<wchar_t>virtual in the same commit's declaration order (do_isx2,do_scan_is,do_scan_not,do_tolowerx2,do_toupperx2,do_widenx2,do_narrowx2,stl/inc/xlocaleL2940-L3036), withnarrow(_Elem _Ch, char _Dflt = '\0'). After the four facet slots that is vtable offset 0x70, which matches the 18 slots of_ZTVSt5ctypeIwEonmain(2 header + 4 facet + 12).GuestLocale::WideCtypeVtablerecords it with static_asserts (widen0x60,narrow0x70,narrowRange0x78).ctype<wchar_t>facet (the classic locale has none inlibcand there is noctype<wchar_t>::_Getcat), the pattern is narrowed aslibc's existingwctobdoes (unit < 0x80 ? unit : -1), a non-narrowable character giving the'\0'default. Dinkumware's classicctype<wchar_t>::_Donarrowlikewise converts through the C locale and returns the default when the character has no single-byte form.ostreambuf_iterator<wchar_t>::operator=does (if (!_Strbuf || traits_type::eq_int_type(_Traits::eof(), _Strbuf->sputc(_Right))) { _Failed = true; },stl/inc/streambufL555-L561): into the 16-bit put area while it has room, otherwise throughoverflow, whose-1is theWEOFthatlibc's wide functions already use (GuestRune::Weof = 0xffffffff,fputwcreturning-1). A null or failing buffer setsfailedand later characters are still offered. This is the same shape aslibc's existingPutCharacterforchar._Is_valid_strftime_specifierchecks that write?; that is a later MSVC change, not Dinkumware's, so every specifier goes todo_put, as in219514876ea8and the standard.The ten stubs are removed from
Err.cppandExport.cpp; the new exports are incore/libs/prx/libSceLibcInternal/FacetPutWide.cpp. The debt file drops their ten "prototype and behavior are unverified" lines and gets one entry for what stays unverified: the console'slibSceLibcInternal.sprxwas not read and no title was seen calling them.tools/progress.pycollect_libraries()onorigin/mainb11c7bf84fand on this branch:libSceLibcInternaldone 92 -> 102 (+10), todo 1045 -> 1035 (-10), no new todo name; every other library unchanged. The repository total goes from 9921 to 9931 done of 37146, so +10 done and no new todo.Tested
guest_libc_internal_facet_put_wide(core/libs/tests/GuestLibcInternalFacetPutWide.cpp). It resolves the ten exports by their NID export names (<NID>_nid_no_patch_cut) from the builtlibSceLibcInternal.prx, so the same test runs againstmain's stubs:num_put<wchar_t>::putcalls thedo_putslot of its own value type on a recording vtable, passes the facet, stream, iterator, the value (INT64_MIN,UINT64_MAX,0x8000000000000001,-2.5,1.0L / 3.0L, a pointer) and a fill of U+263A (outside 8 bits, so a truncated fill would fail), writes nothing itself and returns whatdo_putreturned.time_put<wchar_t>::put(spec, mod)callsdo_putonce with its arguments and the wide fill and returns its iterator.do_put: empty and plain patterns (with U+263A kept as is),a%Yb%Ec%Od%%e(four calls, in order,%%going todo_put),Qand#modifiers, unknown and null specifiers, trailing%and%E,%EE, U+FF05 and other non-ASCII characters copied rather than taken as%without actype<wchar_t>, a non-narrowable specifier reachingdo_putas'\0', and a failed iterator returned bydo_putcarried through the rest of the pattern.ctype<wchar_t>whosedo_narrowis at 0x70: U+FF05 narrows to%, U+00C9 toE, U+00F0 tod,%top; it is called once per examined character with a null default, literal characters keep their wide value, and a trailing U+FF05 U+00C9 is copied as U+FF05E.overflow; a buffer whoseoverflowreturns-1after two characters marks the iterator failed while all five characters are still offered; a null buffer marks it failed.9f56f59a62:guest_libc_internal_facet_put_wide,guest_locale(thelibclocale code changed here),debt_splitand 39conventions_*tests (the last 40 are checker self-tests oftools/check_conventions.pyand the debt-file splitter, not tests of this change) were run 3 times withctest -j2; 42/42 passed each time (126/126). The other two checker self-tests,conventions_wrapped_declarationsandconventions_wrapped_declarations_AbiAliasTests, were run 3 times on their own: 5 of the 6 runs passed (21-29 s); the thirdconventions_wrapped_declarationsrun hit the test's 30 s ctest timeout on this loaded machine and passed on a fourth run in 22 s.conventions_wrapped_declarationsself-tests) were run 3 times withctest -j2; 44/44 passed each time (132/132).main'sErr.cpp,Export.cppandLocaleSupport.cpp,FacetPutWide.cpptaken out of the build, and this PR's test (with this PR'sGuestLocale.hpp, which only adds the vtable layouts the test uses) build, and the test fails:terminate called after throwing an instance of 'std::runtime_error',what(): sceLibcInternalPending3_129_nid_no_patch not implemented(the first export it calls,put(bool)).python3 tools/check_conventions.py --base origin/mainprinted "All conventions checks passed."python3 tools/pr_overlap.py --branch feat/r3-numput-wchar-putprobed 1822 open PRs againstmainb11c7bf84fand failed closed. Its table lists only neighbouring lines, no same exports and no same new files: feat(libSceLibcInternal): construct and destroy _Locinfo and copy _Locimp as base objects #14660 (libSceLibcInternal/CMakeLists.txtL76, where this PR addsFacetPutWide.cppand its test beforeInet.cpp) and feat(libSceLibcInternal): implement the error category names and codecvt_base queries #15696 (debt file L533, near this PR's new entry). It could not compare feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, fix(libs): share Sony CRT handler and lconv state between libc and libSceAmpr #7081, feat(libc): add std::__sce_v2::_Random_device, _Fiopen and setw #9526, feat(libc): export the messages facet vtable as data #10158, fix(libc): size the codecvt facet vtable to 104 bytes #10165, feat(libc): export the numpunct facet vtable as data #10200, feat(libc): export the time_put facet vtable as data #12510, feat(libc): export the money_get facet vtable as data #12511, feat(libc): export the money_put facet vtable as data #12518, feat(libc): export the wide time_put facet vtable as data #12704, fix(relinker): match AppContent utility import to provider #13486, feat(libSceLibcInternal): implement the msun trigonometric kernels #13778, feat(libSceLibcInternal): implement floating-point word access #13782, docs(debt): separate entries with blank lines and drop derived export totals #14212, feat(libSceLibcInternal): implement zero-return showmanyc exports #14401, feat(libSceLibcInternal): implement the placement operator delete and delete[] #14837 and feat(libSceLibcInternal): implement std::_MP_Add, _MP_Get, _MP_Mul and _MP_Rem #14936. I took the diff of all 19 (gh pr diff; for feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, which is too large for that, thelibSceLibcInternal,LocaleSupportandGuestLocalefile patches from the pull request files API) and searched every added and removed line for the ten NIDs, thenum_put/time_putwchar_t3putmangled names, the ten stub names (Pending3_128-Pending3_135,Pending4_071,Pending4_072),LibcWideTimePutPattern,PutWideCharacter,NarrowWide,WideNumPutVtable,WideTimePutVtable,WideCtypeVtableandFacetPutWide. None has a hit (0 lines in each of the 19), so none implements these functions or edits the stub lines this PR removes. Whichever of the neighbouring PRs merges second needs a rebase.git merge-treemerges this branch without conflicts intob11c7bf84f, into feat(libSceLibcInternal): implement num_put<char>::put and time_put<char>::put #15715 (feat/r2-numput-char-put) and into feat(libc): implement the ctype<char> widen and narrow members #15714 (feat/r2-ctype-char-widen).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)🤖 Generated with Claude Code