feat(libSceLibcInternal): construct the wide num_put facet #24884

Merged
0x70776c merged 1 commit from upstream-pr/24884 into main 2026-11-22 17:38:32 +00:00
0x70776c commented 2026-11-21 09:04:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 0x70776c on 2026-11-21T09:04:35Z.


What

Implements num_put<wchar_t>::_Getcat (_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetEPKS5_, NID 6iDi6e2e4x8) and num_put<wchar_t>::num_put(const _Locinfo&, size_t) (_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2ERKSt8_Locinfom, NID 0Pd-K5jGcgM) in NumPutField.cpp, updates declarations in InventoryExports6.hpp, removes their stubs from InventoryExports6.cpp, and updates technical debt via feat-libcinternal-wide-num-put-ctor.md.

Constructed facets install a local WideNumPutVtable with real destroy/delete/retain/release reference-counting slots while forwarding all eight do_put slots to the existing throwing exports (so Err.cpp stays untouched).

Tested

Fedora Linux 43 (7.3.3-100.fc43.x86_64), GCC 15.3.1, Release build (BUILD_TESTING=ON):

  • Added CheckWideNumPutConstruction() in GuestLibcInternalFacetPut.cpp (signature static_assert, constructor null guards, _Getcat numeric category 4, existing vs empty slot construction, and retain/release/deleteObject lifecycle).
  • ctest --test-dir build -R '^(guest_libc_internal_facet_put|public_headers)$' -V: 2/2 passed.
  • python3 tools/check_conventions.py --base origin/main: All conventions checks passed.
  • python3 tools/debt_fold.py --check: passed.
  • python3 tools/pr_overlap.py: open: none on both symbols.

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:5426251979 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884). Originally posted by [0x70776c](https://github.com/0x70776c) on 2026-11-21T09:04:35Z. --- ### What Implements `num_put<wchar_t>::_Getcat` (`_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE7_GetcatEPPKNSt6locale5facetEPKS5_`, NID `6iDi6e2e4x8`) and `num_put<wchar_t>::num_put(const _Locinfo&, size_t)` (`_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2ERKSt8_Locinfom`, NID `0Pd-K5jGcgM`) in [NumPutField.cpp](core/libs/prx/libSceLibcInternal/NumPutField.cpp), updates declarations in [InventoryExports6.hpp](core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp), removes their stubs from [InventoryExports6.cpp](core/libs/prx/libSceLibcInternal/InventoryExports6.cpp), and updates technical debt via [feat-libcinternal-wide-num-put-ctor.md](docs/dev/debt/changes/feat-libcinternal-wide-num-put-ctor.md). Constructed facets install a local `WideNumPutVtable` with real `destroy`/`delete`/`retain`/`release` reference-counting slots while forwarding all eight `do_put` slots to the existing throwing exports (so `Err.cpp` stays untouched). ### Tested Fedora Linux 43 (`7.3.3-100.fc43.x86_64`), GCC `15.3.1`, Release build (`BUILD_TESTING=ON`): - Added `CheckWideNumPutConstruction()` in [GuestLibcInternalFacetPut.cpp](core/libs/tests/GuestLibcInternalFacetPut.cpp) (signature `static_assert`, constructor null guards, `_Getcat` numeric category 4, existing vs empty slot construction, and `retain`/`release`/`deleteObject` lifecycle). - `ctest --test-dir build -R '^(guest_libc_internal_facet_put|public_headers)$' -V`: 2/2 passed. - `python3 tools/check_conventions.py --base origin/main`: All conventions checks passed. - `python3 tools/debt_fold.py --check`: passed. - `python3 tools/pr_overlap.py`: `open: none` on both symbols. ### Checklist - [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
PrivacyOnion commented 2026-11-21 09:05:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T09:05:56Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against d634d762b5:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_facet_put_tests built cleanly.
  • CTest (guest_libc_internal_facet_put):
    1/1 Test #4468: guest_libc_internal_facet_put ....   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/NumPutField.cpp, core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified num_put<wchar_t>::num_put constructor argument validation and field initialization (self, info, refs split into references and reserved) in NumPutField.cpp:133-139
    • Verified num_put<wchar_t>::_Getcat numeric category 4 return and allocation logic when facet is non-null and *facet is null in NumPutField.cpp:141-149
    • Verified WideNumPutVtable struct layout, offsets, and virtual function dispatch signatures matching Dinkumware / libc specifications in NumPutField.cpp:18-32
    • Verified facet reference counting lifecycle routines (DestroyWideNumPutFacet, DeleteWideNumPutFacet, RetainWideNumPutFacet, ReleaseWideNumPutFacet) with std::atomic_ref in NumPutField.cpp:34-48
    • Verified InventoryExports6.hpp/cpp symbol signature updates, removal of NotImplemented stubs, and technical debt fragment docs/dev/debt/changes/feat-libcinternal-wide-num-put-ctor.md
    • Verified comprehensive unit test coverage in GuestLibcInternalFacetPut.cpp for static assertions, null checks, retain/release lifecycle, and _Getcat slot behavior

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004302328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884#pullrequestreview-6004302328). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T09:05:56Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `d634d762b5`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_facet_put_tests` built cleanly. - **CTest** (`guest_libc_internal_facet_put`): ``` 1/1 Test #4468: guest_libc_internal_facet_put .... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/NumPutField.cpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified num_put<wchar_t>::num_put constructor argument validation and field initialization (self, info, refs split into references and reserved) in NumPutField.cpp:133-139 - Verified num_put<wchar_t>::_Getcat numeric category 4 return and allocation logic when facet is non-null and *facet is null in NumPutField.cpp:141-149 - Verified WideNumPutVtable struct layout, offsets, and virtual function dispatch signatures matching Dinkumware / libc specifications in NumPutField.cpp:18-32 - Verified facet reference counting lifecycle routines (DestroyWideNumPutFacet, DeleteWideNumPutFacet, RetainWideNumPutFacet, ReleaseWideNumPutFacet) with std::atomic_ref in NumPutField.cpp:34-48 - Verified InventoryExports6.hpp/cpp symbol signature updates, removal of NotImplemented stubs, and technical debt fragment docs/dev/debt/changes/feat-libcinternal-wide-num-put-ctor.md - Verified comprehensive unit test coverage in GuestLibcInternalFacetPut.cpp for static assertions, null checks, retain/release lifecycle, and _Getcat slot behavior Looks Good To Me
MarcZX10 commented 2026-11-21 09:24:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T09:24:32Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: make _Getcat clean up its allocation if facet initialization throws.

What I ran

Reviewed head d634d762b54918b6a2696bccdb5520dd10a93224. No commands or tests were run; the build and checks described in the PR are author-reported.

Results

Check Result Note
Source review passed Changed implementation and context read
Automated checks not run Author-reported results only

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/NumPutField.cpp:145 — _Getcat allocates the facet, then calls the constructor before storing it in *facet. If the constructor throws (for example, if initialization later rejects the locale info), the allocation is leaked. Use a scope guard like the existing wide time_get::_Getcat implementation so the allocation is freed on exceptions.

Non-blocking

None.

Not verified

  • No build, tests, convention check, debt check, or overlap check was run; the listed results in the description are not independently verified.
  • Console behavior and the ABI against libSceLibcInternal.sprx were not verified; the debt note also records this limitation.
  • Read: NumPutField.cpp, InventoryExports6.hpp, GuestLocale.hpp, LocaleSupport.cpp, TimeGetFields.cpp, CodecvtChar.cpp, GuestLibcInternalFacetPut.cpp, description.md, commits.md, manifest.json, and diff.patch. All changed files listed in manifest.json were included; no changed file was excluded by rule.

To get this to a good state

  • Add exception-safe cleanup around the _Getcat allocation, then rerun the reported build, tests, and checks on the updated head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004366590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884#pullrequestreview-6004366590). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T09:24:32Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: make `_Getcat` clean up its allocation if facet initialization throws. ## What I ran Reviewed head `d634d762b54918b6a2696bccdb5520dd10a93224`. No commands or tests were run; the build and checks described in the PR are author-reported. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed implementation and context read | | Automated checks | not run | Author-reported results only | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/NumPutField.cpp:145` — `_Getcat` allocates the facet, then calls the constructor before storing it in `*facet`. If the constructor throws (for example, if initialization later rejects the locale info), the allocation is leaked. Use a scope guard like the existing wide `time_get::_Getcat` implementation so the allocation is freed on exceptions. ### Non-blocking None. ## Not verified - No build, tests, convention check, debt check, or overlap check was run; the listed results in the description are not independently verified. - Console behavior and the ABI against `libSceLibcInternal.sprx` were not verified; the debt note also records this limitation. - Read: `NumPutField.cpp`, `InventoryExports6.hpp`, `GuestLocale.hpp`, `LocaleSupport.cpp`, `TimeGetFields.cpp`, `CodecvtChar.cpp`, `GuestLibcInternalFacetPut.cpp`, `description.md`, `commits.md`, `manifest.json`, and `diff.patch`. All changed files listed in `manifest.json` were included; no changed file was excluded by rule. ## To get this to a good state - Add exception-safe cleanup around the `_Getcat` allocation, then rerun the reported build, tests, and checks on the updated head.
MarcZX10 commented 2026-11-21 09:30:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T09:30:53Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the implementation and its targeted tests support merging.

What I ran

Reviewed head 750417f70e78b7b831722188c27f25d1699ff5c6 using the prepared diff and the pinned repository reader. No commands or tests were run.

Results

Check Result Note
Change review passed Implementation and tests inspected
Automated checks not run Results in the PR description are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full texts of changed files listed as included in the manifest were not accessible through the reader, so those files were reviewed from the prepared diff only. The PR-reported build and tests were not run independently. Console behavior and compatibility with libSceLibcInternal.sprx were not verified; the PR records this as technical debt.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004402607 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884#pullrequestreview-6004402607). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T09:30:53Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the implementation and its targeted tests support merging. ## What I ran Reviewed head `750417f70e78b7b831722188c27f25d1699ff5c6` using the prepared diff and the pinned repository reader. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Change review | passed | Implementation and tests inspected | | Automated checks | not run | Results in the PR description are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full texts of changed files listed as included in the manifest were not accessible through the reader, so those files were reviewed from the prepared diff only. The PR-reported build and tests were not run independently. Console behavior and compatibility with `libSceLibcInternal.sprx` were not verified; the PR records this as technical debt. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-21 09:32:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T09:32:06Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 750417f70e:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_facet_put_tests built cleanly.
  • CTest (guest_libc_internal_facet_put):
    1/1 Test #4471: guest_libc_internal_facet_put ....   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/NumPutField.cpp, core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified num_put<wchar_t>::num_put constructor argument null-checks for self and info throwing std::invalid_argument in core/libs/prx/libSceLibcInternal/NumPutField.cpp:133-139
    • Verified WideNumPutVtable struct layout, member offsets, and size (0x60) via static_asserts matching Dinkumware locale facet specifications in core/libs/prx/libSceLibcInternal/NumPutField.cpp:18-32
    • Verified reference counting atomic operations (RetainWideNumPutFacet, ReleaseWideNumPutFacet, DeleteWideNumPutFacet) using std::atomic_ref with proper null checks and delete semantics in core/libs/prx/libSceLibcInternal/NumPutField.cpp:34-48
    • Verified _Getcat numeric category 4 return, null facet guard handling, exception-safe FacetGuard cleanup on allocation, and facet construction in core/libs/prx/libSceLibcInternal/NumPutField.cpp:141-155
    • Verified InventoryExports6.hpp export declarations and removal of NotImplemented stubs in InventoryExports6.cpp alongside technical debt tracking in docs/dev/debt/changes/feat-libcinternal-wide-num-put-ctor.md
    • Verified unit test coverage in core/libs/tests/GuestLibcInternalFacetPut.cpp exercising constructor signatures, null checks, _Getcat slot behavior, and retain/release lifecycle

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004409410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884#pullrequestreview-6004409410). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T09:32:06Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `750417f70e`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_facet_put_tests` built cleanly. - **CTest** (`guest_libc_internal_facet_put`): ``` 1/1 Test #4471: guest_libc_internal_facet_put .... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/NumPutField.cpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified num_put<wchar_t>::num_put constructor argument null-checks for self and info throwing std::invalid_argument in core/libs/prx/libSceLibcInternal/NumPutField.cpp:133-139 - Verified WideNumPutVtable struct layout, member offsets, and size (0x60) via static_asserts matching Dinkumware locale facet specifications in core/libs/prx/libSceLibcInternal/NumPutField.cpp:18-32 - Verified reference counting atomic operations (RetainWideNumPutFacet, ReleaseWideNumPutFacet, DeleteWideNumPutFacet) using std::atomic_ref with proper null checks and delete semantics in core/libs/prx/libSceLibcInternal/NumPutField.cpp:34-48 - Verified _Getcat numeric category 4 return, null facet guard handling, exception-safe FacetGuard cleanup on allocation, and facet construction in core/libs/prx/libSceLibcInternal/NumPutField.cpp:141-155 - Verified InventoryExports6.hpp export declarations and removal of NotImplemented stubs in InventoryExports6.cpp alongside technical debt tracking in docs/dev/debt/changes/feat-libcinternal-wide-num-put-ctor.md - Verified unit test coverage in core/libs/tests/GuestLibcInternalFacetPut.cpp exercising constructor signatures, null checks, _Getcat slot behavior, and retain/release lifecycle Looks Good To Me
MarcZX10 commented 2026-11-22 15:28:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T15:28:25Z.

Review: COMMENTED


Reviewed — no blocking findings

The review folder and repository reader are not accessible through the available tools, so the change could not be inspected and a formal decision is not justified.

What I ran

Not run. The provided reader command could not be executed in this environment.

Results

Check Result Note
Change inspection not run Review inputs unavailable
Tests not run No commands could be run

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

The description, commits, diff, manifest, changed files, and repository context were not read. Files read: none. Files reviewed: none.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013019150 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24884#pullrequestreview-6013019150). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T15:28:25Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The review folder and repository reader are not accessible through the available tools, so the change could not be inspected and a formal decision is not justified. ## What I ran Not run. The provided reader command could not be executed in this environment. ## Results | Check | Result | Note | |---|---|---| | Change inspection | not run | Review inputs unavailable | | Tests | not run | No commands could be run | ## Findings ### Blocking None verified. ### Non-blocking None. ## Not verified The description, commits, diff, manifest, changed files, and repository context were not read. Files read: none. Files reviewed: none. ## 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!24884
No description provided.