refactor(test): apply the ADR-1138 nullptr bracket across 39 C test TUs - #1351
refactor(test): apply the ADR-1138 nullptr bracket across 39 C test TUs#1351lusoris wants to merge 2 commits into
Conversation
Epic #1237 (whole-tree clang-tidy debt down) is the largest remaining 1.0.0 wall: 6,432 warnings across the four lanes, 2,950 of them on cpu. Measuring where they actually are rather than guessing found the debt is overwhelmingly one check in one file class. Of the top 40 C files by baseline count -- 1,746 warnings between them -- 1,351 (77%) are modernize-use-nullptr. That check asks a C translation unit to use a keyword MSVC will not compile: the fork builds C as C23, but MSVC's documented /std:clatest C23 set excludes nullptr while the required Windows build compiles these TUs with cl.exe. Writing nullptr to satisfy clang-tidy breaks the Windows build; that exact standoff blocked #1338 for four merge-train rounds. ADR-1138 already settles it: a C TU keeps NULL and suppresses the check with one file-scoped NOLINTBEGIN/NOLINTEND bracket citing the ADR. This applies that existing decision mechanically to the 39 C test TUs that carry the check, copying the wording already used by core/test/test_output.c and core/test/test_model_feature_overload_ownership.c. Measured on those 39 files: 1,746 -> 386 warnings, a reduction of 1,360, which takes the cpu lane from 2,950 to roughly 1,590. 17 nullptr findings remain and are left alone rather than papered over -- they sit outside the bracketed span and want individual attention. The diff adds comment lines and nothing else, verified: every added line is a comment or blank. No code, no behaviour, no scores change. meson test --suite=fast: 115 ok, 0 failed. The tidy baseline is deliberately NOT regenerated here. This host has gcc 16.2.1 while the lane builds with gcc-14, and the lane installs no ONNX Runtime so its enable_dnn=auto resolves differently -- a local --write would not reproduce the lane's TU set. The baseline is taken from CI's own tidy-ratchet-cpu artifact in a follow-up commit, which is what the workflow step that uploads it instructs. no digest needed: trivial no docs needed: internal lint hygiene with no user-discoverable surface no state delta: no tracked bug id opens or closes Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…cros Second cluster of epic #1237's clang-tidy debt, and the same lesson as the first: measure where the warnings come from before fixing anything. core/test/test_pelorus_interop.c carried 161 warnings, 121 of them cert-err33-c "the value returned by this function should not be disregarded". They are not 121 defects. They are ONE line -- the CHECK macro's fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); whose return is dropped, reported once per call site. Adding the explicit (void) discard the fork's own standard already requires ("Every non-void return value is checked or explicitly (void)-discarded", docs/principles.md 1.2 r30) takes that file from 161 warnings to 9. The same shape appears in nine other test TUs, all of them harness output in a macro or a failure path. All are bare statements: verified that none had its return assigned or used, so the casts change nothing but the diagnostic. Combined with the ADR-1138 brackets in the previous commit, across the 48 touched files: 1,754 -> 341 warnings, a reduction of 1,413, which takes the cpu lane from 2,950 to roughly 1,537. meson test --suite=fast: 115 ok, 0 failed. no digest needed: trivial no docs needed: internal lint hygiene with no user-discoverable surface no state delta: no tracked bug id opens or closes Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Extended with a second cluster — the total is now larger than the PR body says. cert-err33-c. Verified none had its return assigned or used, so the casts change only the diagnostic. Combined across the 48 touched files:
That takes the
|
|
Converting to draft to unblock the merge queue — this is not a rejection of the change.
Three ways forward, all needing a judgement call rather than a rebase:
Option 1 is the smallest and keeps the 38 clean TUs moving. Undrafting once that is decided. |
Summary
Epic #1237 (whole-tree clang-tidy debt) is one of the three real walls left before the retrain: 6,432 warnings across the four lanes, 2,950 of them on
cpu. I measured where the debt actually sits rather than guessing, and it is overwhelmingly one check in one file class.Of the top 40 C files by baseline count — 1,746 warnings between them — 1,351 (77%) are
modernize-use-nullptr.That check asks a C translation unit to use a keyword MSVC will not compile. The fork builds C as C23, but MSVC's documented
/std:clatestC23 set excludesnullptr, while the required Windows build compiles these TUs withcl.exe. Writingnullptrto satisfy clang-tidy breaks Windows — that exact standoff blocked #1338 for four merge-train rounds, first failing MSVC withC2065: 'nullptr': undeclared identifier, then failing the ratchet when it was changed back.ADR-1138 already settles it: a C TU keeps
NULLand suppresses the check with one file-scopedNOLINTBEGIN/NOLINTENDbracket citing the ADR. This applies that existing decision mechanically to the 39 C test TUs carrying the check, copying the wording already incore/test/test_output.candcore/test/test_model_feature_overload_ownership.c.Measured effect
That takes the
cpulane from 2,950 to roughly 1,590.17
nullptrfindings remain and are deliberately left alone rather than papered over — they sit outside the bracketed span and want individual attention.Type
refactor— no behavior changeChecklist
make format && make lintgreen locally —pre-commit run --filesclean on all 39 files (clang-format included).meson test --suite=fast→ 115 ok, 0 failed..c/.cpp/.cu/.h— none added.Bug-status hygiene (ADR-0165)
docs/state.mdupdated — no state delta: lint hygiene against epic Whole-tree clang-tidy debt down #1237; no tracked bug id opens or closes.Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score.Deep-dive deliverables (ADR-0108)
nullptrin C) is the thing that breaks the Windows build.AGENTS.mdinvariant note — no rebase-sensitive invariants: the bracket carries its own inline justification citing the ADR in every file, which is where a maintainer editing the file will see it.Reproducer
Known follow-ups
enable_dnn=autoresolves differently — a local--writewould not reproduce the lane's TU set. It is taken from CI's owntidy-ratchet-cpuartifact in a follow-up commit, which is exactly what the workflow step that uploads it instructs ("commit it as the new baseline when the ratchet asks"). The ratchet will fail this PR once with an exit-3 "tighten the baseline" until that lands.cpudebt after this is ~1,590, and the next largest cluster iscert-err33-c(unchecked return values) — e.g.core/test/test_pelorus_interop.cis 121 of its 161. That is a real code fix, not a suppression, and wants its own pass.