Skip to content

xgameruntime_test: build without MSVC warnings (BUILD-1384) - #4743

Open
emirduran707 wants to merge 1 commit into
ItsNotRexed:mainfrom
emirduran707:build-1384-xgameruntime-test-warnings
Open

emirduran707 wants to merge 1 commit into
ItsNotRexed:mainfrom
emirduran707:build-1384-xgameruntime-test-warnings

Conversation

@emirduran707

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: BUILD-1384, the xgameruntime_test.cpp half (claim). The d3d12_vulkan_device_test.cpp half is #4741.

Depends on: none. It conflicts with #3408 and #2218 in runtime/test/xgameruntime_test.cpp (measured with git merge-tree). Both already conflict with main in docs/runtime_imports.md and runtime/shims/xgameruntime.cpp, and #2218 also in this test file. This pull request merges cleanly with #4741.

What and why

A build of xgameruntime_test on main (98fa503f) prints four MSVC warnings, all from the test file. The other runtime tests build without warnings, so new ones are easy to miss (@etcetera-yt's finding).

  • C4996 at lines 550, 570 and 666 (fopen, _wfopen, fopen): the target gets _CRT_SECURE_NO_WARNINGS, as the other test targets that use plain fopen have it (d3d12_bundle_test, d3d12_first_light_test, tiny_game).
  • C4456 at line 631: the second bool all in main hid the one at line 193. It is now chain_answers. Nothing else changes in the test.

The define is on the whole target, which also compiles four shim sources. Before the change the build showed no warning from those sources, so the define hides nothing that was visible there.

Tested

Windows 11, MSVC (Visual Studio 2022), Ninja, RelWithDebInfo. No GPU is involved in this test.

  • Before, main 98fa503f: cmake --build runtime/build --target xgameruntime_test prints 4 warnings (C4456 at 631; C4996 at 550, 570, 666).
  • After: the target's object directory deleted, all 6 sources compiled again, 0 warnings.
  • xgameruntime_test.exe: exit 0, OK (128 checks), among them "IXPackageImpl3 answers for IXPackageImpl and IXPackageImpl2 too", the check that uses the renamed local.

Not run: the full ctest suite. The change touches one test target and no shim or runtime source.

AI-assisted: yes (Claude Code)

Checklist

  • 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. (Not a translator change.)

🤖 Generated with Claude Code

The test opens its config files with fopen and _wfopen (C4996, three
places), so the target gets _CRT_SECURE_NO_WARNINGS, as the other test
targets that use plain fopen have it. The second `all` in main hid the
first one (C4456); it is now `chain_answers`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@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.

Built and ran xgameruntime_test at 3db8ea4ab on Windows 11: xgameruntime_test: OK (128 checks), exit 0; git diff --check clean.

The test now builds under the project's MSVC warning level with the two shadowed locals renamed, and runtime/CMakeLists.txt applies the same compile options as the other tests. No behaviour change; no blocking issue.

@Atomic258

Copy link
Copy Markdown

Independent verification on Windows 11 (no GPU involved in this test).

  • Head SHA: 3db8ea4ab37b850612200248cabde39b266e556b
  • OS: Windows 11 x64; MSVC 14.44 + Ninja, RelWithDebInfo (/W4); Vulkan SDK 1.4.363.0 on PATH
  • Built xgameruntime_test (CMake re-ran for the CMakeLists.txt change; all 6 sources recompiled): exit 0, 0 warnings — no C4456/C4996 anywhere in the target.

Commands / results:

  • .\xgameruntime_test.exe — exit 0, xgameruntime_test: OK (128 checks) (includes "IXPackageImpl3 answers for IXPackageImpl and IXPackageImpl2 too", the check using the renamed chain_answers local).

Red control: reverted both runtime/CMakeLists.txt and runtime/test/xgameruntime_test.cpp to origin/main, rebuilt — all four warnings reproduced:

  • xgameruntime_test.cpp(631): warning C4456: declaration of 'all' hides previous local declaration
  • xgameruntime_test.cpp(550), (570), (666): warning C4996 (fopen/_wfopen)

Restored and rebuilt — 0 warnings, OK (128 checks) again. Pure warning cleanup + one local rename; no behaviour change.

AI-assisted (Devin).

@kingzzim7-create

Copy link
Copy Markdown

Tested 3db8ea4 together with #4741 (f9e955d), merged onto main 98fa503, on Windows 11, VS 2026 (MSVC 14.52.37025), RTX 4060 Ti:

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.

4 participants