Repository navigation
Closed
Description
Context
#4834 shipped in #4835 (abf946379): the libc_mirror rule, its 11 unit tests, and the compile back-stop in tests/fl/stl/adl_barrier.cpp. All of these pass on master. An audit against the issue text found these remaining gaps:
| # | #4834 asked for | What shipped |
|---|---|---|
| 1 | Name table in ci/lint_cpp_rs/src/lint_core/ |
LIBC_RESERVED_NAMES is private to checkers/libc_mirror.rs |
| 2 | Linter tests in lint_core/tests_checkers.rs |
Inline #[cfg(test)] mod libc_mirror_tests in the checker |
| 3 | Tests "pass on the current headers and on libc_impl" |
Synthetic snippets only; real headers are covered only implicitly by bash lint |
| 4 | Compile back-stop covers every wrapper | Covers the 33 wrappers that exist today. A new, correctly shaped wrapper with no test line is not caught |
| 5 | (implicit) wide platform validation | No board compile sweep recorded on the PR |
Contradictions and how this issue resolves them
- Gap 2 vs. the size limit.
tests_checkers.rsis 795 lines. It is aninclude!-style split that exists only to stay under the linter's own 1,000-line-per-file ceiling. Moving about 100 lines oflibc_mirrortests into it pushes it toward that ceiling. Three other checkers already keep their tests inline. Resolution: keep the tests inline inlibc_mirror.rs, which follows existing practice. This issue amends lint: exhaustive libc-name rule for fl:: mirrors (supersedes #4832) #4834's wording rather than moving them. - Gap 1 vs. "the table lives with its only user."
lint_core/banned_header_data.rsis the existing precedent for data tables kept apart from logic. A shared table can also be reused by gap 4 below. Resolution: move the table tolint_core/libc_reserved_names.rsaspub(crate) const LIBC_RESERVED_NAMES. - Gap 4: is it a compile-test problem or a lint problem? A compile test can't enumerate wrappers that don't exist yet. Resolution: make it a lint check. Every
FlLibcTagwrapper name declared insrc/fl/stl/{cstring,malloc,cstdlib}.handsrc/fl/system/exit.hmust appear as an unqualified call intests/fl/stl/adl_barrier.cpp. The reverse also holds: every name the test lists must still exist, so the test can't go stale. This closes the loop without anyone having to remember a manual step.
Plan (one PR)
- Table: move
LIBC_RESERVED_NAMESintolint_core/libc_reserved_names.rs, register it inlib.rs, and import it fromcheckers/libc_mirror.rs. No change in behaviour. - Real-header tests: add inline tests that
include_str!the realsrc/fl/stl/cstring.h,malloc.h,cstdlib.h,src/fl/system/exit.hand thelibc_impl*.cpp.hppdefinitions, then assertlibc_mirror_violations(..)is empty. Add a mutation test that rewrites one real wrapper'sFASTLED_FORCE_INLINEtoinlineand asserts it fails, which proves the real-header test is not vacuous. - Back-stop coverage check: add a cross-file check, placed next to the existing structural Python ratchets or as a Rust whole-repo processor, whichever fits
agents/docs/linter-architecture.md. It compares the set of wrapper names in the headers with the set of names called inadl_barrier.cppand fails on any difference in either direction. Red evidence: add a dummy wrapper and confirm the check fails. - Docs: update
checkers/README.mdand theadl_barrier.cppheader comment to describe the two-way coverage contract. - Validation before merge:
bash lint,soldr cargo testinci/lint_cpp_rs, andbash test adl_barrier(re-run with--debugif it fails).- A local compile sweep of
Blinkand anfl/stl-heavy example on the board names frombash ci-labels list --json: at least uno, attiny85, esp32dev, esp32s3, esp32c6, teensy41, rp2040, an stm32, an nrf52 and wasm. - Dispatch
ci-fullon the PR head SHA.
Out of scope
The same as #4834: math functions, printf-family functions, and adl_barrier generics.
Done when
- Gaps 1, 3, 4 and 5 are closed, and gap 2 is closed by the amendment above.
- The negative tests from steps 2 and 3 fail as expected.
- The PR is merged with
ci-fullgreen and the board sweep results posted on it.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
lint: finish libc_mirror — shared name table, real-tree tests, back-s…
lint(libc_backstop): treat removed arithmetic wrappers as stale too (#…
lint: finish libc_mirror — shared name table, real-tree tests, back-s…