You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
singleton: sweep small (<=2-hit) files (Tier 1e) #3488
Mop up the long tail of files with 1–2 SingletonElisionChecker hits each. Each fix is 15 minutes. Doing them as a single sweep is more efficient than one PR per file.
In-scope
Files with ≤2 violations after Tier 0 tooling narrows the set. Rough candidates from the current scan:
Audited against the finding in #3754 / #3486: fl::Singleton elision pays off only for objects with dynamic initialization (those register .init_array entries that pull in a ctor and resist --gc-sections). It does nothing for constant-initialized PODs — builds already pass -ffunction-sections -fdata-sections (ci/boards.py:795), so those are already dropped when unreferenced. For PODs the wrap is a net loss: storage grows by a T*, every access gains a null-check, and constant-initialization (race-free) is replaced by Singleton<T>::instance()'s hand-rolled if (!ptr), which bypasses the C++11 magic-static guard.
12 hits across the current ≤2-hit set, all constant-initialized PODs. One target has moved.
src/fl/sensors/pir.cpp.hpp:16int g_counter = 0; is the canonical net-loss case: 4 bytes already gc-able, and the wrap would make it 8-12 plus a branch per access.
flowfield.cpp.hpp has moved to src/fl/fx/2d/ and now has zero hits (only static constexpr i32 FP_ONE at L484).
Remainder, all the same class: FastLED.cpp.hpp:70 (declared out of scope by this issue anyway), fl/stl/asio/http/server.cpp.hpp:680,947, fl/test/fltest.cpp.hpp:231-232, platforms/arm/lpc/platform_time_lpc.cpp.hpp:17-18, platforms/avr/attiny/clockless_blocking.cpp.hpp:16, platforms/shared/coroutine_context.cpp.hpp:23, platforms/wasm/audio_input_wasm.cpp.hpp:20 (host-only, out of scope).
Worth calling out: coroutine_context.cpp.hpp:23 is itself the backing pointer of a hand-rolled singleton — a permanent-allowlist entry, not a migration target.
Recommend closing as not-planned, or re-scoping to an annotation-only sweep if you want the warn stream quiet. See #3492.
Activity
zackees commentedon Jul 28, 2026
Audited against the finding in #3754 / #3486:
fl::Singletonelision pays off only for objects with dynamic initialization (those register.init_arrayentries that pull in a ctor and resist--gc-sections). It does nothing for constant-initialized PODs — builds already pass-ffunction-sections -fdata-sections(ci/boards.py:795), so those are already dropped when unreferenced. For PODs the wrap is a net loss: storage grows by aT*, every access gains a null-check, and constant-initialization (race-free) is replaced bySingleton<T>::instance()'s hand-rolledif (!ptr), which bypasses the C++11 magic-static guard.12 hits across the current ≤2-hit set, all constant-initialized PODs. One target has moved.
src/fl/sensors/pir.cpp.hpp:16int g_counter = 0;is the canonical net-loss case: 4 bytes already gc-able, and the wrap would make it 8-12 plus a branch per access.flowfield.cpp.hpphas moved tosrc/fl/fx/2d/and now has zero hits (onlystatic constexpr i32 FP_ONEat L484).Remainder, all the same class:
FastLED.cpp.hpp:70(declared out of scope by this issue anyway),fl/stl/asio/http/server.cpp.hpp:680,947,fl/test/fltest.cpp.hpp:231-232,platforms/arm/lpc/platform_time_lpc.cpp.hpp:17-18,platforms/avr/attiny/clockless_blocking.cpp.hpp:16,platforms/shared/coroutine_context.cpp.hpp:23,platforms/wasm/audio_input_wasm.cpp.hpp:20(host-only, out of scope).Worth calling out:
coroutine_context.cpp.hpp:23is itself the backing pointer of a hand-rolled singleton — a permanent-allowlist entry, not a migration target.Recommend closing as not-planned, or re-scoping to an annotation-only sweep if you want the warn stream quiet. See #3492.
singleton: sweep the safe <=2-hit files (Tier 1e)
singleton: sweep the safe <=2-hit files (Tier 1e) (#3756)