Skip to content

Commit 0ac290e

Browse files
committed
fix(cli): drop the POSIX probe-counter store that Clang 23 rejects
`g_mcp_command_path_probe_counter` is only ever read inside `cbm_json_mcp_probe_command_path`, which is compiled for Windows alone. On POSIX test builds the setter stored a pointer nothing read, and Clang 23 (Homebrew LLVM 23.1.0, which `brew install llvm` now pours on the macOS LSan leg) flags that as `-Wunused-but-set-global`; with `-Werror` the whole test-runner build dies at `src/cli/cli.c:1768:21`. Keep the counter where a probe can happen (Windows) and make the POSIX setter an explicit no-op with the reason spelled out. The three tests that install a counter keep asserting it stays at zero on every platform, which on POSIX is exactly what "no classifier" means. Verified in the failing arena: `origin/main` `src/cli/cli.c` fails under clang 23.1.1 with the CI diagnostic; with this change it compiles clean, as do all 105 built `src` TUs and all 155 test + extraction TUs under the same flags. `cli` suite: 292 passed with Homebrew LLVM 22. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 5802ccd commit 0ac290e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/cli/cli.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,14 +1765,25 @@ static bool cbm_json_mcp_command_path_probe_safe(const char *command) {
17651765
#endif
17661766

17671767
#ifdef CBM_CLI_ENABLE_TEST_API
1768+
#ifdef _WIN32
17681769
static CBM_TLS int *g_mcp_command_path_probe_counter = NULL;
1770+
#endif
17691771

17701772
bool cbm_mcp_command_path_probe_safe_for_testing(const char *command, bool windows) {
17711773
return cbm_json_mcp_command_path_probe_safe_for_platform(command, windows);
17721774
}
17731775

17741776
void cbm_set_mcp_command_path_probe_counter_for_testing(int *counter) {
1777+
#ifdef _WIN32
17751778
g_mcp_command_path_probe_counter = counter;
1779+
#else
1780+
/* The command-path classifier (cbm_json_mcp_probe_command_path) is compiled
1781+
* for Windows only, so on POSIX there is no probe to count. The tests still
1782+
* install a counter on every platform and assert it stays at zero; a pointer
1783+
* stored here but never read is what Clang 23 rejects under -Werror
1784+
* (-Wunused-but-set-global). */
1785+
(void)counter;
1786+
#endif
17761787
}
17771788
#endif
17781789

0 commit comments

Comments
 (0)