Repository navigation
refactor(stl): remove FL_NO_UNWIND macro family (closes #2474) - #2475
Conversation
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]>
📝 WalkthroughWalkthroughThis 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. ChangesFL_NO_UNWIND Macro Family Removal and Build-System Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/fl/channels/README.md (1)
1074-1075: ⚡ Quick winClarify the scope of build_flags impact on
libstdc++.a.The statement "also covers
libstdc++.aand user TUs" may be misleading. Build flags inplatformio.iniaffect compilation units built during the user's build (FastLED sources and user sketch files), but cannot affect pre-built static libraries likelibstdc++.athat 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
📒 Files selected for processing (5)
src/fl/channels/README.mdsrc/fl/stl/compiler_control.hsrc/platforms/esp/32/_build.cpp.hppsrc/platforms/esp/32/drivers/_build.cpp.hpptests/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
Summary
Purges the
FL_NO_UNWIND/FL_NO_UNWIND_BEGIN/FL_NO_UNWIND_END/FL_NO_UNWIND_ACTIVEmacros and theFASTLED_FORCE_NO_UNWIND_TABLES/FASTLED_FORCE_UNWIND_TABLESoverrides fromsrc/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_frameemitter on ESP32 is gated by-fasynchronous-unwind-tables(default on). Byte-level audit in #2473 showedplatforms+.cpp.owrapped inFL_NO_UNWIND_BEGINstill 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_frameis 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 cleanuptests/fl/stl/compiler_control.cpp: the "FL_NO_UNWIND family" test case + the helper functions that only exercised itWhat's added
src/fl/channels/README.md"Reducing Binary Size" section telling users to usebuild_flags = -fno-asynchronous-unwind-tables -fno-unwind-tablesinstead, 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=1inplatformio.inistill compile — the-Dis just unused. They'll need to swap to thebuild_flagsform to actually shrink their binary (which is the whole point — the old form never did).Test plan
bash lint— cleanbash test --cpp— 304/304 unit tests pass; 142/142 example-DLL targets link successfullyRelated
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Refactor
Tests