Skip to content

lint(bare_noinline_checker): regex doesn't catch compound attributes like __attribute__((naked, noinline, used)) #2854

Closed

Description

@zackees

Symptom

ci/lint_cpp/bare_noinline_checker.py (landed in #2830 as the #2773-item-2.1 follow-up) bans bare __attribute__((noinline)) in src/ so MSVC host builds don't silently lose noinline semantics. The intent is documented in the checker's module docstring:

...silently no-ops under MSVC, so a host build that flows through the MSVC toolchain (e.g. CI's WASM/Windows host tests) can quietly lose the noinline semantics — exactly the kind of regression #2773 item 2.1 exists to prevent...

But the regex requires noinline to be the only attribute inside the parens:

r"__attribute__\s*\(\s*\(\s*noinline\s*\)\s*\)"

So compound attribute lists fall through silently. Live cases in src/:

src/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h:101:__attribute__((used, noinline))
src/platforms/arm/teensy/coroutine_teensy.impl.hpp:145:__attribute__((naked, noinline, used))

Both compound forms are also GCC/Clang-only (MSVC has no equivalent for naked or used either) so the same drift the lint is guarding against applies to them — the only reason it doesn't bite is that those specific files are gated to ARM platforms and never flow through MSVC. That's a fragile invariant.

Two reasonable resolutions

A. Harden the regex to match compound attribute lists

_BANNED_PATTERN = re.compile(
    r"__attribute__\s*\(\s*\([^)]*\bnoinline\b[^)]*\)\s*\)"
    r"|"
    r"__declspec\s*\(\s*noinline\s*\)"
)

Then add // ok noinline suppression on the two ARM call sites (since they're correct as written for those platforms) — same escape hatch the lint already documents.

B. Document the gap explicitly

Add a comment block above _BANNED_PATTERN saying "compound attribute lists are intentionally not matched; rely on platform-file gates" and add nrf52/ + teensy/ to the EXEMPT_FILES glob list directly so the intent is greppable. Less safe long-term but no behaviour change.

A is the better call IMO — the lint's stated rationale ("silently no-op under MSVC") applies identically to the compound forms, so making the regex match all noinline-bearing attribute lists is the consistent answer. The two existing compound sites are easy to suppress with // ok noinline.

Scope

  • Self-contained change in ci/lint_cpp/bare_noinline_checker.py (regex + maybe inline comments at the two call sites).
  • Doesn't affect any compiled output — purely a lint hardening.
  • Closes a real "looks lint-clean today, will silently break tomorrow if someone adds another compound noinline" gap.

Part of a small infra sweep tracked at #2855.

🤖 Filed by Claude Code via /goal session

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 6, 2026
  2. added a commit that references this issue on Jun 6, 2026
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