Skip to content

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

Open
dankman42 wants to merge 1 commit into
NotRexed:mainfrom
dankman42:fix/test-input-background-clang23
Open

dankman42 wants to merge 1 commit into
NotRexed:mainfrom
dankman42:fix/test-input-background-clang23

Conversation

@dankman42

Copy link
Copy Markdown
Contributor

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

…lang 23 builds it

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 <noreply@anthropic.com>

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

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.

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.

2 participants