feat(libc): implement the std::__sce_v2 time_get virtuals #17568
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17568"
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 Danigamer05 on 2026-11-08T22:29:44Z.
What
Builds on #17539: this branch contains its commits, and through them #17331, #17296, #17277, #16975, #16949, #16944, #16924, #16919, #16560, #16516, #16214, #16178 and #15923, with current
main. It needs none of their code beyond the stream helpers of #16919 and their place inLocaleSupport.cpp, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change.Implement the seven virtuals of
std::__sce_v2::time_get<char>andtime_get<wchar_t>, which_Makelocbuilds andstd::get_timecalls:do_date_order,do_get_time,do_get_date,do_get_weekday,do_get_monthname,do_get_yearand the single-fielddo_get. Before this PR, each of their fourteen slots threwNotImplemented_nid_no_patch. These slots are not exports, so this PR adds no NID.The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6), vtables0x18CC18and0x18D290. It was read from the disassembly of the virtuals (0xDE9C0to0xE02D9and theirwchar_ttwins), of the integer reader (0xE0410), the format reader (0xE0930) and the name matcher (0xD2E50,0xE2F20,0xF0C30). They follow Dinkumware'sxloctime, as its descendant in microsoft/STL does, with this module's differences:std::__sce_v2::_Stolx, whose 32-bit result makes a negative number fail the range check.do_get_timefails as soon as the state is not good, the incoming state included.do_getclears the state first.%creads%a %b %d %H : %M : %S %Y,%xreads day, month and year (%d / %m / %y), and%%takes a percent sign when one is next and never fails.%a,%b,%pand the date readers go through the facet's own virtuals.ctypeof the global locale, taken withlocale::_Init. Awchar_tstream matching thecharAM/PM names lowers only the low byte of each input character, soU+0150matchesP.do_get_yearreads 0 to 68 as 2000 to 2068, 69 to 99 as the 1900s, and three or more digits literally.The name matcher shared with
num_getgains the case-insensitive mode and names of another character type;num_get'sboolnames keep the case-sensitive match. The_Makelocdebt entry no longer liststime_get, and a new entry records the global-locale lookup.Tested
Windows 11, MinGW GCC 15.2, Release, head on top of #17539. Not run on Linux or macOS, not run in a title.
guest_sce_v2_time_getcovers:date_order, andget_timewith an incoming state and missing seconds;get_datein each order, with names,:,,and/;%H,%I,%C,%y,%x,%c,%p,%%,%nand unknown specifiers;underflow;wchar_tnames and the low-byte AM/PM match._Makeloc.tmfields, and the stream buffer: direct room,underflowanduflow, failing reads, and already-ended or held iterators.errnoand everytmfield.get_dateordo_getan end iterator that still has a live buffer. With one, the module's space-skipping loop spins forever once the input ends, and this library's does too.guest_fopen_errorsskipped._Stolx, which is equivalent for these ranges. The other is%I's 12, which the random input rarely reaches; the test catches it.check_conventions,git diff --check: clean. Merges cleanly withmain.pr_overlapreports no open PR with the same functions or conflicting code. It could not compare 48 PRs that conflict withmainon shared files. Of the 4 that touchLocaleSupport.cpp, #9526, #11172, #12518 and #12704, none touchestime_getor the name matcher.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 MarcZX10 on 2026-11-16T23:26:52Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: clarify and correct the format parser’s handling of a trailing
%so it does not read past the format string.What I ran
Reviewed head
136d54fc92440001a93b165ecd5c23845760602ausing the prepared diff and the pinnedrepo_read.pyreader. No build or tests were run in this review.Results
Findings
Blocking
None verified.
Non-blocking
core/libs/prx/libc/src/LocaleSupport.cpp:3944:GetSceV2TimeFormatadvances past%and immediately dereferences the next character without checking whether it is the string terminator. A trailing%in a format string therefore passes\0to the field virtual, which reaches the default failure case. Check for the terminator before dispatching and set the expected failure state. Add a focused case for a format ending in%.Not verified
LocaleSupport.cppand tests were not audited in full.To get this to a good state
Nothing is required. The format-parser point above is optional feedback.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:46:41Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation and its direct tests were reviewed at head
e06d424fb4187b5c7205217e89aa9a92d19b9136; no verified blocking defects were found.What I ran
No commands or tests were run. I read the prepared review materials and source at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Author-reported Windows tests, differential runs, negative controls, and clean merge were not independently run. No tests were run on Linux, macOS, or a physical console. The prepared review materials did not include
files.json;review/README.mdidentifies 14 changed files, all marked included in the file listing. I readdescription.md,commits.md,manifest.json,diff.patch,README.md, the changedLocaleSupport.cpp,GuestLocale.hpp,CMakeLists.txt,GuestSceV2TimeGet.cpp, anddocs/dev/debt/libc.md. The remaining changed test files were not read:GuestSceV2CharFacetVirtuals.cpp,GuestSceV2CodecvtWide.cpp,GuestSceV2CollateMoneypunct.cpp,GuestSceV2Messages.cpp,GuestSceV2MoneyGet.cpp,GuestSceV2MoneyPut.cpp,GuestSceV2NumGetChar.cpp,GuestSceV2NumGetWide.cpp,GuestSceV2NumPutChar.cpp, andGuestSceV2NumPutWide.cpp.To get this to a good state
Nothing is required; the listed test files remain unreviewed.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T17:23:36Z.
Review: COMMENTED
Reviewed — no blocking findings
The time_get implementation and its targeted callers show no verified blocking defect, but the full accumulated branch and reported checks were not independently reviewed or run.
What I ran
Reviewed prepared diff for head
a60d0f386a0d8931358c0549a6a12a8a772d1ce3; no commands or tests were run.Results
Findings
Blocking
None identified in the code read.
Non-blocking
None.
Not verified
The other changed files were not read:
core/libs/prx/libc/CMakeLists.txt,core/libs/tests/GuestSceV2CharFacetVirtuals.cpp,core/libs/tests/GuestSceV2CodecvtWide.cpp,core/libs/tests/GuestSceV2CollateMoneypunct.cpp,core/libs/tests/GuestSceV2Messages.cpp,core/libs/tests/GuestSceV2MoneyGet.cpp,core/libs/tests/GuestSceV2MoneyPut.cpp,core/libs/tests/GuestSceV2NumGetChar.cpp,core/libs/tests/GuestSceV2NumGetWide.cpp,core/libs/tests/GuestSceV2NumPutChar.cpp, andcore/libs/tests/GuestSceV2NumPutWide.cpp. The full contents ofcore/libs/prx/libc/src/LocaleSupport.cppandcore/libs/tests/GuestSceV2TimeGet.cppwere not read. Build/test claims and console behavior were not independently verified.To get this to a good state
Nothing is required. Optional: review the remaining changed files and run the reported checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T17:42:21Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed changes implement the described
std::__sce_v2::time_getvirtuals and add focused tests; no verified blocking defect was found in the inspected implementation.What I ran
Reviewed head
7db0d588f6cff7feea98c843089b1097d28ca27e. No commands or tests were run. The description reports Windows 11/MinGW tests and differential checks; these were author-reported, not run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The review inspected
core/libs/prx/libc/src/LocaleSupport.cpp,core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/include/GuestTime.hpp,core/libs/tests/GuestSceV2TimeGet.cpp, and relevant portions ofreview/diff.patch,review/description.md,review/commits.md, andreview/manifest.json. It did not inspect every changed file in full; the manifest lists additional changed files, andfiles.jsonexclusions were not read. Builds, tests, CI, console behavior, and the claimed differential run were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:12:28Z.
Review: COMMENTED
Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused
GuestSceV2TimeGetfixture passed.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.