Repository navigation
build(cmocka): compile the C tests with -Wno-comma (#2842) - #2843
Conversation
The macOS Tier 2 lane does not compile on master: the `macos-ci` preset sets CMAKE_COMPILE_WARNING_AS_ERROR, and clang rejects the deliberate `(asked++, call())` chain in test_module_load_steps.c (added by #2807) with `-Werror,-Wcomma`: test/cmocka/test_module_load_steps.c:65:26: error: possible misuse of comma operator here [-Werror,-Wcomma] The comma operator there is the expression under test: it counts how many operands of the `||` chain the short circuit actually evaluated. Existing C tests are never edited to satisfy a warning (#516), so the class is turned off for the test target, next to the existing -Wno-pedantic / -Wno-missing-prototypes / -Wno-strict-prototypes exemptions, for C (the same guard those use). RED: run 40753946475, job 123054397646 (a clean master checkout of 0faa3c1 fails to build once the lane is selected; #2807 skipped it, and master pushes do not select macOS, so it reached master unseen). GREEN: the lane configures and builds with warnings as errors, and the cmocka suite runs. Linux Tier 2 does not show the break: its build does not set CMAKE_COMPILE_WARNING_AS_ERROR.
zackees
left a comment
There was a problem hiding this comment.
Coordinator review — this is the right fix for #2842.
- It follows the file's existing pattern (
-Wno-pedantic,-Wno-missing-prototypes,-Wno-strict-prototypes) instead of editingtest_module_load_steps.c, which AGENTS.md forbids for exactly this case. - The flag is scoped to the cmocka target and to C (
COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU), so the product code and the C++ tests keep-Wcomma. - The comment names the deliberate
(asked++, call())chain and the preset that turns warnings into errors, so the next reader does not re-add the warning. - No features-ledger line: build-only change, no user-visible behaviour.
I will queue it once the remaining Linux lanes finish.
|
Verification gap: this PR does not select the lane its fix is for. On Two ways to close it:
Recorded here rather than pushed, since it is the same file's evidence question and the fix itself is right. |
|
Local flag check (clang 21 on Linux, the same diagnostic and the same three sites), independent of macOS: So |
|
Handed off to the coordinator. GREEN on this PR's own lane: Unblocks #2691's macOS Tier 2 job (its Windows Tier 2 and both Rust Tests jobs already pass). |
What
test/cmocka/CMakeLists.txt: compile the C tests with-Wno-comma, next to the existingtest-target exemptions (
-Wno-pedantic,-Wno-missing-prototypes,-Wno-strict-prototypes).Fixes #2842.
Why
Master's macOS Tier 2 lane does not compile. The
macos-cipreset setsCMAKE_COMPILE_WARNING_AS_ERROR, clang's C option set carries-Wcomma(
cmake/common/compiler_common.cmake:54), andtest_module_load_steps.c(added by #2807) uses thecomma operator on purpose:
That expression is the test: it counts how many operands the
||chain actually evaluated(
assert_int_equal(asked, !m ? 1 : !p ? 2 : 3)). Existing C tests are never edited to satisfy awarning (
AGENTS.md, #516), so the class is turned off for the test target, exactly as the threeneighbouring exemptions do.
It reached master unseen because #2807's own run had macOS Tier 2 skipped by the lane-selection
table, and master pushes only build macOS when a macOS path changes. Every PR that selects
test/cmocka/or the shared cmake config goes red for it, e.g. #2691.RED
Run 40753946475, job 123054397646
(
Build 🧱 / Rust Tier 2 (macos-26)), on a branch whosetest/cmocka/CMakeLists.txtdiffers frommaster only in MSVC-guarded lines — i.e. the clang compile line is master's:
Linux Tier 2 does not show it: its build does not set
CMAKE_COMPILE_WARNING_AS_ERROR, so the sameline is a warning there.
GREEN
This PR's own
Build 🧱 / Rust Tier 2 (macos-26)job is the gate — it now configures and builds withwarnings as errors and runs the cmocka suite.
./lintpasses locally (gersemi formatting included).Tiers
No product code changes: Tier 1/3/4 do not apply; Tier 2 is this lane, unchanged and passing.