Skip to content

fix: lpc lint compliance + purge stale PCH after zccache meson snapshot restore - #2995

Merged
zackees merged 2 commits into
masterfrom
fix/lpc-lint-and-zccache-pch-guard
Jun 9, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/lpc-lint-and-zccache-pch-guard

Conversation

@zackees

@zackees zackees commented Jun 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • lpc lint fixes: io_lpc.cpp.hpp / runtime_lpc.cpp.hpp used FL_IS_ARM_LPC in preprocessor conditionals without including platforms/arm/is_arm.h (IsHeaderIncludeChecker); runtime_lpc.cpp.hpp also gets the // ok no namespace fl opt-out since global operator delete overrides and extern "C" runtime symbols cannot live in a namespace (PlatformsFlNamespaceChecker).
  • zccache PCH guard: zccache meson configure snapshots capture the entire build dir — including compiled clang PCHs and the compile_pch.py skip-cache sidecars (meson configure: snapshot captures build outputs from already-built dirs; restored stale clang PCH silently defeats #pragma once forge-ci/zccache#710). Restoring such a snapshot into a clean build dir resurrects a stale PCH whose embedded file identities silently defeat #pragma once dedup, producing redefinition of 'IChannelDriver'-style errors in every PCH-consuming test TU, and the restored .input_hash/.d.cache sidecars prevent the PCH from ever rebuilding. run_meson_setup_command() now purges *.pch / *.pch.input_hash / *.d.cache from the build dir whenever the setup output reports a [zccache-meson] hit, forcing a fresh PCH compile against the live tree. Belt-and-suspenders until zccache#710 lands.

Test plan

  • bash lint clean (previously failed on the two lpc files)
  • bash test --cpp — 310/310 tests pass
  • Purge helper smoke-tested: deletes exactly *.pch/*.pch.input_hash/*.d.cache, leaves .obj, build.ninja, and test_pch.h sources untouched
  • Next [zccache-meson] hit on a fresh build dir should log [MESON] Purged N PCH artifact(s)... and rebuild the PCH

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved build system cleanup logic to handle stale build artifacts.
    • Updated platform-specific include dependencies.

zackees and others added 2 commits June 9, 2026 13:25
io_lpc.cpp.hpp and runtime_lpc.cpp.hpp use FL_IS_ARM_LPC in
preprocessor conditionals without including is_arm.h; runtime_lpc
also holds global operator delete overrides that cannot live in
namespace fl, so mark it with the no-namespace opt-out comment.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
zccache meson configure snapshots capture the entire build dir
(forge-ci/zccache#710), so a restore can resurrect a stale clang PCH
whose embedded file identities silently defeat #pragma once dedup,
producing redefinition errors in every PCH-consuming test TU. The
restored .input_hash/.d.cache sidecars also make compile_pch.py skip
rebuilding it forever. Delete *.pch and its sidecars whenever the
setup output reports a [zccache-meson] hit so ninja recompiles the
PCH against the live tree.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds zccache PCH artifact cleanup logic to the Meson setup pipeline and adds a platform detection header include to LPC platform code. The build system now detects when zccache restores a meson snapshot and purges stale precompiled headers, forcing recompilation. Separately, ARM LPC platform code includes a header for ARM detection support.

Changes

PCH Artifact Purge on zccache Hit

Layer / File(s) Summary
PCH purge helper and setup integration
ci/meson/meson_setup_execute.py
Defines constants for zccache meson-hit detection and PCH artifact suffixes, implements a helper to recursively delete PCH files and sidecars from the build directory, and integrates detection and purging into the post-setup flow when a zccache snapshot hit marker appears in stdout.

ARM Platform Header Includes

Layer / File(s) Summary
Add is_arm.h to LPC platform headers
src/platforms/arm/lpc/io_lpc.cpp.hpp, src/platforms/arm/lpc/runtime_lpc.cpp.hpp
Includes platforms/arm/is_arm.h in both LPC I/O and runtime header files to provide ARM platform detection support; runtime header also adds a namespace guard comment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • FastLED/FastLED#2754: Wraps meson setup via zccache configure-cache, providing the snapshot restoration mechanism that this PR's purge logic responds to.
  • FastLED/FastLED#2811: Injects zccache wrapping into build.ninja after setup; complements this PR's artifact cleanup by handling the broader zccache integration points.
  • FastLED/FastLED#2685: Adjusts Meson include paths to prevent PCH identity drift; works alongside this PR's stale artifact purge to avoid PCH mismatch issues.

Poem

🐰 When PCH ghosts linger from cache restore,
Our helper sweeps artifacts off the floor,
With zccache hits now dutifully caught,
Fresh compilation is all that we sought!
And ARM headers find their true home at last,
The stale build demons—now firmly outcast. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures both main changes: LPC lint compliance fixes and the PCH purge logic for zccache meson snapshot restoration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lpc-lint-and-zccache-pch-guard

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 and usage tips.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 9, 2026
@zackees
zackees merged commit 356a379 into master Jun 9, 2026
7 of 8 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 9, 2026
@zackees
zackees deleted the fix/lpc-lint-and-zccache-pch-guard branch June 9, 2026 20:30
zackees added a commit that referenced this pull request Oct 16, 2026
* docs(skills): add /pch-debug skill and pch_probe.py

A skill that auto-activates on PCH failures ('redefinition of',
'redefines default argument', 'modified since the precompiled header',
tests that pass only after --clean). It explains the identity model
(#pragma once fails early; include guards hide the double read), the two
mechanisms in FastLED's history (path-spelling drift: #2685/zccache#619,
#3813; stale PCH accepted: #4839, #4437, #2995/zccache#710), and a
probe-before-clean procedure.

pch_probe.py: 'inputs' dumps what the PCH recorded (falls back to scanning
the PCH bytes when clang refuses a stale PCH) and flags odd spellings,
duplicate spellings and stale inputs; 'tu' runs a real compile_commands
entry with -H (optionally through zccache) and lists project headers
re-opened from disk next to their PCH spelling.

* pch_probe: llvm-bcanalyzer input records; repo-root-based project-header check (#4860 review)

- inputs: read the PCH with llvm-bcanalyzer -dump when available (PATH or
  LLVM_BCANALYZER): exact recorded spelling, size and mtime per input,
  without clang's stale-PCH validation; stale = size/mtime differ from the
  record (clang's own check). Falls back to -module-file-info / byte scan.
- Project headers are now classified by resolving under the repo root
  (derived from the script location), not by matching /src/ or /tests/ in
  the raw spelling: relative recorded entries like tests/... count, and any
  --build-dir location works.

* pch_probe: resolve relative recorded inputs against the build dir (#4860 review)
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.

1 participant