fix: clear GCC warnings in the AGC driver and two tests #7555

Merged
milescoviello merged 2 commits from upstream-pr/7555 into main 2026-11-02 07:56:13 +00:00
milescoviello commented 2026-10-18 13:48:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T13:48:10Z.


What

A clean Release build (CMAKE_BUILD_TYPE=Release, BUILD_TESTING=ON) with GCC warns in these five places in core/. Each is fixed without changing behaviour:

  • libSceAgcDriver/Execution/src/SubmissionCapture.cpp (QueueType): "queue 0x%x is neither the graphics queue nor a compute queue" needs up to 67 bytes, and it was formatted into 64. So for a queue number above 0xfffff, the end of the exception message was cut off. The buffer is now 96 bytes.
  • libSceAgcDriver/tests/ConstantPhi.cpp: the result of a [[nodiscard]] IrBuilder::Emit was ignored. It is now static_cast<void>, as the other tests do.
  • tests/GuestMemoryModule.cpp: guestMemoryModuleData was both initialized and declared extern ("initialized and declared 'extern'"). The definition is now inside an extern "C" { } block, which gives the same C linkage and external symbol.
  • libSceAgcDriver/Execution/src/Driver/Packets/CommandValidation.cpp (second commit): "unsupported PM4 packet type: header 0x%08x at DWORD %zu of %zu" needs up to 101 bytes for the largest %zu values and had 96 (-Wformat-truncation). The buffer is 128 bytes.
  • libSceAgcDriver/Graphics/src/State.cpp (second commit): the stencil operation message needs up to 119 bytes for a 10-digit %u and had 112 (-Wformat-truncation). The operation is at most 15, so the text always fit; 128 bytes only silences the warning. #6762, which changed that buffer, has merged.

Not in this PR any more: this PR also fixed chdir's deprecated std::filesystem::u8path in libc and the null %s argument in sceKernelOpen's log. Both functions now copy the guest path first (2c5fcf6406, "safely copy guest path arguments"), so main no longer warns there, and the rebase dropped those hunks.

