fix(tests): the input-background fixture reads oc_consumed_pads, so clang 23 builds it #2777

Closed
github-sync wants to merge 1 commit from github/pr/2777 into main
Owner

@dankman42 opened this pull request on GitHub · 2026-11-12 12:34 UTC · original
Merged on GitHub in b8dce44e02

tests/test_input_background.py fails to build its fixture on Windows with the llvm-mingw the Builder ships (clang 23.1.5, 20261104): clang 23 adds -Wunused-but-set-global, and the fixture compiles with -Werror.

What changed: the code the check cuts out of host/nn_hid.c only resets oc_consumed_pads, so clang sees it set and never read:

tests\input_background_test.c:41:17: error: variable 'oc_consumed_pads' set but not used [-Werror,-Wunused-but-set-global]

The fixture now checks the value it already expects, oc_consumed_pads == 0 (its own note: hos_oc_wait stays 0, so nothing is consumed), next to its other end checks. That is a check, not a warning switched off; production code is unchanged.

Tests: python -I -B tests/run_all.py test_input_background on Windows 11 with that llvm-mingw as gcc: failed before, passes after. Tests only, nothing on screen.

🤖 Generated with Claude Code

> [@dankman42](https://github.com/dankman42) opened this pull request on GitHub · 2026-11-12 12:34 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2777) > **Merged on GitHub** in https://git.magicbean.dev/MagicBeanDev/Hookshot/commit/b8dce44e0269db09824f004fb0681136997f9e11 `tests/test_input_background.py` fails to build its fixture on Windows with the llvm-mingw the Builder ships (clang 23.1.5, 20261104): clang 23 adds `-Wunused-but-set-global`, and the fixture compiles with `-Werror`. **What changed:** the code the check cuts out of `host/nn_hid.c` only resets `oc_consumed_pads`, so clang sees it set and never read: ``` tests\input_background_test.c:41:17: error: variable 'oc_consumed_pads' set but not used [-Werror,-Wunused-but-set-global] ``` The fixture now checks the value it already expects, `oc_consumed_pads == 0` (its own note: `hos_oc_wait` stays 0, so nothing is consumed), next to its other end checks. That is a check, not a warning switched off; production code is unchanged. **Tests:** `python -I -B tests/run_all.py test_input_background` on Windows 11 with that llvm-mingw as `gcc`: failed before, passes after. Tests only, nothing on screen. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- github-sync:item:2777 -->
clang 23 (llvm-mingw 20261104, the Builder's toolchain) adds
-Wunused-but-set-global, and the fixture compiles with -Werror: the cut-out
nn_hid.c code only resets oc_consumed_pads, so the check failed to build on
Windows with that clang. The fixture now checks the value it expects
(hos_oc_wait stays 0, so the ocarina note layer takes no pad button).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@Joey-Magnus approved on GitHub · 2026-11-12 14:35 UTC · original

I merged this into current main and ran tests/test_input_background.py. It passes here with clang 21, which doesn't have -Wunused-but-set-global, so I couldn't reproduce the clang 23 error itself. The fix is the right kind, though. tests/input_background_test.c:247 now asserts a value the fixture already expects: hos_oc_wait stays 0, so the ocarina layer takes no pad button. That gives the variable a read without turning the warning off, and production code is unchanged. Several open PRs also edit this fixture (#2604, #2465, #2151, #2478, #2430), but none of them touches the end checks, so they shouldn't conflict. This also clears the failure that #2781 and #2769 list as a known local failure on Windows with the shipped llvm-mingw.

> [@Joey-Magnus](https://github.com/Joey-Magnus) approved on GitHub · 2026-11-12 14:35 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2777#pullrequestreview-5876253485) I merged this into current main and ran tests/test_input_background.py. It passes here with clang 21, which doesn't have -Wunused-but-set-global, so I couldn't reproduce the clang 23 error itself. The fix is the right kind, though. tests/input_background_test.c:247 now asserts a value the fixture already expects: hos_oc_wait stays 0, so the ocarina layer takes no pad button. That gives the variable a read without turning the warning off, and production code is unchanged. Several open PRs also edit this fixture (#2604, #2465, #2151, #2478, #2430), but none of them touches the end checks, so they shouldn't conflict. This also clears the failure that #2781 and #2769 list as a known local failure on Windows with the shipped llvm-mingw. <!-- github-sync:r:5876253485 -->
github-sync closed this pull request 2026-11-12 17:59:12 +00:00
Commenting is not possible because the repository is archived.
No description provided.