Skip to content

refactor(stl): remove FL_NO_UNWIND macro family (closes #2474) - #2475

Merged
zackees merged 1 commit into
masterfrom
chore/purge-fl-no-unwind-2474
May 13, 2026
Merged

zackees merged 1 commit into
masterfrom
chore/purge-fl-no-unwind-2474

Conversation

@zackees

@zackees zackees commented May 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Purges the FL_NO_UNWIND / FL_NO_UNWIND_BEGIN / FL_NO_UNWIND_END / FL_NO_UNWIND_ACTIVE macros and the FASTLED_FORCE_NO_UNWIND_TABLES / FASTLED_FORCE_UNWIND_TABLES overrides from src/fl/stl/compiler_control.h, plus the two ESP32 unity-build wrappers that referenced them and their corresponding test case.

Why

#pragma GCC optimize("no-unwind-tables") only toggles -funwind-tables. GCC's .eh_frame emitter on ESP32 is gated by -fasynchronous-unwind-tables (default on). Byte-level audit in #2473 showed platforms+.cpp.o wrapped in FL_NO_UNWIND_BEGIN still ships 3,007 FDE entries / 34,960 B of .eh_frame — identical to unwrapped siblings. Per GCC's own docs, __attribute__((optimize)) is intended for -O* levels; codegen-flag propagation through it is undefined.

The right place to strip .eh_frame is the build system (compile-line flags), tracked in FastLED/fbuild#243.

What's gone

  • src/fl/stl/compiler_control.h: FL_NO_UNWIND family + FASTLED_FORCE_*_UNWIND_TABLES (-127 LOC)
  • src/platforms/esp/32/_build.cpp.hpp: BEGIN/END wrappers + #include "fl/stl/compiler_control.h"
  • src/platforms/esp/32/drivers/_build.cpp.hpp: same cleanup
  • tests/fl/stl/compiler_control.cpp: the "FL_NO_UNWIND family" test case + the helper functions that only exercised it

What's added

  • src/fl/channels/README.md "Reducing Binary Size" section telling users to use build_flags = -fno-asynchronous-unwind-tables -fno-unwind-tables instead, with a migration note for anyone who had the FORCE macros set.

Risk

Zero runtime risk: the macros were no-ops, so removing them changes no emitted bytes. Users who had -DFASTLED_FORCE_NO_UNWIND_TABLES=1 in platformio.ini still compile — the -D is just unused. They'll need to swap to the build_flags form to actually shrink their binary (which is the whole point — the old form never did).

Test plan

  • Removed lines (5 files, +24/-188 net)
  • bash lint — clean
  • bash test --cpp — 304/304 unit tests pass; 142/142 example-DLL targets link successfully
  • CI green (Arduino / ESP32 / Teensy build matrix)

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added guidance for reducing binary size in ESP32-S3 release builds through platform configuration.
  • Refactor

    • Simplified compiler control mechanisms.
  • Tests

    • Updated test coverage for compiler control components.

Review Change Stack

The `FL_NO_UNWIND` / `FL_NO_UNWIND_BEGIN` / `FL_NO_UNWIND_END` /
`FL_NO_UNWIND_ACTIVE` macros and the `FASTLED_FORCE_NO_UNWIND_TABLES` /
`FASTLED_FORCE_UNWIND_TABLES` overrides expanded to
`#pragma GCC optimize("no-unwind-tables")`, which only toggles
`-funwind-tables`. GCC's `.eh_frame` emitter on ESP32 is gated by
`-fasynchronous-unwind-tables` (default on). A byte-level audit on
GCC 14.2.0 / xtensa-esp-elf (#2473) showed the wrapped
`platforms+.cpp.o` still ships 3,007 FDE entries / 34,960 B of
`.eh_frame` — identical to its unwrapped siblings. Per GCC's own docs
`__attribute__((optimize))` is only intended for `-O*` levels; codegen
flag propagation through it is undefined.

The correct fix is build-system flags (`-fno-asynchronous-unwind-tables
-fno-unwind-tables`), tracked in fbuild#243 for per-architecture rollout.
Until then, users get a documented migration path in
`src/fl/channels/README.md` ("Reducing Binary Size").

What this commit removes:
- `src/fl/stl/compiler_control.h`: FL_NO_UNWIND family (-127 LOC)
- `src/platforms/esp/32/_build.cpp.hpp`: BEGIN/END wrappers + include
- `src/platforms/esp/32/drivers/_build.cpp.hpp`: same cleanup
- `tests/fl/stl/compiler_control.cpp`: the FL_NO_UNWIND test case +
  helper functions that only existed to exercise the no-op macros

What this commit adds:
- `src/fl/channels/README.md` "Reducing Binary Size" section pointing
  users at the `build_flags` form that actually works, with a migration
  note for anyone who had `-DFASTLED_FORCE_NO_UNWIND_TABLES=1` set.

Zero runtime risk: the macros were no-ops, removing them changes no
emitted bytes. Users who had the FORCE_* defines set still compile
(the `-D` is just unused).

Related: #2421, #2423, #2473, fbuild#243

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR removes the FL_NO_UNWIND macro family that attempted pragma-based DWARF unwind table suppression, removes its usage from ESP32 build headers and tests, and documents the correct build-flags approach in platformio.ini instead.

Changes

FL_NO_UNWIND Macro Family Removal and Build-System Migration

Layer / File(s) Summary
Macro family removal from compiler_control.h
src/fl/stl/compiler_control.h
Removes FL_NO_UNWIND, FL_NO_UNWIND_BEGIN, FL_NO_UNWIND_END, and FL_NO_UNWIND_ACTIVE macros along with their GCC policy auto-detection and pragma emission logic.
ESP32 build system cleanup
src/platforms/esp/32/_build.cpp.hpp, src/platforms/esp/32/drivers/_build.cpp.hpp
Removes FL_NO_UNWIND_BEGIN/_END pragmas and compiler_control.h include directives from both platform and driver unity build headers.
Test coverage removal
tests/fl/stl/compiler_control.cpp
Removes helper functions (no_unwind_sum, no_unwind_block_sum, no_unwind_block_loop) and the entire "FL_NO_UNWIND family" test case block.
Binary size reduction documentation
src/fl/channels/README.md
Adds "Reducing Binary Size" section documenting the effective build_flags approach (-fno-asynchronous-unwind-tables, -fno-unwind-tables) and notes the removal of the defunct macro family.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2423: Prior PR that introduced FL_NO_UNWIND macros and their usage in build headers; this PR fully reverts that mechanism in favor of build-flags configuration.

Poem

🐰 The pragma whispered, "I'll strip those frames!"
But GCC smiled and ignored the claims—
Now build flags reign, proven and strong,
Where unwind tables don't belong!
Ninety kilobytes lighter, hopping along!

🚥 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 describes the main change: removal of the FL_NO_UNWIND macro family with a reference to the related issue #2474.
Linked Issues check ✅ Passed The PR implementation fully satisfies all coding requirements from #2474: removes FL_NO_UNWIND family and user override macros, removes their uses in ESP32 build wrappers, deletes related tests, and adds migration documentation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the objectives outlined in #2474; no unrelated modifications or scope creep detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 chore/purge-fl-no-unwind-2474

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/fl/channels/README.md (1)

1074-1075: ⚡ Quick win

Clarify the scope of build_flags impact on libstdc++.a.

The statement "also covers libstdc++.a and user TUs" may be misleading. Build flags in platformio.ini affect compilation units built during the user's build (FastLED sources and user sketch files), but cannot affect pre-built static libraries like libstdc++.a that ship with the toolchain.

Consider revising to clarify the actual scope, for example: "it actually shrinks the binary and covers all user-compiled code (both FastLED library files and user TUs), which the macros could not reach." This sets accurate expectations while still emphasizing the superiority of the build_flags approach.

📝 Suggested clarification
-actually shrinks the binary and also covers `libstdc++.a` and user TUs,
-which the macros could not reach. fbuild#243 will eventually apply
+actually shrinks the binary and covers all user-compiled code (both FastLED
+library files and user TUs), which the macros could not reach. fbuild#243 will eventually apply
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fl/channels/README.md` around lines 1074 - 1075, Update the sentence to
avoid implying build_flags in platformio.ini can alter pre-built toolchain
libraries like libstdc++.a; instead state that build_flags reduce the final
binary size for all user-compiled code (e.g., FastLED sources and user TUs) and
that pre-built static libraries such as libstdc++.a provided by the toolchain
are not affected. Reference the terms build_flags, platformio.ini, libstdc++.a,
and FastLED in the revised phrasing to make the scope explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/fl/channels/README.md`:
- Around line 1074-1075: Update the sentence to avoid implying build_flags in
platformio.ini can alter pre-built toolchain libraries like libstdc++.a; instead
state that build_flags reduce the final binary size for all user-compiled code
(e.g., FastLED sources and user TUs) and that pre-built static libraries such as
libstdc++.a provided by the toolchain are not affected. Reference the terms
build_flags, platformio.ini, libstdc++.a, and FastLED in the revised phrasing to
make the scope explicit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6cca9ca7-f71b-4990-9adf-defa22d36405

📥 Commits

Reviewing files that changed from the base of the PR and between 8616873 and 869dba5.

📒 Files selected for processing (5)
  • src/fl/channels/README.md
  • src/fl/stl/compiler_control.h
  • src/platforms/esp/32/_build.cpp.hpp
  • src/platforms/esp/32/drivers/_build.cpp.hpp
  • tests/fl/stl/compiler_control.cpp
💤 Files with no reviewable changes (4)
  • src/platforms/esp/32/drivers/_build.cpp.hpp
  • src/platforms/esp/32/_build.cpp.hpp
  • src/fl/stl/compiler_control.h
  • tests/fl/stl/compiler_control.cpp

@zackees
zackees merged commit 36abcfb into master May 13, 2026
6 of 9 checks passed
@zackees
zackees deleted the chore/purge-fl-no-unwind-2474 branch May 30, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Purge FL_NO_UNWIND macro family + FASTLED_FORCE_*_UNWIND_TABLES — pragma form is a no-op on GCC 14.2.0

1 participant