Also not in this PR:

  • DepthSurface.cpp's tile mode format (#7504) and StagedClearSampledRead.cpp's %u (#7415) are open as their own PRs.
  • sceRtcFormatRFC2822 formats into the guest's 32-byte buffer, which its longest valid string exactly fills, so that warning is a false positive I can't fix by enlarging anything.
  • The rest of the warnings are inside stl_algobase.h (GCC 13 -Wstringop-overflow/-Warray-bounds false positives on vector copies) or in glslang.

Tested

  • Rebased onto main 316615d042 (head 9db070f8de, two commits). SubmissionCapture.cpp conflicted with #10307's queue range change: the merge keeps main's DriverDetail::SubmissionQueueEnd bound and this PR's 96-byte buffer. Ubuntu 26.04.1, GCC 15.2, Release. The rebased first commit (9aaf5ee0bf) recompiled its three files without their warnings; that build's log still showed the two the second commit fixes and DepthSurface.cpp:1305, which is #7504's. At this head, the two files the second commit changes recompile without a warning. agc_driver_graphics, agc_constant_phi, guest_memory and agc_driver_pm4 pass 3 of 3. Windows 11 VM (GT 1030, WinLibs GCC 15.2.0, Release): the base 316615d042 and this head both build, and the four tests pass 3 of 3 on each; the rebased first commit alone (9aaf5ee0bf) passes its three 3 of 3 too.

Earlier:

  • Rebased onto main 6f58a046b1 (head 7e7b5ca3a7, one commit), on Ubuntu 26.04.1, GCC 15.2, Release. I touched the three files and built their targets on main and on this head. On main, all three warnings appear:

    • SubmissionCapture.cpp:179 -Wformat-truncation
    • ConstantPhi.cpp:177 ignored [[nodiscard]]
    • GuestMemoryModule.cpp:1 "initialized and declared 'extern'"

    On this head none appear. agc_driver_graphics, agc_constant_phi and guest_memory pass.

  • Windows 11 VM (GT 1030, 582.78, WinLibs GCC 15.2.0): both the merge base acbfd7c7fe and this head build. The same three tests pass 3 of 3 on each.

  • Windows: @brummilab confirmed the ConstantPhi.cpp:177 -Wunused-result warning this fixes, with WinLibs GCC 15.2.0 r7 on main 2fade7ef4.

Earlier, on the five-file head 2368d21ba0, Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02:

  • A clean Release build of main 5bf2e139ef with this PR: none of the five warnings above appear.
  • ctest -R "^guest_|constant_phi|submission|stencil|graphics|libc": 436/436 pass.
  • tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists only conflicting PRs that it could not compare: #5021, #6044, #6222 and #6879. Of those, #6044, #6222 and #6879 don't touch these lines; #5021's diff is too large for the API.
  • Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_' -V on main f29546ac4e and on main + this PR (2368d21ba0, a local merge). main: 812 of 812 pass; with this PR: 812 of 812 pass. Neither log reports the layer missing. VUIDs on main: VUID-VkImageViewCreateInfo-usage-02275 ×6, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 ×18, VUID-vkCmdCopyBuffer-srcBuffer-00118 ×2, VUID-vkCmdDispatch-magFilter-04553 ×2, VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285 ×2, VUID-vkCmdWaitEvents-srcStageMask-01158 ×2, VUID-vkSetEvent-event-09543 ×2; with this PR: VUID-VkImageViewCreateInfo-usage-02275 ×6, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 ×18, VUID-vkCmdCopyBuffer-srcBuffer-00118 ×2, VUID-vkCmdDispatch-magFilter-04553 ×2, VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285 ×2, VUID-vkCmdWaitEvents-srcStageMask-01158 ×2, VUID-vkSetEvent-event-09543 ×2. None is new with this PR. Each of main's is the subject of an open PR: 00118 #7961, 04553 #7707, 07285 #7985, 01158 and 09543 #7913, 00605 #6782, 02275 #862.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8); RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04.1 (rebased head)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4909610041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7555). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-18T13:48:10Z. --- ### What A clean Release build (`CMAKE_BUILD_TYPE=Release`, `BUILD_TESTING=ON`) with GCC warns in these five places in `core/`. Each is fixed without changing behaviour: - **`libSceAgcDriver/Execution/src/SubmissionCapture.cpp`** (`QueueType`): "queue 0x%x is neither the graphics queue nor a compute queue" needs up to 67 bytes, and it was formatted into 64. So for a queue number above 0xfffff, the end of the exception message was cut off. The buffer is now 96 bytes. - **`libSceAgcDriver/tests/ConstantPhi.cpp`**: the result of a `[[nodiscard]]` `IrBuilder::Emit` was ignored. It is now `static_cast<void>`, as the other tests do. - **`tests/GuestMemoryModule.cpp`**: `guestMemoryModuleData` was both initialized and declared `extern` ("initialized and declared 'extern'"). The definition is now inside an `extern "C" { }` block, which gives the same C linkage and external symbol. - **`libSceAgcDriver/Execution/src/Driver/Packets/CommandValidation.cpp`** (second commit): "unsupported PM4 packet type: header 0x%08x at DWORD %zu of %zu" needs up to 101 bytes for the largest `%zu` values and had 96 (`-Wformat-truncation`). The buffer is 128 bytes. - **`libSceAgcDriver/Graphics/src/State.cpp`** (second commit): the stencil operation message needs up to 119 bytes for a 10-digit `%u` and had 112 (`-Wformat-truncation`). The operation is at most 15, so the text always fit; 128 bytes only silences the warning. #6762, which changed that buffer, has merged. Not in this PR any more: this PR also fixed `chdir`'s deprecated `std::filesystem::u8path` in libc and the null `%s` argument in `sceKernelOpen`'s log. Both functions now copy the guest path first (2c5fcf6406, "safely copy guest path arguments"), so `main` no longer warns there, and the rebase dropped those hunks. Also not in this PR: - `DepthSurface.cpp`'s tile mode format (#7504) and `StagedClearSampledRead.cpp`'s `%u` (#7415) are open as their own PRs. - `sceRtcFormatRFC2822` formats into the guest's 32-byte buffer, which its longest valid string exactly fills, so that warning is a false positive I can't fix by enlarging anything. - The rest of the warnings are inside `stl_algobase.h` (GCC 13 `-Wstringop-overflow`/`-Warray-bounds` false positives on vector copies) or in glslang. ### Tested - **Rebased** onto `main` `316615d042` (head `9db070f8de`, two commits). `SubmissionCapture.cpp` conflicted with #10307's queue range change: the merge keeps `main`'s `DriverDetail::SubmissionQueueEnd` bound and this PR's 96-byte buffer. Ubuntu 26.04.1, GCC 15.2, Release. The rebased first commit (`9aaf5ee0bf`) recompiled its three files without their warnings; that build's log still showed the two the second commit fixes and `DepthSurface.cpp:1305`, which is #7504's. At this head, the two files the second commit changes recompile without a warning. `agc_driver_graphics`, `agc_constant_phi`, `guest_memory` and `agc_driver_pm4` pass 3 of 3. Windows 11 VM (GT 1030, WinLibs GCC 15.2.0, Release): the base `316615d042` and this head both build, and the four tests pass 3 of 3 on each; the rebased first commit alone (`9aaf5ee0bf`) passes its three 3 of 3 too. Earlier: - **Rebased** onto `main` 6f58a046b1 (head `7e7b5ca3a7`, one commit), on Ubuntu 26.04.1, GCC 15.2, Release. I touched the three files and built their targets on `main` and on this head. On `main`, all three warnings appear: - `SubmissionCapture.cpp:179` `-Wformat-truncation` - `ConstantPhi.cpp:177` ignored `[[nodiscard]]` - `GuestMemoryModule.cpp:1` "initialized and declared 'extern'" On this head none appear. `agc_driver_graphics`, `agc_constant_phi` and `guest_memory` pass. - **Windows 11 VM** (GT 1030, 582.78, WinLibs GCC 15.2.0): both the merge base `acbfd7c7fe` and this head build. The same three tests pass 3 of 3 on each. - Windows: @brummilab [confirmed](https://github.com/boykopovar/AnyPS5/pull/7555#issuecomment-6388488557) the `ConstantPhi.cpp:177` `-Wunused-result` warning this fixes, with WinLibs GCC 15.2.0 r7 on `main` 2fade7ef4. Earlier, on the five-file head `2368d21ba0`, Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02: - A clean Release build of `main` 5bf2e139ef with this PR: none of the five warnings above appear. - `ctest -R "^guest_|constant_phi|submission|stencil|graphics|libc"`: 436/436 pass. - `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` lists only conflicting PRs that it could not compare: #5021, #6044, #6222 and #6879. Of those, #6044, #6222 and #6879 don't touch these lines; #5021's diff is too large for the API. - Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_' -V` on `main` f29546ac4e and on `main` + this PR (2368d21ba0, a local merge). `main`: 812 of 812 pass; with this PR: 812 of 812 pass. Neither log reports the layer missing. VUIDs on `main`: `VUID-VkImageViewCreateInfo-usage-02275` ×6, `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` ×18, `VUID-vkCmdCopyBuffer-srcBuffer-00118` ×2, `VUID-vkCmdDispatch-magFilter-04553` ×2, `VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285` ×2, `VUID-vkCmdWaitEvents-srcStageMask-01158` ×2, `VUID-vkSetEvent-event-09543` ×2; with this PR: `VUID-VkImageViewCreateInfo-usage-02275` ×6, `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` ×18, `VUID-vkCmdCopyBuffer-srcBuffer-00118` ×2, `VUID-vkCmdDispatch-magFilter-04553` ×2, `VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285` ×2, `VUID-vkCmdWaitEvents-srcStageMask-01158` ×2, `VUID-vkSetEvent-event-09543` ×2. None is new with this PR. Each of `main`'s is the subject of an open PR: 00118 #7961, 04553 #7707, 07285 #7985, 01158 and 09543 #7913, 00605 #6782, 02275 #862. ### 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) - [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: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8); RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04.1 (rebased head) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-18 13:54:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T13:54:30Z.

Review: APPROVED


Reviewed the five warning fixes against their call sites and existing UTF-8 path construction. The null-path log now avoids passing a null pointer to %s; the larger queue message buffer accommodates the full formatted diagnostic; and the ignored nodiscard result and C-linkage definition changes are appropriate. The focused hosted checks and cross-platform relinker/context jobs pass. I did not rerun the full build locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5563266821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7555#pullrequestreview-5563266821). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T13:54:30Z. **Review:** APPROVED --- Reviewed the five warning fixes against their call sites and existing UTF-8 path construction. The null-path log now avoids passing a null pointer to `%s`; the larger queue message buffer accommodates the full formatted diagnostic; and the ignored nodiscard result and C-linkage definition changes are appropriate. The focused hosted checks and cross-platform relinker/context jobs pass. I did not rerun the full build locally.
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!7555
No description provided.