feat(libc): implement libc++ istream unformatted input #28728
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28728"
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 Plyxen on 2026-12-03T07:47:34Z.
What
Implements six members of
std::__1::basic_istream<char>that RetroArch's bring-up discussion lists as missing:get(),peek(),read(char*, streamsize),unget(),ignore(streamsize, int)andputback(char).They follow libc++ 17.0.6: the sentry flushes a tied stream first and sets
failbiton a stream that isn't good, the get area is used directly and the buffer'sunderflow,uflow,xsgetnandpbackfailslots are called through the guest vtable,gcountis updated as there, and a buffer that throws setsbadbit.std::__1::ios_base::failurehas no exporter onmain, so a state bit that the guest enabled throughexceptions()throwsstd::runtime_errorafter the bit is stored. The debt fragment says so.Tested
guest_libcxx_istreampasses on Windows 11 (GCC 15.2) and Ubuntu 24.04 under WSL2 (GCC 13.3). It drives each function through a guest-ABI stream and buffer and checks the returned value, the state bits,gcount, the buffer position and which virtual functions were called in which order. The cases include characters of 0x80 and up, a request over the end of the get area, end of file, a missing buffer, tied streams that fail or throw, buffers that throw, enabled exceptions, inaccessible objects, and buffers whoseuflowcallsignoreon the same stream or installs another buffer duringignore.The other
guest_libcxx_*tests andguest_libc_static_importspass too. Not tested: a title. No console measurement.tools/pr_overlap.py --branchreports no overlap. Fourteen PRs that conflict withmaincouldn't be compared (#7447, #7715, #8150, #8965, #12682, #12688, #12700, #12717, #12849, #12965, #16791, #23395, #27164, #28051). They share onlylibc/CMakeLists.txt: I read their changes to it, which are on other lines, and none of their diffs namesbasic_istream.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T07:55:37Z.
Review: APPROVED
Reviewed — looks good
The implementation and wiring are sound at the reviewed head, with no blocking findings.
What I ran
Reviewed head
476fd4b8375dbcaf24c458bbbbb0c1209d1da61cin the Linux review environment; no build or test toolchain was used.The reader returned the requested output, then exited with an error when it tried to append its audit log in the read-only run folder. I also inspected the prepared diff and included file text. No tests were run.
Results
Negative control
Not run; no tests were executed.
Findings
Blocking
None.
Non-blocking
None.
Sources
The stream operations, state handling, and guest buffer calls are in LibcxxIstream.cpp at the reviewed commit. The new source is registered in the libc CMake source list, and the test fragment is included by the existing CMake glob.
Not verified
The author reports passing guest tests on Windows 11 and Ubuntu 24.04 under WSL2; I did not run them. Console behavior was not measured. I read all seven files listed under
reviewedinfiles.json; that list contains no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T07:57:11Z.
Review: COMMENTED
Actionable comments
ignore's loop bound and increment.ignoreextraction.unitbufsuffix its own failing sync.core/libs/tests/GuestLibcxxIstream.cpp, lines343–346· 📐 Maintainability & Code Quality · ⚡ Quick winsyncResultto-1makes the first sync fail.Flushthen seesBadBitand skips the suffix, so this case would pass even if the suffix stopped recording failures. Keep this first-sync case and add a case where the first sync returns0and the second returns-1. Assert two calls,BadBiton the tied stream, and successful input.26b1f727-f0a6-470f-b9b1-956016542e9bReviewing files that changed from the base of the PR and between
b97867d3ceand476fd4b837.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/LibcxxIstream.hppcore/libs/prx/libc/libc.hppcore/libs/prx/libc/src/LibcxxIstream.cppcore/libs/prx/libc/tests/cmake/guest_libcxx_istream.cmakecore/libs/tests/GuestLibcxxIstream.cppdocs/dev/debt/changes/feat-libc-libcxx-istream.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T07:59:42Z.
Review: COMMENTED
The new libc++ istream fixture passed in a standalone Linux build linked with the repository libc and libkernel. It covers all six input operations, tied-stream handling, streambuf exceptions and exception masks, and invalid guest buffers.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T08:59:33Z.
Review: COMMENTED
Actionable comments
f05d16d1-fee2-49d1-9800-a7920b7e3ca2Reviewing files that changed from the base of the PR and between
476fd4b837and3f79dcfa5e.core/libs/prx/libc/src/LibcxxIstream.cppcore/libs/tests/GuestLibcxxIstream.cppdocs/dev/debt/changes/feat-libc-libcxx-istream.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:09:23Z.
Review: COMMENTED
Retested
3f79dcfa5e54on Linux. The fullGuestLibcxxIstreamfixture passed, including both newignorecallback cases. One reenters the stream and resets the count, and the other replaces the stream buffer during extraction. The existing state-bit and stream-buffer exception cases also passed.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T09:21:59Z.
Review: APPROVED
Reviewed — looks good
The implementation and all seven reviewed files support merging at head
3f79dcfa5e542d1f49eb1b6130fadfcb442bc787.What I ran
Read the prepared description, commits, diff, manifest, and every changed file listed under
reviewedinfiles.json. Inspected the implementation and test cases; no build or test command was run. The author reports the tests passed, but I did not verify that run.Commands used:
Results
Negative control
Not run; no negative-control change was made.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Tests reported by the author, console behavior, and performance were not independently verified. Read:
core/libs/prx/libc/CMakeLists.txt,core/libs/prx/libc/include/LibcxxIstream.hpp,core/libs/prx/libc/libc.hpp,core/libs/prx/libc/src/LibcxxIstream.cpp,core/libs/prx/libc/tests/cmake/guest_libcxx_istream.cmake,core/libs/tests/GuestLibcxxIstream.cpp, anddocs/dev/debt/changes/feat-libc-libcxx-istream.md. No files were excluded by the review manifest.To get this to a good state
Nothing is required.