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
Since 3.10.4 CRGB lives in fl. Any unqualified call with an fl type argument (CRGB*, palettes, fl::vector, …) therefore also searches fl through argument-dependent lookup (ADL). If fl declares a function with the same name and signature as libc (memset(void*, int, size_t) and so on), the call is ambiguous. User sketches hit this as memset(leds, 0, sizeof(leds)) and free(buf) (#4827). #4830 works around it with template demotion (making fl::memcpy a template <typename = void> so libc wins a tie) plus <string.h>/<stdlib.h> in the stub Arduino.h. Renaming the mirrors removes the collision at the root, and the template trick, the stub includes and the linter allowlist entries in #4830 can then be reverted.
memcopy, aligned_alloc_via_malloc, aligned_free_via_malloc and aligned_free already have names that don't collide.
Math functions (abs, sqrt, sin, floor, pow, …) take arithmetic types, so ADL never pulls fl in. They can only collide under a using-directive for fl combined with <math.h>, which is a separate, lower-priority question.
fl::printf and fl::snprintf (about 970 call sites) are variadic and take const char*, so they are also outside ADL. Leave them alone unless we decide on a blanket rule.
Migration size (rough git grep on master)
Qualified fl::<name>( call sites for the names above: about 1,300. The biggest are strcmp (329), memcpy (186), memset (184), strlen (119), free (86), strstr (78) and malloc (57).
Unqualified calls inside namespace fl that currently resolve to the mirrors: about 200 for the hot names alone. These need care, because once the mirror is renamed a bare memcpy( silently binds to ::memcpy.
About 205 files include fl/stl/{cstring,malloc,cstdlib}.h.
The rename is mechanical, but it must be done with a tool that checks token boundaries, not a blind sed.
Codemod all call sites in src/, tests/ and examples/, covering both qualified fl::X( and unqualified X( inside fl.
Deprecation shim (optional, for one release): keep fl::memcpy and the others as [[deprecated]] template <typename = void> forwarders, so downstream code that calls fl::memcpy keeps compiling. Then delete them.
Linter (new Rust checker in ci/lint_cpp_rs/src/checkers/, modelled on bare_legacy.rs):
In src/fl/** and src/platforms/**, flag any declaration of a function whose name is in a libc-reserved list (a table in lint_core/, seeded with the C standard <string.h>, <stdlib.h> and <strings.h> names) inside namespace fl or its sub-namespaces.
Optionally flag fl::X( calls that use a reserved name, to catch regressions in tests and examples.
Allowlist: none expected after the migration. Platform shims that intentionally define libc symbols in global scope (newlib stubs, for example) stay out of scope because they are not in fl.
Naming: should it be fl::fl_memcpy (namespaced plus prefixed, which looks redundant but stays grep-friendly) or global fl_memcpy (C-style, matching the issue text)? The global form could collide with a user's fl_ symbols; the namespaced form cannot.
Proposed replacement: #4834 adds an exhaustive lint rule that requires every libc-named function in fl to be a force-inlined template wrapper, which keeps the #4830 fix from regressing without the ~1,300-site rename. If that lands, this issue can be closed as superseded.
Superseded by #4834 / #4835: the libc_mirror lint rule now enforces that every libc-named function in fl is a force-inlined template wrapper, which keeps #4830's fix from regressing without the ~1,300-site rename.
Activity
zackees commentedon Oct 13, 2026
Investigation: what's involved
Why this keeps happening
Since 3.10.4
CRGBlives infl. Any unqualified call with anfltype argument (CRGB*, palettes,fl::vector, …) therefore also searchesflthrough argument-dependent lookup (ADL). Iffldeclares a function with the same name and signature as libc (memset(void*, int, size_t)and so on), the call is ambiguous. User sketches hit this asmemset(leds, 0, sizeof(leds))andfree(buf)(#4827). #4830 works around it with template demotion (makingfl::memcpyatemplate <typename = void>so libc wins a tie) plus<string.h>/<stdlib.h>in the stubArduino.h. Renaming the mirrors removes the collision at the root, and the template trick, the stub includes and the linter allowlist entries in #4830 can then be reverted.Names in scope (current master)
fl/stl/cstring.hfl/stl/malloc.hfl/stl/cstdlib.hNot in scope:
memcopy,aligned_alloc_via_malloc,aligned_free_via_mallocandaligned_freealready have names that don't collide.abs,sqrt,sin,floor,pow, …) take arithmetic types, so ADL never pullsflin. They can only collide under a using-directive forflcombined with<math.h>, which is a separate, lower-priority question.fl::printfandfl::snprintf(about 970 call sites) are variadic and takeconst char*, so they are also outside ADL. Leave them alone unless we decide on a blanket rule.Migration size (rough
git grepon master)fl::<name>(call sites for the names above: about 1,300. The biggest arestrcmp(329),memcpy(186),memset(184),strlen(119),free(86),strstr(78) andmalloc(57).namespace flthat currently resolve to the mirrors: about 200 for the hot names alone. These need care, because once the mirror is renamed a barememcpy(silently binds to::memcpy.fl/stl/{cstring,malloc,cstdlib}.h.The rename is mechanical, but it must be done with a tool that checks token boundaries, not a blind
sed.Proposed plan
fl::X→fl::fl_X(or globalfl_X; decide below) in the three headers and their.cpp.hppfiles. Remove thelibc_impland template-demotion layer from fix: CRGB and other fl types no longer make libc/std calls ambiguous (#4827) #4830.src/,tests/andexamples/, covering both qualifiedfl::X(and unqualifiedX(inside fl.fl::memcpyand the others as[[deprecated]] template <typename = void>forwarders, so downstream code that callsfl::memcpykeeps compiling. Then delete them.ci/lint_cpp_rs/src/checkers/, modelled onbare_legacy.rs):src/fl/**andsrc/platforms/**, flag any declaration of a function whose name is in a libc-reserved list (a table inlint_core/, seeded with the C standard<string.h>,<stdlib.h>and<strings.h>names) insidenamespace flor its sub-namespaces.fl::X(calls that use a reserved name, to catch regressions in tests and examples.fl.tests/fl/stl/adl_barrier.cppfrom fix: CRGB and other fl types no longer make libc/std calls ambiguous (#4827) #4830 as the end-to-end guard (legacymemset,freeandqsortonCRGB*compiling with and without a using-directive forfl).Open decisions
fl::fl_memcpy(namespaced plus prefixed, which looks redundant but stays grep-friendly) or globalfl_memcpy(C-style, matching the issue text)? The global form could collide with a user'sfl_symbols; the namespaced form cannot.swap,sortand the other generic algorithms belong here? They collide withstd::, not libc. fix: CRGB and other fl types no longer make libc/std calls ambiguous (#4827) #4830 handles them withfl::adl_barrier, and renaming them would be far more invasive. This plan leaves them out.fl::memcpyforwarders ship for one release, or should they go now?zackees commentedon Oct 14, 2026
Proposed replacement: #4834 adds an exhaustive lint rule that requires every libc-named function in
flto be a force-inlined template wrapper, which keeps the #4830 fix from regressing without the ~1,300-site rename. If that lands, this issue can be closed as superseded.zackees commentedon Oct 14, 2026
Superseded by #4834 / #4835: the libc_mirror lint rule now enforces that every libc-named function in fl is a force-inlined template wrapper, which keeps #4830's fix from regressing without the ~1,300-site rename.