Skip to content

lint: AdlBarrierChecker keeps barrier names out of fl and reachable (#4851) - #4854

Merged
zackees merged 1 commit into
masterfrom
lint/adl-barrier-overloads-4851
Oct 16, 2026
Merged

zackees merged 1 commit into
masterfrom
lint/adl-barrier-overloads-4851

Conversation

@zackees

@zackees zackees commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Closes #4851. Part of #4844.

src/fl/stl/adl_barrier.h says put every namespace-scope overload of a barrier name in the barrier, but nothing enforced that rule. This adds a structural lint pass, checkers/adl_barrier.rs:

  1. It collects every function declared directly in fl::adl_barrier across src/.
  2. Overload rule: a function with one of those names declared directly in fl (inline and anonymous namespaces count) fails. Such an overload is visible to ADL again, so it can tie with std::, and qualified fl::name lookup stops at fl and never reaches the barrier's overloads.
  3. Reachability coverage: every barrier function must be called as fl::name in the every adl_barrier name is reachable as fl::name case of tests/fl/stl/adl_barrier.cpp. This is the compile check that qualified lookup still works.

The coverage rule immediately found fl::equal_container and fl::sort_small uncovered (the real-tree test failed). Both are now called in that test case.

Not flagged (unit tests cover each): calls, class members, sub-namespaces such as fl::detail, code outside fl, and decltype/initializer uses. swap and clamp stay directly in fl by design and are not barrier names, so they are not affected.

Evidence: 6 adl_barrier checker tests pass, including real_tree_passes. bash test adl_barrier passes. bash lint: 0.

Summary by CodeRabbit

  • Development Tooling
    • Added checks that detect barrier functions declared outside their intended namespace and ensure they’re called with qualified names.
  • Tests
    • Expanded coverage for qualified lookup of barrier functions, including overloads with default and explicit comparators. These checks help catch lookup issues before changes reach users.

…4851)

New structural pass. Collects every function declared directly in
fl::adl_barrier across src/, then fails on (1) any function of the same name
declared directly in fl (incl. inline/anonymous namespaces): ADL finds it
again and qualified fl::name lookup stops before the barrier, and (2) any
barrier function not called as fl::name in adl_barrier.cpp's reachability
test case. (2) immediately found fl::equal_container and fl::sort_small
uncovered; they are now called there.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70a27315-aef6-47d0-8f7c-57bf361544f1
📥 Commits

Reviewing files that changed from the base of the PR and between 01e9586 and 86763bc.

📒 Files selected for processing: 6
  • ci/lint_cpp_rs/src/checkers/README.md
  • ci/lint_cpp_rs/src/checkers/adl_barrier.rs
  • ci/lint_cpp_rs/src/checkers/structural_passes.rs
  • ci/lint_cpp_rs/src/lib.rs
  • src/fl/stl/adl_barrier.h
  • tests/fl/stl/adl_barrier.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

📝 Walkthrough

The pull request adds a structural lint checker for fl::adl_barrier names. It detects matching declarations directly in fl and requires qualified calls in a designated test case. The checker is integrated into structural passes, with related tests and documentation updated.

Changes: ADL barrier lint

Layer / File(s) Summary
Detect barrier declarations and qualified calls
ci/lint_cpp_rs/src/checkers/adl_barrier.rs
The checker identifies namespace-scope function declarations and collects qualified calls in the designated test case. It handles inline and anonymous namespaces and filters out calls and other excluded forms.
Report violations and integrate the checker
ci/lint_cpp_rs/src/checkers/adl_barrier.rs, ci/lint_cpp_rs/src/checkers/structural_passes.rs, ci/lint_cpp_rs/src/lib.rs, tests/fl/stl/adl_barrier.cpp, ci/lint_cpp_rs/src/checkers/README.md, src/fl/stl/adl_barrier.h
The checker reports direct fl declarations, a missing test case, and barrier names not called as fl::name. Structural passes now run the checker. Unit tests and the qualified-lookup test cover the rule, and documentation describes it.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant StructuralPasses
  participant adl_barrier_pass
  participant SourceFiles
  participant ReachabilityTest
  participant LintViolations
  StructuralPasses->>adl_barrier_pass: Run structural check
  adl_barrier_pass->>SourceFiles: Read .h, .hpp, and .cpp files under src
  adl_barrier_pass->>ReachabilityTest: Read designated test source
  adl_barrier_pass->>LintViolations: Convert detected violations
Loading
Merge Risk: ⚪ Minimal · up to 86763

This change adds a lint check that runs only in the repository's own tooling and does not alter library behavior. No actionable merge-blocking issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 5 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: adding AdlBarrierChecker to keep barrier names out of fl and verify their reachability.
Linked Issues check Passed The PR implements the coding requirement in #4851. AdlBarrierChecker collects function names declared in fl::adl_barrier across src/ and reports same-named functions declared directly in fl. I…
Out of Scope Changes check Passed The changes stay within the stated scope of #4851 and the PR intent. The checker registration, checker tests, documentation, and added qualified calls support enforcement of the barrier rule and looku…
Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees merged commit 647c0d1 into master Oct 16, 2026
120 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 16, 2026
@zackees
zackees deleted the lint/adl-barrier-overloads-4851 branch November 5, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

lint: require every overload of an fl::adl_barrier name to stay inside the barrier

1 participant