file_system_test: build without the C4456 shadow warning (TEST-FS-C4456) #1146

Merged
leonida/mandy
Christopher-Sundeby merged 1 commit from fix/file-system-test-c4456 into main 2026-11-29 15:44:52 +00:00

Pull request successfully merged and closed

Christopher-Sundeby commented 2026-11-24 19:11:45 +00:00

Claimed in the coordination issue as: TEST-FS-C4456

What and why

The reserved-folder probe in runtime/test/file_system_test.cpp declares const HANDLE h inside a loop that
already sits in the scope of an outer HANDLE h, which MSVC reports at /W4 as C4456. The inner handle is renamed
refused; the checks themselves are unchanged.

Tested

  • Windows 11, MSVC 14.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo.
  • main (6293c1c4f): file_system_test.cpp(1291): warning C4456. With this change: builds with no warnings.
  • file_system_test.exe: 494 checks, 0 failures.

GPUs tested: n/a (CPU-only test)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code

Claimed in the coordination issue as: TEST-FS-C4456 ### What and why The reserved-folder probe in `runtime/test/file_system_test.cpp` declares `const HANDLE h` inside a loop that already sits in the scope of an outer `HANDLE h`, which MSVC reports at /W4 as C4456. The inner handle is renamed `refused`; the checks themselves are unchanged. ### Tested - Windows 11, MSVC 14.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo. - `main` (6293c1c4f): `file_system_test.cpp(1291): warning C4456`. With this change: builds with no warnings. - `file_system_test.exe`: 494 checks, 0 failures. GPUs tested: n/a (CPU-only test) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
abnalstlll-byte approved these changes 2026-11-24 19:12:37 +00:00
abnalstlll-byte left a comment

Reviewed and verified. Cleanly eliminates MSVC /W4 warning C4456 (declaration shadows previous local declaration) in runtime/test/file_system_test.cpp:1291 by renaming inner HANDLE h to refused. Builds warning-free and passes 494/494 checks. 100% clean-room.

Reviewed and verified. Cleanly eliminates MSVC /W4 warning C4456 (declaration shadows previous local declaration) in `runtime/test/file_system_test.cpp:1291` by renaming inner `HANDLE h` to `refused`. Builds warning-free and passes 494/494 checks. 100% clean-room.
Deedlyy commented 2026-11-24 20:13:17 +00:00

Recommendation: [MERGE]

Reasoning: Renames a shadowed HANDLE h in file_system_test.cpp to silence MSVC C4456 at /W4. Trivial test-only change; 494 checks still pass. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 1/10

**Recommendation:** [MERGE] **Reasoning:** Renames a shadowed `HANDLE h` in `file_system_test.cpp` to silence MSVC C4456 at /W4. Trivial test-only change; 494 checks still pass. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 1/10
Christopher-Sundeby commented 2026-11-27 19:30:22 +00:00

