Skip to content

runtime test: remove two MSVC C4456 shadowing warnings in d3d12_vulkan_device_test - #4781

Closed
ray3242 wants to merge 1 commit into
ItsNotRexed:mainfrom
ray3242:runtime/fix-c4456-warnings
Closed

ray3242 wants to merge 1 commit into
ItsNotRexed:mainfrom
ray3242:runtime/fix-c4456-warnings

Conversation

@ray3242

@ray3242 ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #4683 (comment), from @etcetera-yt's finding at #4683 (comment). This PR takes only the d3d12_vulkan_device_test.cpp half; the xgameruntime_test.cpp half is left to @Dom-in's open PRs (#3408, #2218) to avoid overlap. No Depends on.

What and why

A full MSVC RelWithDebInfo build of main 98fa503f emits two C4456 warnings in runtime/test/d3d12_vulkan_device_test.cpp:

  • line 6743 auto readable hides the D3D12_TEXTURE_BARRIER readable declared at line 5702 in the same function;
  • line 6750 const std::uint8_t zero[4] hides the one at line 5751.

Both are in the D3D-71 zeroed-buffer test block, far below the earlier declarations, so the reuse is accidental. Renaming them to readable_buffer and zero_bytes (matching the existing readable_volume naming at line 5875) removes the warnings with no behaviour change. 4 insertions, 4 deletions in that one file.

Tested

AI-assisted (OpenCode). Windows 11, NVIDIA GeForce GTX 1060 6GB, driver 582.78, MSVC 19.44 + Ninja, RelWithDebInfo, Vulkan-Headers 1.4.363. Configure and build of the d3d12_vulkan_device_test target from 98fa503f:

The regression check is the warning-clean MSVC build itself — the same command that reproduced the defect.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule (test-file warning cleanup only).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate: this renames the same two shadowing locals in d3d12_vulkan_device_test.cpp (readable -> a not_zeroed-named variable, zero -> an expected_zero-named one) as #4741 (opened 04:41, before this at 05:07) and as part of #4775's six-warning fix. The branches conflict in that file (git merge-tree refs/remotes/pr/4781 refs/remotes/pr/4741 -> exit 1). One of the three should close; #4741 is the earliest, #4775 the broader fix.

@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@Kam471 — you're right, and thank you for catching it. I claimed the finding in #4683 but failed to search open PRs by content before writing code; #4741 (04:41) and #4775 predate my PR (05:07) and cover the same two renames. I'm closing #4781 now. #4741 is the earliest and #4775 the broader six-warning fix — please keep one of those. My apologies to the authors for the duplicate; I've noted the lesson in my workflow (search open PRs by changed file/content, not just by item ID, before claiming). AI-assisted (OpenCode).

@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Duplicate of #4741 (earliest) and #4775 (broader six-warning fix). Closed to avoid a three-way conflict in d3d12_vulkan_device_test.cpp.

@ray3242 ray3242 closed this Nov 23, 2026
@kapitche

Copy link
Copy Markdown
Contributor

Tested dc9c334 merged with main 98fa503 on Windows (MSVC 14.51, Python not involved): pass (build only)

  • d3d12_vulkan_device_test on main: 2 warnings, C4456 at line 6743 ('readable') and 6750 ('zero'). With the PR: 0 warnings from the same build.
  • Not run: the test itself needs a GPU. The change is a pure local-variable rename (readable -> readable_buffer, zero -> zero_bytes), all uses updated; it compiles, so no stale references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants