Repository navigation
Description
Request
Fully implement real FL_NO_EXCEPT / noexcept support on all supported ESP platforms, replacing the current ESP noop with correct, validated exception specifications. FastLED assumes nonthrowing contracts in every build mode and neither throws nor catches C++ exceptions. The system may enable exception frames in debug mode for crash tracing and owns whether subsystem exceptions are allowed. ESP SDK fault/panic diagnostics must remain intact. This is a dedicated follow-up to the noexcept investigation for #4707 and #4771.
Verified current state
src/fl/stl/noexcept.hintentionally definesFL_NO_EXCEPTas empty on every platform.FL_HAS_NOEXCEPTis therefore absent;FL_DTOR_NOEXCEPTalready expands to realnoexcept.src/platforms/esp/is_esp.hidentifies ESP8266 and ESP32, S2, S3, C2, C3, C5, C6, H2 and P4, across Xtensa and RISC-V.- The preserved
experiment/esp32-noexcept-4707branch, commitdeedad18f3, shows real annotations can reduce allocated flash. It is research evidence, not a production implementation to merge wholesale.
The experiment exposed declaration/definition and virtual-override mismatches, malformed annotation placement, C++11 function-pointer alias incompatibility, and forced default-ctor exception specifications that caused old GCC to delete constructors. Generic functions can invoke arbitrary user callbacks, visitors and constructors; blindly enabling existing annotations can change exception propagation into termination.
Measured motivation
Default Blink, identical sketch/profile within each comparison, after restoring the string unity group in the experiment:
| Profile | Experimental checkpoint | Final real-noexcept experiment | Change |
|---|---|---|---|
| Legacy ESP32 | 273,173 B | 256,801 B | -16,372 B |
| Modern ESP32 | 289,927 B | 289,975 B | +48 B |
| ESP32-S3 | 353,571 B | 344,763 B | -8,808 B |
Static DRAM was unchanged. The modern profile's effective exception flag was off; legacy and S3 enabled exceptions. These numbers include an experimental unity restoration and are not forecasts for a safe, narrowly scoped implementation on current master.
All three experimental board builds and targeted native debug tests passed, but 25 lint findings remained and no full platform matrix/hardware execution was completed. Detailed measurements, retention graph and limitations.
Implementation scope
- Enable real
FL_NO_EXCEPTon supported ESP builds, with truthfulFL_HAS_NOEXCEPTdetection and consistent behavior regardless of header include order. Respect existing external macro overrides. Preserve current non-ESP behavior. - Audit all annotated code reachable by those targets, including shared STL and platform interfaces. Make declarations, definitions, overrides and valid forward declarations agree. Repair invalid macro placements without moving implementations or redesigning APIs.
- Retain the existing nonthrowing callback/visitor/allocator/Singleton contracts. Do not introduce user exception propagation, throwing-callback tests, or exception-enabled debug configurations. Audit annotations for valid compiler syntax and declaration consistency.
- Preserve SDK/C vendor signatures, C++11 compatibility and compiler-inferred defaulted special-member specs where required. Preserve
FL_DTOR_NOEXCEPTownership contracts. - Reconcile directly related annotation lint rules/findings with valid compiler and API contracts. Do not force incorrect exception promises just to satisfy lint.
Explicit directives and scope limits
This issue authorizes the ESP noexcept implementation and the minimal shared declaration/definition/template fixes necessary for correct ESP exception contracts. It does not authorize an unrelated repository-wide rewrite, mass annotation cleanup of unrelated code, or importing the approximately 180-file experiment wholesale.
Build-file directive: only narrowly scoped edits to existing test/build validation configurations or source inventories required to register noexcept probes and exercise the ESP validation matrix are authorized by this issue. Each such edit must cite this issue and explain its necessity in the PR. Following the maintainer clarification during implementation, narrowly scoped ESP configuration edits to make -fno-exceptions the default for default release builds, while preserving system-owned debug exception/frame policy are authorized. Record effective final flag ordering and measure exception-policy savings separately from annotation savings. Do not change production build architecture, unity include routers, canonical compilation-unit boundaries or linker scripts to obtain a size result. Do not add new GitHub Actions workflow files. A broader build change requires a separate explicit maintainer directive in this issue before implementation.
PR #4736 is closed unmerged as history; do not merge or revive it for this work. Keep implementation PRs focused and separately reviewable.
Acceptance criteria
- Record RED → GREEN evidence: an ESP compile-time probe initially fails because the macro is a noop, then passes after implementation; assert truthful
FL_HAS_NOEXCEPTandnoexcept(...)on representative guaranteed-nonthrowing operations. Cover external overrides and include-order independence. - Verify default ESP builds have effective
-fno-exceptions; inherited framework-fexceptionsmust not win. FastLED itself must neither throw nor catch; system-owned debug exception frames remain allowed. Preserve existing SDK panic/backtrace and unwind diagnostics settings. - Audit declaration/definition/override consistency and retain nonthrowing callback contracts. Validate compiler-feature probes with C++ exceptions disabled.
- Compile all supported ESP families: ESP8266; original ESP32; S2/S3; C2/C3/C5/C6/H2/P4. Record exact board profile, architecture, framework/SDK/compiler and effective exception flags. Cover legacy IDF4/GCC8 and modern IDF5 Arduino profiles, and supported standalone ESP-IDF configurations. Unsupported toolchain combinations must be explicitly documented rather than silently skipped.
- Compile representative core/STL consumers and supported driver/feature paths, not only Blink. Verify normal exception-disabled configurations including debug instrumentation with system-owned exception/frame policy.
- Run relevant native sanitizer tests, full required native/example gates and annotation lint. Verify representative non-ESP AVR, WASM and host configurations retain their existing macro behavior and compile successfully.
- Measure allocated flash, retained unwind/exception sections and static DRAM before/after on unchanged sketches, source layout and toolchains. Separate measurements of the intentionally changed default exception policy from measurements of annotations under matching compiler flags. Report zero savings or regressions honestly; include at least legacy ESP32, modern ESP32, S3 and a RISC-V ESP target. Do not use unity splitting or disabling supported features to satisfy the comparison. Disabling exception handling by default is an explicit maintainer requirement, and its effect must be reported honestly as a compiler-policy change.
- Publish exact-SHA validation and residual limitations before claiming all-platform support. Document macro behavior and valid callback/template exception contracts.
Decisions
- “No accept” in the request refers to the existing
FL_NO_EXCEPT/ C++noexceptwork. - “All ESP platforms” includes ESP8266 and every supported ESP32 family detected by the existing platform header, not just the three measured ESP32 profiles.
- This is an ordinary implementation issue, separate from the broader flash optimization checkpoint perf: resume ESP32 flash optimization with consolidated unity builds (#4707) #4771. Filing it does not resume the paused optimization goal or authorize a merge/release.
- Future unity restoration remains separate work requiring its own explicit directive; it is not part of this implementation issue.
Maintainer clarification during implementation
FastLED assumes nonthrowing contracts in every mode and will neither throw nor catch C++ exceptions. The system may allow exception frames in debug mode for crash tracing and controls whether subsystems may throw. This does not authorize callback exception propagation through FastLED or an exception-enabled FastLED implementation. Preserve SDK crash stack traces, fault vectors, vendor linker retention, unwind frames and diagnostic configuration.
Verified baseline flags: legacy ESP32, S3 and C3 inherit -fexceptions; modern ESP32 appends -fno-exceptions. Measure compiler policy changes separately from real annotations. Do not override system debug policy.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 7, 2026
Maintainer clarification recorded in the issue body: default ESP builds must eliminate C++ exception handling; exception-enabled support is limited to an explicit debug configuration.
Investigation confirmed legacy ESP32, S3 and C3 currently inherit
-fexceptions; modern ESP32 disables exceptions afterward. Native/WASM already disable exceptions in ordinary builds, including their normal debug instrumentation.The implementation will correct the ESP default policy with narrowly scoped configuration changes, keep production unity/linker architecture intact, and measure compiler-policy savings separately from annotation savings. The optional exception propagation/cleanup probe will be confined to explicit debug validation. No release build will enable exceptions for those tests.
zackees commentedon Oct 7, 2026
Maintainer clarification supersedes my earlier debug exception opt-in interpretation: FastLED supports no C++ exceptions in any build mode. Foreground callbacks retain nonthrowing contracts. ESP SDK fault/panic handling below the HAL and its stack trace diagnostics remain intact. The implementation will not add exception propagation or an exception-enabled debug configuration.
zackees commentedon Oct 7, 2026
Maintainer scope expansion: strict FL_NO_EXCEPT lint
The maintainer explicitly directed this change during implementation:
This expands #4773 to remove grandfathered missing-annotation baseline exemptions and complete the FastLED-owned annotation backlog with strict lint enforcement. Broad annotation edits and the directly required lint/refactor tooling changes are now authorized. This does not authorize changing unity-build layout, function bodies, vendor linker scripts, or adding workflows.
FastLED assumes no throw and neither throws nor catches in every mode. System-owned debug exception frames/crash diagnostics remain under platform control. Required vendor C ABI signatures and compiler-inferred defaulted special members must remain valid; they are distinct from grandfathered missing FastLED annotations.
RED recorded: with the grandfathered baseline emptied,
bash lint --cppfails for existing common-code omissions. The old baseline contained 7,078 entries. The strict implementation must turn that signal GREEN without recreating a debt baseline. Existing ESP release/debug-compatible and non-ESP validation still applies.zackees commentedon Oct 7, 2026
Concrete archive and metadata retention graph
The preserved legacy before map strengthens the object-level graph:
Evidence in
.build/size-4773/before-esp32dev_idf44.map: archive extraction lines27–28, discarded function text lines37774–37775, allocated frame input line131839. The cross-reference table at169062 repeats the importer.This shows archive selection and metadata retention even though the named function code was removed. Across FastLED objects,49 allocated EH inputs total171195 B before and disappear after release compiler policy. It does not prove that every retained frame pins its corresponding function code.
Preserved before artifacts contain maps/JSON/provenance, without the original ELF/object relocations or an FDE dump. Individual symbol-to-FDE edges cannot be reconstructed honestly from those artifacts.
Recommendation: retain production unity layout, enforce library no-throw contracts and disable release exceptions when compiling FastLED. A singleton migration cannot override compiler metadata emission or SDK KEEP. Debug system-owned unwind/panic handling remains intact.
PR #4774 is pushed at c89e03d and complete CI is running. Ordinary examples have no edits; AutoResearch retains macros under the maintainer's explicit exemption. Independent validation failures are tracked in #4775 and #4779.