Skip to content

runtime tests: d3d12_bundle_test and d3d12_first_light_test define _CRT_SECURE_NO_WARNINGS (C4996) - #2912

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:test-targets-crt-secure
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:test-targets-crt-secure

Conversation

@etcetera-yt

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new BUILD item, the two MSVC C4996 warnings left in runtime tests (claim)

What and why

On main ec8ec4c9, two new test targets print MSVC C4996:

runtime\test\d3d12_bundle_test.cpp(518,31): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. ...
runtime\test\d3d12_first_light_test.cpp(68,32): warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. ...

The other test targets that call getenv or fopen define _CRT_SECURE_NO_WARNINGS in runtime/CMakeLists.txt (bink_decode_test, bink_audio_test, fsr_dispatch_test, bvh_builder_test, startup_trace_test, unimplemented_policy_test). These two now do as well. The change is two lines in runtime/CMakeLists.txt, with no source changes.

Nothing is left for this item. The build's other warnings on main are:

Tested

NVIDIA GeForce RTX 5060 Ti, driver 621.14, Windows 10 19045. VS 2022 Build Tools (MSVC), Vulkan SDK 1.4.363.0.

cmake -S runtime -B runtime/build
cmake --build runtime/build --config RelWithDebInfo -- -m:2
ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure
LEONIDA_VK_VALIDATION=1 ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure
main ec8ec4c9 this PR 00b30815
build warnings 14, including these two C4996 12, neither of them
ctest 120/121, 8 skipped; d3d12_vulkan_device fails same
ctest, validation on 120/121, 7 skipped; same failure, no VUIDs same
d3d12_bundle Passed Passed (both ways)
d3d12_first_light Skipped (no LEONIDA_FIRST_LIGHT_DIR) Skipped

d3d12_vulkan_device fails on Windows 10 with and without this PR (A4B4G4R4: the Windows 10 runtime doesn't have it). #2438 fixes that.

Not tested: d3d12_first_light with LEONIDA_FIRST_LIGHT_DIR set (it needs first-light output from the game's files); a clang-cl build.

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. (n/a: no translator change)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…RT_SECURE_NO_WARNINGS (C4996)

d3d12_bundle_test calls std::fopen (line 518) and d3d12_first_light_test
calls std::getenv (line 68), so MSVC prints C4996 for each. The other
test targets that use them (bink_decode_test, fsr_dispatch_test,
bvh_builder_test, startup_trace_test, ...) define _CRT_SECURE_NO_WARNINGS;
these two now do as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of 00b30815. Looks right. _CRT_SECURE_NO_WARNINGS on just these two test targets silences the C4996 warnings for their plain CRT calls without touching any other target, the same way tiny_game does it.

AI-assisted review (Claude Code).

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Thanks @tupacfan04 for the code read. AI-assisted (Claude Code).

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 00b30815 on RTX 4070 (NVIDIA 621.01), Windows 11 (10.0.26300), MSVC 14.44, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1, RelWithDebInfo: pass.

Not tested: clang-cl, validation layers, other GPUs. Tested with AI assistance (Claude); no game files or data involved.

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Thanks @iurysf for the test run. AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit 5d87d85 into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
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