fix(tests): keep generic category vtable entries castable to functions #6969

Merged
jotitadev merged 1 commit from upstream-pr/6969 into main 2026-10-19 15:13:04 +00:00
jotitadev commented 2026-10-16 22:54:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T22:54:20Z.


What

The guest_generic_category test from #5102 reads the category's vtable as const void* const* and reinterpret_casts the entries to function pointers. Clang rejects that (reinterpret_cast from 'const void *' to 'Name' ... casts away qualifiers), so the test does not compile on macOS. The vtable entries are now void*, keeping the table itself const. GCC builds the same code as before.

Reported in #1 (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178527997). @mugurc asked for it as a separate PR (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180063305).

Tested

macOS 27.2 on an Apple M2 Max, Xcode 27.0 (Apple clang 21.0.0, libc++), x86-64 full build configured as docs/dev/BUILD.md describes (cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON). Base: main 4808d9c20. I ran the file's exact command from ninja -t commands with -fsyntax-only. Rechecked after rebasing onto main ab9a47684, with the same flags and -fsyntax-only for -arch x86_64 and -arch arm64: the same errors on main, none on this branch. Results:

  • main: three casts away qualifiers errors (lines 56 to 58).
  • This branch: compiles, no warnings.

Not run: the test links against libc, which does not link on macOS yet. The change only affects the type of a test-local struct field, so Linux and Windows run the same test.
Rechecked after rebasing onto main 44df21632 (2026-10-15), same flags, -fsyntax-only for -arch x86_64 and -arch arm64: the error is still there on main, and this branch compiles.

Overlap: #6222 ("Macos m4", currently conflicting with main) carries the same one-line change inside a larger macOS series. This is the standalone version @mugurc asked for; whichever lands first, the other only drops this hunk.

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
  • 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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4895190396 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6969). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T22:54:20Z. --- ### What The `guest_generic_category` test from #5102 reads the category's vtable as `const void* const*` and `reinterpret_cast`s the entries to function pointers. Clang rejects that (`reinterpret_cast from 'const void *' to 'Name' ... casts away qualifiers`), so the test does not compile on macOS. The vtable entries are now `void*`, keeping the table itself `const`. GCC builds the same code as before. Reported in #1 (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178527997). @mugurc asked for it as a separate PR (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180063305). ### Tested macOS 27.2 on an Apple M2 Max, Xcode 27.0 (Apple clang 21.0.0, libc++), x86-64 full build configured as `docs/dev/BUILD.md` describes (`cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`). Base: `main` 4808d9c20. I ran the file's exact command from `ninja -t commands` with `-fsyntax-only`. Rechecked after rebasing onto `main` ab9a47684, with the same flags and `-fsyntax-only` for `-arch x86_64` and `-arch arm64`: the same errors on `main`, none on this branch. Results: - `main`: three `casts away qualifiers` errors (lines 56 to 58). - This branch: compiles, no warnings. Not run: the test links against `libc`, which does not link on macOS yet. The change only affects the type of a test-local struct field, so Linux and Windows run the same test. Rechecked after rebasing onto `main` 44df21632 (2026-10-15), same flags, `-fsyntax-only` for `-arch x86_64` and `-arch arm64`: the error is still there on `main`, and this branch compiles. Overlap: #6222 ("Macos m4", currently conflicting with `main`) carries the same one-line change inside a larger macOS series. This is the standalone version @mugurc asked for; whichever lands first, the other only drops this hunk. ### 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) - [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] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-16 23:09:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T23:09:41Z.


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.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestGenericCategory.cpp
PR 7201 core/libs/tests/GuestGenericCategory.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226389761 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6969#issuecomment-6226389761). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T23:09:41Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestGenericCategory.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/tests/GuestGenericCategory.cpp` |
adriadam10 commented 2026-10-19 15:14:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T15:14:10Z.


Checked the change: the vtable field is only used through reinterpret_cast to function pointers (Name, Message, Condition), so dropping the const on the pointee type is behaviour-neutral on GCC/MinGW and fixes the Clang cast error; the table itself stays const. Conventions and template are fine; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270616200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6969#issuecomment-6270616200). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T15:14:10Z. --- Checked the change: the vtable field is only used through `reinterpret_cast` to function pointers (`Name`, `Message`, `Condition`), so dropping the `const` on the pointee type is behaviour-neutral on GCC/MinGW and fixes the Clang cast error; the table itself stays `const`. Conventions and template are fine; merged.
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!6969
No description provided.