Repository navigation
feat(libc): implement the std::__sce_v2 time_put virtuals - #17578
Danigamer05 wants to merge 41 commits into
Conversation
…irtuals for char The facets built by _Makeloc threw NotImplemented from every virtual except the lifecycle slots. The char ctype, numpunct and codecvt facets now answer as the console's libc.prx does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…irtuals for wchar_t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…get-char-20261107
Main removed GuestStringInlineCapacity, GuestStringCapacityMask and GuestStringLargeAllocation from LocaleSupport.cpp, so the versioned facets' strings use GuestLocale::StringInlineCapacity, GuestLocale::StringCapacityMask and GuestStringStorage::Deallocate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…egers, bool and pointers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-facet-virtuals-20261105
Main removed GuestStringInlineCapacity and GuestStringCapacityMask from LocaleSupport.cpp, so AssignSceV2String uses GuestLocale::StringInlineCapacity and GuestLocale::StringCapacityMask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t/libc-sce-v2-num-put-char-20261106
Main removed GuestStringInlineCapacity and GuestStringLargeAllocation from LocaleSupport.cpp, so TakeSceV2String tests GuestLocale::StringInlineCapacity and frees through GuestStringStorage::Deallocate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sce-v2-num-put-wide-20261107 Brings in current main through boykopovar#16516. The templated TakeSceV2String frees through GuestStringStorage::Deallocate, since main removed GuestStringLargeAllocation from LocaleSupport.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sce-v2-num-get-char-20261107
…integers, bool and pointers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ating point Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sce-v2-num-get-wide-floating-20261108 # Conflicts: # docs/dev/debt/libc.md
…floating point Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement do_compare, do_transform and do_hash of collate<char> and collate<wchar_t>, and the nine virtuals of moneypunct<char, Intl> and moneypunct<wchar_t, Intl>, following the libc.prx of PPSA03671. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement do_open, do_get and do_close of messages<char> and messages<wchar_t>, following the libc.prx of PPSA03671: no catalog opens, and do_get returns a copy of the default string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement do_put of a long double and of a digit string for money_put<char> and money_put<wchar_t>, following the libc.prx of PPSA03671: Dinkumware's field writer with this module's character pattern encoding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement do_get for long double and for digit strings in money_get<char> and money_get<wchar_t>, following the PPSA03671 libc.prx: _Getmfld reads the negative pattern of the moneypunct facet byte by byte, matches the symbol, sign, grouped value with its fraction and spaces, and do_get converts the digits with _Stod or widens them into the string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement date_order, get_time, get_date, get_weekday, get_monthname, get_year and the single-field do_get of time_get<char> and time_get<wchar_t>, following the PPSA03671 libc.prx: its integer reader counts spaces as digits and converts with the v2 _Stolx, names match without case through the global locale's ctype, %x reads day first and %% never fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement do_put of time_put<char> and time_put<wchar_t>, following the PPSA03671 libc.prx: it formats "!%<modifier><specifier>" with strftime or wcsftime into a buffer grown by 16, 32, 64 units until the call succeeds, keeps errno, and writes the text after the leading mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
std::int64_t is long on Linux x86-64 and std::llabs returns long long, so std::min could not deduce a single type and LocaleSupport.cpp did not build there. Name std::int64_t explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
The time_put implementation and changed-line coverage were inspected at head c330516; the author-reported Windows tests were not run here, so a formal decision is not justified.
What I ran
- Read the prepared description, commit list, manifest, diff, review-folder file list, and selected changed code and tests through the repository reader.
- No build or test commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Prepared bundle inspection | passed | Head and changed-file list checked |
| Build and tests | not run | Results in the description are author-reported |
Findings
Blocking
None verified in the inspected time_put implementation.
Non-blocking
None.
Not verified
- The full changed-line coverage required by the review-folder README was not completed. In particular, only selected ranges of LocaleSupport.cpp were read; other changed files, including the additional facet implementations and tests, were not audited.
- Build, test, and console behavior were not verified independently.
- Excluded files were not enumerated:
files.jsonis not present in the prepared review folder.
To get this to a good state
Nothing is required.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The changed time_put implementation and its integration are consistent with the stated behavior; no blocking defect was verified.
What I ran
Reviewed head 15cecb5675d3cacd45bf9eb4e47e1c553b323d8e using the prepared diff and pinned repository reader. No commands or tests were run in this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code | passed | Reviewed all changed files listed below |
| Automated checks | not run | Results in the PR description are author reported |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported Windows build, test suite, differential harness and negative controls were not run independently. Linux, macOS and console behavior were not verified. Reviewed all changed files reported in review/manifest.json; no files were excluded by rule.
To get this to a good state
Nothing is required.
A review asked whether a field whose first 768 or more digits are zeros could reach the lost-digit rounding with no kept digit, and bump the leading zero or the decimal point. It cannot: leading zeros in the integer part are not counted, and leading fraction zeros only lower the power, so the first nonzero digit is always kept. Pin that down with 800 integer zeros, 769 fraction zeros before a 1 scaled back by e770, and both together. Counting leading zeros as significant fails two of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A review asked for a test of a moneypunct facet whose currency symbol is empty, since the optional-symbol checks compare the next character with symbol[0]. On a std::basic_string that is the terminating null, so the comparison is defined and an empty symbol simply matches nothing. Check it at the front and at the end of the pattern, with and without showbase, including input left after the value. Failing every empty symbol breaks these cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change at 97e64242db2f52c6b972caa49ed23892d962f571 implements the char and wchar_t time output facets; the inspected implementation and available evidence support merging.
What I ran
No build or tests were run during this review. I read the prepared description, commits, manifest, and diff, then inspected the changed implementation and its output helper and time formatting dependencies at the pinned head. The author reports Windows 11 tests and differential harness runs; those results were not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Change and implementation review | passed | Inspected time output path and dependencies |
| Build and tests | not run | Author-reported results only |
| Changed-file coverage | passed | All 16 changed files were included in the manifest; inspected the implementation, interface layout, time output test, and debt entry |
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the build, tests, harness, or negative control. The author reports those runs in the PR description, but they are not review-run evidence. I did not read every changed file in full; the remaining included files were not individually inspected. No files were excluded by files.json rules (no files.json was present in the review folder as exposed to this review).
To get this to a good state
Nothing is required.
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
ligmaSec
left a comment
There was a problem hiding this comment.
Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused GuestSceV2TimePut fixture passed.
AI-assisted: yes.
What
Builds on #17568: this branch contains its commits, and through them #17539, #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 output helper of #16516 and their place inLocaleSupport.cpp, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change.Implement
do_putofstd::__sce_v2::time_put<char>andtime_put<wchar_t>, which_Makelocbuilds andstd::put_timecalls. Before this PR, their two slots threwNotImplemented_nid_no_patch. These slots are not exports, so this PR adds no NID. With this PR, everycharandwchar_tfacet of_Makelochas its virtuals; theunsigned shortfacets still throw.The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6), vtables0x18CCE0and0x18D310, read from the disassembly ofdo_put(0xE0F10,0xF11B0):!%followed by the modifier and the specifier, or by the specifier alone when the modifier is zero. In thewchar_tfacet each byte is sign-extended. The leading!keeps the result from being empty.strftime, orwcsftimeforwchar_t, into a buffer that grows by 16, 32, 64 and so on units until the call returns nonzero.errnois restored afterwards.wcsftimefills a buffer that is too small with what fits and returns that count, so awchar_tfield longer than 15 units,%cfor one, is written as nothing, as on the console.!go to the output iterator as they are, with nowidenand no fill. A missing or failing stream buffer fails the iterator.wcsftimereturns 0 witherrnoatEINVAL, thewchar_tfacet setsbadbiton the stream and writes nothing. If the stream's exception mask covers the new state, the module throwsios_base::failure; this library throwsNotImplementedthere, recorded in the new debt entry.The
_Makelocdebt entry no longer liststime_put.Tested
Windows 11, MinGW GCC 15.2, Release, head on top of #17568. Not run on Linux or macOS, not run in a title.
guest_sce_v2_time_put:%Y,%dwith a modifier,%%,%n,%Aand%c, which grows thecharbuffer;overflowand into a missing buffer, and the kepterrno;wchar_t%Y,%Band the empty%c._Makeloc.strftimeconversion and%%, and the modifier (none,E,Oor#). It also randomizes everytmfield in and out of range, the stream state,errno, and the output buffer: direct room,overflow, a rejectingoverflow, no buffer, and an already failed iterator.errno.strftimeandwcsftimeredirected to this library's: 900,000 calls over 3 seeds, 0 differences.%Zand%z, where this library prints the guest zone as thestrftimedebt entry describes.guest_fopen_errorsskipped.!. Neither catches the other two, and both are equivalent here. One drops theerrnorestore, which neither function changes on success. The other sizes the buffer 16 and 32 instead of 16 and 48, and no field in the C locale needs more than 31 units.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, feat(libc): export the money_put facet vtable as data #12518 and feat(libc): export the wide time_put facet vtable as data #12704 export the unversionedstd::time_putvtables as zeroed data, different symbols. feat(libc): add std::__sce_v2::_Random_device, _Fiopen and setw #9526 and feat(libc): wire the codecvt<wchar_t,char> facet vtable #11172 do not touchtime_put.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)