Skip to content

ci: enforce FL_NOEXCEPT on every owned function in src #2984

Closed

Description

@zackees

Context

Follow-up from #2983 and the broader #2974 / #2975 bloat work: exception landing-pad metadata is showing up around logging and cleanup paths, so missing FL_NOEXCEPT annotations are not just style drift. The project macro is spelled FL_NOEXCEPT (not FL_NO_EXCEPT).

I checked the current lint/tooling paths and found coverage gaps:

  • ci/lint_cpp/noexcept_checker.py claims to enforce FL_NOEXCEPT on functions in src/fl/ and src/platforms/, but it is not imported or instantiated by ci/lint_cpp/run_all_checkers.py. The unified runner currently wires RawNoexceptChecker and NoexceptSpecialMembersChecker, but not NoexceptFunctionChecker.
  • That regex checker is not ready to simply wire in as-is: running it standalone reports 3240 violations across 360 files and includes obvious false positives such as local variable declarations that look function-like.
  • The regex checker also intentionally excludes .cpp and .cpp.hpp, which is where many FastLED implementation functions live.
  • The AST-backed check is currently separate from normal C++ lint: ci/lint/stage_impls.py::run_noexcept_check() only runs when --tidy is enabled, skips if clang-query is missing, and delegates to ci/lint/clang_tidy/noexcept_platforms.py, whose scope is only src/platforms/.
  • ci/tools/check_noexcept.py already has platforms, fl, and all scopes, but that all-src AST check is not part of the default C++ lint path.

Current local probes on this checkout:

  • uv run python ci/tools/check_noexcept.py --scope platforms reports 15 candidate hits in 6 files. Some are real candidates, but the query also catches lambdas/destructors that need explicit matcher exclusions.
  • uv run python ci/tools/check_noexcept.py --scope fl reports 622 candidate hits in 37 files, including headers and .cpp.hpp implementations.
  • bloat: reduce dispatch-loop landing pad count in ChannelEngineRMTImpl::processPendingChannels #2980 already calls out one concrete mismatch: fl::ChannelData::writeWithPadding(fl::span<u8>) is declared FL_NOEXCEPT in src/fl/channel_data.h but the definition in src/fl/channel_data.cpp.hpp is missing the specifier.

The functions named in #2983 (createChannel and reconfigureForNetwork in src/platforms/esp/32/drivers/rmt/rmt_5/channel_driver_rmt.cpp.hpp) are already marked FL_NOEXCEPT in the current tree, so this issue is about preventing the next missed implementation function rather than fixing those two directly.

Proposal

Make FL_NOEXCEPT enforcement a precise, normal C++ lint requirement for all FastLED-owned source under src/.

Recommended direction:

  1. Promote the AST-backed check to cover all owned src/ C++ files, not only src/platforms/.
  2. Run it from the normal C++ lint path, not only bash lint --tidy.
  3. Keep the check precise enough for CI by excluding known non-actionable AST nodes: lambdas, implicit functions, deleted/defaulted declarations, intentionally unsupported compiler/runtime hooks, and any documented suppressions.
  4. Decide whether the noisy regex checker should be removed, fixed into a cheap precheck, or kept only as a unit-tested helper outside the unified runner.
  5. Add regression tests/fixtures that prove new functions in src/fl, src/platforms, headers, and .cpp.hpp implementation files fail lint when missing FL_NOEXCEPT.

Acceptance criteria

  • bash lint --cpp or the normal unified C++ linter fails for a newly-added non-exempt function under src/ that lacks FL_NOEXCEPT.
  • Coverage includes src/fl/**, src/platforms/**, headers, .cpp, and .cpp.hpp implementation files owned by FastLED.
  • The checker has explicit, tested exemptions for lambdas, implicit/defaulted/deleted functions, pure toolchain/C ABI hooks that cannot be annotated, and documented suppression comments.
  • Existing candidate hits are triaged into either real fixes or documented exemptions; the checker does not land with thousands of regex false positives.
  • The ChannelData::writeWithPadding declaration/definition mismatch noted in bloat: reduce dispatch-loop landing pad count in ChannelEngineRMTImpl::processPendingChannels #2980 is caught by the final lint setup.
  • CI documentation/help text makes clear whether this is a default lint check or requires a special flag.

Open questions

  • Should this remain clang-query based, or should it move into the Rust C++ linter once an AST-capable path exists there?
  • Should FL_NOEXCEPT be mandatory for literally every owned src/ function, or should there be a small allowlist for platform entry points / C ABI functions where exception specs are not valid or not worth enforcing?

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions