Skip to content

test: test_native_astc_texture_count builds on Windows, where the CRT marks scanf deprecated - #2397

Merged
hckrman101 merged 1 commit into
NotRexed:mainfrom
mooki000:test/native-astc-count-windows
Nov 11, 2026
Merged

hckrman101 merged 1 commit into
NotRexed:mainfrom
mooki000:test/native-astc-count-windows

Conversation

@mooki000

Copy link
Copy Markdown
Contributor

What this is for: main's game-free checks pass on Windows again. The test that came with my #2288 does not compile there, so Python source checks (windows-2022, part 1/2) fails on every run since that merge. What is measured: the test with g++ and clang++ on Linux, on this branch. Not measured: Windows on my side: I have no Windows machine, so this pull request's own windows-2022 job is the proof, and I will confirm its result here.

Problem

  • tests/test_native_astc_texture_count.py compiles a small fixture with -Wall -Wextra -Werror and reads its cases with std::scanf. With clang and the Windows CRT's headers scanf is marked deprecated, which -Werror makes an error:
fixture.cpp:13:17: error: 'scanf' is deprecated: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

What changed

  • tests/test_native_astc_texture_count.py: the fixture defines _CRT_SECURE_NO_WARNINGS ahead of its includes, as the other test sources that use these functions do (tests/capture_dimensions_test.cpp, tests/png_publication_test.cpp and others). One line; no assertion, case or source file changes.

How it was tested

Arch Linux, g++ 16.2.1 and clang++ 23.1.3, branch head fc0157a1 on main 696d85b0:

  • python -I -B tests/test_native_astc_texture_count.py --cxx g++ and --cxx clang++: native ASTC texture count: 182 cases pass, as before the change.

Not tested

  • Windows here. The define is the one the compiler's message names, and the one main's other tests use for the same deprecation.

Risks

  • Tests only.

Fixes #2396.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

… marks scanf deprecated

The test from NotRexed#2288 compiles its fixture with -Wall -Wextra -Werror and
reads its cases with std::scanf. With clang and the Windows CRT's headers
scanf is marked deprecated, so the fixture does not compile there and the
game-free checks fail on windows-2022 (part 1/2):

  fixture.cpp:13:17: error: 'scanf' is deprecated: This function or
  variable may be unsafe. Consider using scanf_s instead. To disable
  deprecation, use _CRT_SECURE_NO_WARNINGS.

NotRexed#2288's own workflows had not run before it was merged (they waited for an
approval), so this was first seen on a later pull request's run. The
fixture now defines _CRT_SECURE_NO_WARNINGS ahead of its includes, as the
other test sources that use these functions do. Nothing else changes.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mooki000

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Confirmed from this head’s Windows part 1/2 log: tests/test_native_astc_texture_count.py passes, and the shard ends with 179 passed, 0 failed, 15 skipped. That verifies the Windows CRT compile fix on fc0157a1, which was still untested when I opened this PR. No game code changes.

@Joey-Magnus

Copy link
Copy Markdown
Contributor

Testing pass on main at 497060f (this PR plus everything merged up to #2223):

  • CI is green again. Game-free source regressions run 43087811565 passed every job, both Windows parts included. From 2ed98c4 until this PR, the Windows part on each push to main failed on this test alone: clang on the MSVC headers stopped on scanf under -Werror.
  • Local Linux run: tests/run_all.py, with the Vulkan and SPIR-V headers and the glslang 16.6.0 that CI pins. 400 passed, 0 failed, 11 skipped. The skips are Windows-only checks (6), checks that need a game dump or a game build (4), and one that needs a Vulkan device.
  • Not covered: no game build or run in the game, since there was no dump on the machine.

This was referenced Nov 11, 2026
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.

main: test_native_astc_texture_count does not compile on Windows (scanf is deprecated in the CRT; from #2288)

2 participants