Hi @aslan2142, could you approve the workflows on this one and take a look when you have a moment? It is a 3-line test-only change (renames a shadowed HANDLE in file_system_test.cpp for MSVC C4456), it still merges cleanly with current main, and it has a MERGE recommendation above. It is my only open pull request, so it also holds the slot for two tested fixes waiting on my fork (RT-CONSOLE-HEAP-GPU-SHARING-AND-RETIRE and RT-PSO-STREAM-SO-SEMANTIC-COPY in #1608). Thanks!

Hi @aslan2142, could you approve the workflows on this one and take a look when you have a moment? It is a 3-line test-only change (renames a shadowed `HANDLE` in `file_system_test.cpp` for MSVC C4456), it still merges cleanly with current `main`, and it has a MERGE recommendation above. It is my only open pull request, so it also holds the slot for two tested fixes waiting on my fork (RT-CONSOLE-HEAP-GPU-SHARING-AND-RETIRE and RT-PSO-STREAM-SO-SEMANTIC-COPY in #1608). Thanks!
OreoFR commented 2026-11-28 21:46:56 +00:00

Verified by OreoFR

  • Base: main c1ecf04ed + PR head bbdb7543b; green run in a merge package of 9 PRs, no new ctest failure vs main
  • Test: file_system_test build (/W4) + ctest -R ^file_system$
  • Red on main: main builds with warning C4456 (file_system_test.cpp line 1483, 'h' hides a declaration)
  • Green with the PR: no C4456 left in file_system_test.cpp, file_system OK
  • Verdict: READY (build only) (test-only PR, no test can go red)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `bbdb7543b`; green run in a merge package of 9 PRs, no new ctest failure vs main - Test: `file_system_test build (/W4) + ctest -R ^file_system$` - Red on main: main builds with warning C4456 (file_system_test.cpp line 1483, 'h' hides a declaration) - Green with the PR: no C4456 left in file_system_test.cpp, file_system OK - Verdict: READY (build only) (test-only PR, no test can go red) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:00:02 +00:00

Windows 11 + MSVC 19.44 Verification — PASS (bbdb7543b7)

Verified bbdb7543b7 (TEST-FS-C4456) merged onto origin/main (e66c65b950 / 16f5053047, 0 conflicts, plus a 5-way combined merge alongside #988, #955, #2544, and #1738) on native Windows 11 (10.0.26200.9974) with MSVC 19.44.35228.

Checks Run

  • Red (origin/main under /W4 /WX):
    • Compiling runtime/test/file_system_test.cpp with /std:c++20 /O2 /MD /EHsc /W4 /WX /permissive- /utf-8 failed (rc=2) on warning C4456: declaration of 'h' hides previous local declaration at line 1291.
  • Green (#1146 + origin/main under /W4 /WX + runtime execution):
    • file_system_test.exe (test/file_system_test.cpp, shims/file_system.cpp, shims/registry.cpp) compiled cleanly with 0 warnings under /W4 /WX (rc=0) and passed the full Windows NTFS GAME: / write-overlay test suite (rc=0).

AI-assisted.

## Windows 11 + MSVC `19.44` Verification — PASS (`bbdb7543b7`) Verified `bbdb7543b7` (`TEST-FS-C4456`) merged onto `origin/main` (`e66c65b950` / `16f5053047`, `0` conflicts, plus a 5-way combined merge alongside `#988`, `#955`, `#2544`, and `#1738`) on native Windows 11 (`10.0.26200.9974`) with MSVC `19.44.35228`. ### Checks Run - **Red (`origin/main` under `/W4 /WX`)**: - Compiling `runtime/test/file_system_test.cpp` with `/std:c++20 /O2 /MD /EHsc /W4 /WX /permissive- /utf-8` failed (`rc=2`) on `warning C4456: declaration of 'h' hides previous local declaration` at line `1291`. - **Green (`#1146 + origin/main` under `/W4 /WX` + runtime execution)**: - `file_system_test.exe` (`test/file_system_test.cpp`, `shims/file_system.cpp`, `shims/registry.cpp`) compiled cleanly with **`0` warnings under `/W4 /WX`** (`rc=0`) and passed the full Windows NTFS `GAME:` / write-overlay test suite (`rc=0`). AI-assisted.
MoonEyes commented 2026-11-29 15:44:55 +00:00

Merged. Tested by @zmasi on head bbdb7543b (CPU only (Windows 11, MSVC)): Red: main file_system_test.cpp fails /W4 /WX with C4456; green: 0 warnings, test passes. Correction: I had not shown that every failed or cancelled CI job on this head was also red on main. Not shown: label (cancelled). My earlier sentence was too broad. Thanks @Christopher-Sundeby!

AI-assisted: yes

Merged. Tested by @zmasi on head bbdb7543b (CPU only (Windows 11, MSVC)): Red: main file_system_test.cpp fails /W4 /WX with C4456; green: 0 warnings, test passes. Correction: I had not shown that every failed or cancelled CI job on this head was also red on main. Not shown: label (cancelled). My earlier sentence was too broad. Thanks @Christopher-Sundeby! AI-assisted: yes
Sign in to join this conversation.
No description provided.