refactor(icu): drop errno saves around guest copies #25945

Merged
LeandroLP23 merged 1 commit from upstream-pr/25945 into main 2026-11-23 00:54:41 +00:00
LeandroLP23 commented 2026-11-22 23:43:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-22T23:43:47Z.


What

Follow-up to #25937, for ICU. Since #21243, GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch and GuestWritable_nid_no_patch restore errno themselves (RestoreErrno in libc/src/General.cpp), so the helpers that save it around them are redundant.

  • Bidi.cpp and CharsetDetection.cpp: the PreservedErrno guard class and the three helpers built on it (CopyInPreservingErrno, CopyOutPreservingErrno, WritablePreservingErrno) are removed. Their callers call the libc functions directly, with the same arguments.
  • ConstrainedFieldPosition.cpp: GuestWritablePreservingErrno is removed the same way. The typed GuestCopyInPreservingErrno and GuestCopyOutPreservingErrno stay, because they take the size from the type, and each becomes one line over GuestPtr, as in #25937.

84 lines removed and 24 added. No change in behaviour.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. ctest -R 'icu|bidi|ucsdet|charset', with its 80 build outputs from tools/select_tests.py targets: 90 of 90 on main 19e5a34a46 and 90 of 90 with this change applied to it. tools/check_conventions.py passes. tools/pr_overlap.py --branch finds no overlap with the 2476 open pull requests.

Not run: Linux and macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5444666738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25945). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-22T23:43:47Z. --- ### What Follow-up to #25937, for ICU. Since #21243, `GuestCopyIn_nid_no_patch`, `GuestCopyOut_nid_no_patch` and `GuestWritable_nid_no_patch` restore `errno` themselves (`RestoreErrno` in `libc/src/General.cpp`), so the helpers that save it around them are redundant. - `Bidi.cpp` and `CharsetDetection.cpp`: the `PreservedErrno` guard class and the three helpers built on it (`CopyInPreservingErrno`, `CopyOutPreservingErrno`, `WritablePreservingErrno`) are removed. Their callers call the libc functions directly, with the same arguments. - `ConstrainedFieldPosition.cpp`: `GuestWritablePreservingErrno` is removed the same way. The typed `GuestCopyInPreservingErrno` and `GuestCopyOutPreservingErrno` stay, because they take the size from the type, and each becomes one line over `GuestPtr`, as in #25937. 84 lines removed and 24 added. No change in behaviour. ### Tested Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. `ctest -R 'icu|bidi|ucsdet|charset'`, with its 80 build outputs from `tools/select_tests.py targets`: 90 of 90 on `main` `19e5a34a46` and 90 of 90 with this change applied to it. `tools/check_conventions.py` passes. `tools/pr_overlap.py --branch` finds no overlap with the 2476 open pull requests. Not run: Linux and macOS. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-22 23:53:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T23:53:57Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed code uses guest-copy helpers that preserve errno, matching the removed guards; no blocking defect was found in the reviewed files.

What I ran

Reviewed head 79e3090899c428f60bbc6fe1e2b511ce21738e28 using the prepared diff and repo_read.py. No tests or other commands were run.

Results

Check Result Note
Diff review passed All three changed files read
Tests not run No independent test run

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports Windows tests and convention checks, but I did not run them. Linux and macOS behavior was not verified. All three changed files listed in the manifest were read; the bundle’s files.json was not available through the reader.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015209447 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25945#pullrequestreview-6015209447). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T23:53:57Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed code uses guest-copy helpers that preserve `errno`, matching the removed guards; no blocking defect was found in the reviewed files. ## What I ran Reviewed head `79e3090899c428f60bbc6fe1e2b511ce21738e28` using the prepared diff and `repo_read.py`. No tests or other commands were run. ## Results | Check | Result | Note | |---|---|---| | Diff review | passed | All three changed files read | | Tests | not run | No independent test run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports Windows tests and convention checks, but I did not run them. Linux and macOS behavior was not verified. All three changed files listed in the manifest were read; the bundle’s `files.json` was not available through the reader. ## To get this to a good state Nothing is required.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!25945
No description provided.