fix(lint): clear cppcheck errors gating make-test (NULL-target guard + go.mod var shadow)

The CI lint job (cppcheck) failed, which SKIPS the gated make-test job:
- pass_parallel.c: emit_config_edge/emit_normal_calls_edge dereference target->id,
  but emit_service_edge can be reached with target==NULL on the #523 HTTP/ASYNC
  external-client bypass. cppcheck (ctunullpointer) flagged the potential NULL
  deref. Guard both emitters — a CONFIGURES/CALLS edge needs a real target.
- extract_defs.c: the go.mod require_spec local 'spec' shadowed the CBMLangSpec
  *spec parameter (cppcheck shadowArgument, treated as error here). Rename to
  req_spec. Full scripts/lint.sh --ci (clang-format-20 + cppcheck) now passes.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel
2026-06-27 15:04:27 +02:00
parent 9cbb1aa90f
commit 49aab71489
2 changed files with 15 additions and 4 deletions
+4 -4
View File
@@ -4926,14 +4926,14 @@ static void extract_var_names(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
if (strcmp(kind, "require_directive") == 0 || strcmp(kind, "replace_directive") == 0) {
uint32_t rc = ts_node_named_child_count(node);
for (uint32_t i = 0; i < rc; i++) {
TSNode spec = ts_node_named_child(node, i);
const char *sk = ts_node_type(spec);
TSNode req_spec = ts_node_named_child(node, i);
const char *sk = ts_node_type(req_spec);
if (strcmp(sk, "require_spec") != 0 && strcmp(sk, "replace_spec") != 0) {
continue;
}
TSNode mp = cbm_find_child_by_kind(spec, "module_path");
TSNode mp = cbm_find_child_by_kind(req_spec, "module_path");
if (!ts_node_is_null(mp)) {
push_var_def(ctx, cbm_node_text(a, mp, ctx->source), spec);
push_var_def(ctx, cbm_node_text(a, mp, ctx->source), req_spec);
}
}
}
+11
View File
@@ -1266,6 +1266,12 @@ static void emit_http_async_service_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t
static void emit_config_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source,
const cbm_gbuf_node_t *target, const CBMCall *call,
const cbm_resolution_t *res, const char *arg) {
/* emit_service_edge may be reached with target==NULL on the HTTP/ASYNC
* external-client bypass (#523); a CONFIGURES edge needs a real target, so
* never deref a NULL target here. */
if (!target) {
return;
}
char esc_c[CBM_SZ_256];
char esc_k[CBM_SZ_256];
cbm_json_escape(esc_c, sizeof(esc_c), call->callee_name);
@@ -1280,6 +1286,11 @@ static void emit_config_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source,
static void emit_normal_calls_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source,
const cbm_gbuf_node_t *target, const CBMCall *call,
const cbm_resolution_t *res) {
/* A CALLS edge needs a real target; the HTTP/ASYNC external-client bypass
* (#523) can reach emit_service_edge with target==NULL, so guard the deref. */
if (!target) {
return;
}
char esc_c[CBM_SZ_256];
cbm_json_escape(esc_c, sizeof(esc_c), call->callee_name);
char props[CBM_SZ_2K];