Repository navigation
Add FL_STATIC_ASSERT wrapper and lint - #2390
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (33)
📝 WalkthroughWalkthroughThe PR introduces a centralized Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
📊 Header Compilation PerformanceTotal Time: 1197.20ms Top 5 Slowest Headers
Warnings
Full Report |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (16)
src/fl/stl/bitset.h (1)
1-10:⚠️ Potential issue | 🟠 MajorAdd missing include for
FL_STATIC_ASSERT.
FL_STATIC_ASSERTis used on line 44 butfl/stl/static_assert.his not included. None of the currently-included headers provide this macro transitively, so the header will fail to compile stand-alone. Add the include directly.Proposed fix
`#include` "fl/stl/variant.h" `#include` "fl/stl/bitset_dynamic.h" `#include` "fl/stl/int.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/bitset.h` around lines 1 - 10, The header uses the macro FL_STATIC_ASSERT (referenced in bitset.h) but does not include its definition; add `#include` "fl/stl/static_assert.h" to the includes at the top of src/fl/stl/bitset.h (alongside the other fl/stl/*.h includes) so the macro is available when bitset.h is used standalone.src/fl/stl/ratio.h (1)
9-11:⚠️ Potential issue | 🟠 MajorAdd missing direct include for
FL_STATIC_ASSERT.Line 21 uses
FL_STATIC_ASSERTbut this header only includesfl/stl/int.hin its transitive chain, which does not provide the macro definition. Add a direct include to make this header self-contained.Proposed fix
`#include` "fl/stl/int.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/ratio.h` around lines 9 - 11, The header uses the macro FL_STATIC_ASSERT (seen around the static assertion at line 21) but only includes fl/stl/int.h transitively; make the header self-contained by adding a direct `#include` for the header that defines FL_STATIC_ASSERT (the library's static-assert header) at the top of ratio.h before any usage, so FL_STATIC_ASSERT is always available when including ratio.h.src/chipsets.h (1)
8-18:⚠️ Potential issue | 🟡 MinorInclude
fl/stl/static_assert.hdirectly before usingFL_STATIC_ASSERT.Line 217 now depends on the wrapper macro, but this header does not include its definition directly. Avoid relying on transitive includes.
Proposed fix
`#include` "fl/stl/compiler_control.h" +#include "fl/stl/static_assert.h" `#include` "fl/stl/bit_cast.h"Also applies to: 217-217
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/chipsets.h` around lines 8 - 18, The header chipsets.h uses the FL_STATIC_ASSERT macro (around the current line ~217) but does not include its definition; add an explicit include of "fl/stl/static_assert.h" at the top of chipsets.h (near the other fl/stl includes) so FL_STATIC_ASSERT is defined locally rather than relying on transitive includes.src/fl/stl/charconv.h (1)
12-15:⚠️ Potential issue | 🟠 MajorAdd the missing
FL_STATIC_ASSERTinclude.Line 60 uses the project static-assert wrapper, but this header does not include its definition. Direct inclusion of
fl/stl/charconv.hcan fail depending on include order.Proposed fix
`#include` "fl/stl/stdint.h" // For u64, uint8_t `#include` "fl/stl/cstddef.h" // For fl::size_t `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"Also applies to: 60-60
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/charconv.h` around lines 12 - 15, The header fl/stl/charconv.h uses the FL_STATIC_ASSERT macro but doesn't include its definition; add an include for the static-assert wrapper (e.g. include "fl/stl/static_assert.h") at the top of charconv.h so FL_STATIC_ASSERT is always available regardless of include order; ensure the include appears alongside the other fl/stl/* includes so references to FL_STATIC_ASSERT in this header compile unconditionally.src/FastLED.h (1)
1004-1027:⚠️ Potential issue | 🟡 MinorReorder assertions before dependent typedefs and explicitly include the static-assert header.
FastLED.hmakesFL_STATIC_ASSERTavailable through a transitive include viacpp_compat.h, but the dependency should be explicit. Additionally, in the first two SPI overloads (lines 1004–1011 and 1013–1020), the dependent typename lookup occurs before the validity check, which allows compilers to emit confusing "type not found" errors for invalid chipsets instead of the clear "Unsupported chipset" message.Proposed fix
`#include` "fl/stl/compiler_control.h" +#include "fl/stl/static_assert.h" `#include` "cpp_compat.h"/// Add an SPI based CLEDController instance to the world (legacy path). template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE > ::CLEDController &addLeds(CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) { // Instantiate the controller using ClockedChipsetHelper typedef ClockedChipsetHelper<CHIPSET, DATA_PIN, CLOCK_PIN> CHIP; - typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER_AND_FREQ<RGB_ORDER, SPI_DATA_RATE>::ControllerType ControllerTypeWithFreq; FL_STATIC_ASSERT(CHIP::IS_VALID, "Unsupported chipset"); + typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER_AND_FREQ<RGB_ORDER, SPI_DATA_RATE>::ControllerType ControllerTypeWithFreq; static ControllerTypeWithFreq c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); } /// Add an SPI based CLEDController instance to the world (legacy path). template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN > static ::CLEDController &addLeds(CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) { typedef ClockedChipsetHelper<CHIPSET, DATA_PIN, CLOCK_PIN> CHIP; - typedef typename CHIP::ControllerType ControllerType; FL_STATIC_ASSERT(CHIP::IS_VALID, "Unsupported chipset"); + typedef typename CHIP::ControllerType ControllerType; static ControllerType c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/FastLED.h` around lines 1004 - 1027, Move the FL_STATIC_ASSERT check before any dependent typedefs in the SPI addLeds overloads so the chipset validity is checked first: in the template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE> overload (where ControllerTypeWithFreq is typedef'd), the template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN> legacy overload (where ControllerType is typedef'd), and the template<ESPIChipsets ... RGB_ORDER> overload (where ControllerTypeWithOrder is typedef'd) place FL_STATIC_ASSERT(CHIP::IS_VALID, "Unsupported chipset"); immediately after defining typedef ClockedChipsetHelper<...> CHIP and before any typename/ControllerType typedefs; also add an explicit include of the header that defines FL_STATIC_ASSERT (e.g., include the cpp_compat header that provides it) near the top of FastLED.h so the static-assert symbol is not only transitively available.src/fl/stl/string.cpp.hpp (1)
1-14:⚠️ Potential issue | 🟠 MajorInclude
fl/stl/static_assert.hin this translation unit fragment.
string.cpp.hppdirectly usesFL_STATIC_ASSERT, so it should include the macro provider rather than depending on another included header to provide it.Proposed fix
`#include` "fl/stl/compiler_control.h" +#include "fl/stl/static_assert.h" `#include` "fl/math/xymap.h"Also applies to: 86-91
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/string.cpp.hpp` around lines 1 - 14, The translation unit uses the FL_STATIC_ASSERT macro but doesn't include its provider; add `#include` "fl/stl/static_assert.h" to this fragment (and the corresponding second fragment around the other occurrence) so FL_STATIC_ASSERT is defined directly rather than relying on other headers; locate the uses of FL_STATIC_ASSERT in string.cpp.hpp and add the include near the top with the other fl/stl/* includes to ensure the macro is available.src/fl/stl/type_traits.h (1)
7-10:⚠️ Potential issue | 🔴 CriticalInclude the
FL_STATIC_ASSERTprovider before using the macro.
type_traits.hnow directly usesFL_STATIC_ASSERT, but this file does not includefl/stl/static_assert.h. Standalone includes can fail depending on include order.Proposed fix
`#include` "fl/stl/move.h" `#include` "fl/stl/int.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"Also applies to: 240-241, 614-615
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/type_traits.h` around lines 7 - 10, type_traits.h uses the FL_STATIC_ASSERT macro without including its provider; add `#include` "fl/stl/static_assert.h" to the top include block (alongside fl/stl/move.h, fl/stl/int.h, fl/stl/noexcept.h) so FL_STATIC_ASSERT is defined regardless of include order, and ensure the same include is present where FL_STATIC_ASSERT is used later in the file (the other occurrences around the 240-241 and 614-615 regions) so all uses reference the header that provides the macro.src/fl/stl/not_null.h (1)
48-50:⚠️ Potential issue | 🟠 MajorAdd the direct include for
FL_STATIC_ASSERT.
not_null.hnow directly usesFL_STATIC_ASSERT, but it does not includefl/stl/static_assert.h. Avoid relying on transitive include order here.Proposed fix
`#include` "fl/stl/type_traits.h" `#include` "fl/stl/cstddef.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"Also applies to: 154-158
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/not_null.h` around lines 48 - 50, not_null.h uses the macro FL_STATIC_ASSERT but does not include its header; add an explicit `#include` "fl/stl/static_assert.h" at the top of not_null.h (near the other includes) so the file no longer relies on transitive includes; apply the same change for the other occurrence later in the file where FL_STATIC_ASSERT is used (the block around the functions/classes that reference FL_STATIC_ASSERT).src/fl/stl/bit_cast.h (1)
10-13:⚠️ Potential issue | 🟡 MinorMissing
fl/stl/static_assert.hinclude.FL_STATIC_ASSERTis used at lines 48–50 but the header is not directly included. Other files migrated in this PR (e.g.,compile_test.cpp.hpp,clockless_i2s_esp32.h) added the include — please do the same here.🔧 Proposed fix
`#include` "fl/stl/type_traits.h" `#include` "fl/stl/cstring.h" `#include` "fl/stl/int.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/bit_cast.h` around lines 10 - 13, Bit_cast.h uses the FL_STATIC_ASSERT macro (lines around 48–50) but doesn't include its defining header; add an include for "fl/stl/static_assert.h" at the top of src/fl/stl/bit_cast.h alongside the other includes so FL_STATIC_ASSERT is available when functions like bit_cast are compiled.src/fl/fltest.h (1)
25-29:⚠️ Potential issue | 🟡 Minor**Add
#include "fl/stl/static_assert.h"—FL_STATIC_ASSERTis used at lines 1906 and 1918 but the defining header is not included here. Relying on transitive inclusion is fragile, and any TU that usesFL_TEST_CASE_TEMPLATE_INVOKE/_APPLYwithout havingFL_STATIC_ASSERTalready visible will fail to compile.🔧 Proposed fix
`#include` "fl/stl/compiler_control.h" // FL_PRETTY_FUNCTION `#include` "fl/stl/stdint.h" `#include` "fl/stl/vector.h" `#include` "fl/stl/strstream.h" `#include` "fl/stl/cstring.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/fltest.h` around lines 25 - 29, The header fltest.h uses the FL_STATIC_ASSERT macro (via FL_TEST_CASE_TEMPLATE_INVOKE and FL_TEST_CASE_TEMPLATE_APPLY) but does not include its defining header; add an explicit include for "fl/stl/static_assert.h" to fltest.h to avoid relying on transitive includes and ensure FL_STATIC_ASSERT is always defined when FL_TEST_CASE_TEMPLATE_INVOKE/_APPLY are used.src/fl/math/filter/triangular_filter_impl.h (1)
3-7:⚠️ Potential issue | 🟡 MinorMissing
fl/stl/static_assert.hinclude.FL_STATIC_ASSERTat line 14 relies on transitive inclusion; please add the direct include for robustness.🔧 Proposed fix
`#include` "fl/stl/circular_buffer.h" `#include` "fl/system/log.h" `#include` "fl/math/math.h" `#include` "fl/stl/span.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/math/filter/triangular_filter_impl.h` around lines 3 - 7, The header is missing a direct include for fl/stl/static_assert.h required by the FL_STATIC_ASSERT macro used in triangular_filter_impl (see FL_STATIC_ASSERT at the top of the file); add `#include` "fl/stl/static_assert.h" to the include list in src/fl/math/filter/triangular_filter_impl.h so the FL_STATIC_ASSERT symbol is resolved without relying on transitive includes.src/fl/detail/async_log_queue.h (1)
6-24:⚠️ Potential issue | 🟡 MinorMissing
fl/stl/static_assert.hinclude.FL_STATIC_ASSERTis used at lines 19–24 but onlyint.handnoexcept.hare included. Since this is a template class, the assertions are instantiated at the caller's TU, so any user ofAsyncLogQueuewould needFL_STATIC_ASSERTalready visible — add the direct include here to avoid that coupling.🔧 Proposed fix
`#include` "fl/stl/int.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/detail/async_log_queue.h` around lines 6 - 24, The file is missing the header that defines FL_STATIC_ASSERT; update src/fl/detail/async_log_queue.h to include the static-assert header so the compile-time checks used in template AsyncLogQueue (the FL_STATIC_ASSERT calls validating DescriptorCount and ArenaSize) are always available: add an `#include` for "fl/stl/static_assert.h" near the other fl/stl includes so FL_STATIC_ASSERT is defined without relying on users' translation units.src/fl/system/fastpin_base.h (1)
9-15:⚠️ Potential issue | 🟡 MinorMissing
fl/stl/static_assert.hinclude.FL_STATIC_ASSERTis used at line 145 but this header doesn't include the defining header, which is fragile against include-order changes.🔧 Proposed fix
`#include` "platforms/is_platform.h" `#include` "fl/stl/compiler_control.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/system/fastpin_base.h` around lines 9 - 15, fastpin_base.h uses the FL_STATIC_ASSERT macro but does not include its defining header; add an explicit include for "fl/stl/static_assert.h" alongside the other includes at the top of fastpin_base.h so FL_STATIC_ASSERT is always defined regardless of include order; ensure the include appears before any use of FL_STATIC_ASSERT (used later in this file) and keep it grouped with the other "fl/stl/..." includes.src/fl/asset.h (1)
28-33:⚠️ Potential issue | 🟠 MajorInclude
fl/stl/static_assert.hsoFL_ASSETis self-contained.
FL_ASSETexpandsFL_STATIC_ASSERT(...)at the caller's site (sketch code), so every translation unit that invokes the macro must haveFL_STATIC_ASSERTvisible. Sinceasset.his the public header that definesFL_ASSET, it should pull infl/stl/static_assert.hdirectly rather than hoping the sketch's include order provides it.Proposed fix
`#include` "fl/stl/int.h" `#include` "fl/stl/noexcept.h" +#include "fl/stl/static_assert.h" `#include` "fl/stl/string.h" `#include` "fl/stl/string_view.h" `#include` "fl/stl/url.h"Also consider refreshing the doc comments at lines 26, 82, and 121/133, which still refer to the validation as
static_assert.Also applies to: 136-143
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/asset.h` around lines 28 - 33, Add a direct include of fl/stl/static_assert.h to src/fl/asset.h so FL_ASSET can expand FL_STATIC_ASSERT() without relying on caller include order; update the header comments around the FL_ASSET macro (locations near the existing doc comments at lines ~26, ~82, and ~121/133 and the block around 136-143) to stop referring to C++ static_assert and instead mention FL_STATIC_ASSERT or “static validation via FL_STATIC_ASSERT” so the docs match the implementation.src/fl/stl/function.h (1)
1-13:⚠️ Potential issue | 🟡 MinorAdd direct include for
fl/stl/static_assert.h.
FL_STATIC_ASSERTis used at lines 88, 90, 178, 214, 357, and 512, but the file does not directly include"fl/stl/static_assert.h". The macro is available only through transitive inclusion vianoexcept.h, which is fragile. Add the direct include to ensure robustness and consistency with the pattern in other migrated files.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/function.h` around lines 1 - 13, The file uses the FL_STATIC_ASSERT macro in multiple places (lines referenced in the review) but doesn't directly include its header; add a direct include of "fl/stl/static_assert.h" at the top of src/fl/stl/function.h alongside the other includes so FL_STATIC_ASSERT is guaranteed to be available (avoid relying on transitive inclusion from noexcept.h) and keep include ordering consistent with other migrated files.ci/lint_cpp/banned_macros_checker.py (1)
37-132:⚠️ Potential issue | 🟡 MinorMinor: string literals containing
static_assert(can trigger false positives.
code_part = line.split("//")[0]strips only line comments, not string literals. A line like:FL_WARN("static_assert(foo) is banned");will pass the fast-path substring check and then match
\bstatic_assert\s*\(, producing a spurious violation. Same hazard already exists for__has_include, but it's worth being aware of now that a second keyword is added. Low priority — easy to work around by quoting differently — but if you want a quick hedge, consider a crude string-literal stripper before the regex check, or at minimum document the gotcha.Also worth noting: the regex is case-sensitive, so
FL_STATIC_ASSERT(is correctly not matched by\bstatic_assert\s*\(— good.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/lint_cpp/banned_macros_checker.py` around lines 37 - 132, The false positives come from literal strings being searched (e.g., STATIC_ASSERT_PATTERN matching inside "static_assert("), so in check_file_content before using code_part for keyword checks and regex searches (STATIC_ASSERT_PATTERN, HAS_INCLUDE_PATTERN) strip string literals from code_part (both double-quoted and single-quoted, handling escaped quotes) into a new variable (e.g., code_no_strings) and run the fast-path substring check and regex searches against that sanitized text; keep the existing skips (comments, FL_HAS_INCLUDE define) and only append violations based on matches found in the string-stripped content.
🧹 Nitpick comments (3)
src/fl/stl/noexcept.h (1)
3-4: Unused include in this header.
fl/stl/static_assert.his pulled in here butFL_STATIC_ASSERTis not used anywhere innoexcept.h. If this include is meant purely as a convenience re-export for consumers ofnoexcept.h, consider documenting it; otherwise it can be dropped to keep the header lean (it's already a widely included low-level header).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fl/stl/noexcept.h` around lines 3 - 4, The include "fl/stl/static_assert.h" in noexcept.h is unused (FL_STATIC_ASSERT isn't referenced) — either remove the include to keep the header minimal or explicitly document that noexcept.h intentionally re-exports static_assert for consumers; if you choose removal, delete the `#include` line referencing static_assert.h from noexcept.h, and if you choose to keep it, add a one-line comment above the include stating it is an intentional re-export for API consumers (mentioning FL_STATIC_ASSERT) so its presence is explicitly documented.src/platforms/shared/clockless_blocking.h (1)
78-80: LGTM — mechanical swap toFL_STATIC_ASSERTis correct. Note: the pre-existing typo "addtional" in the T3 diagnostic string at line 80 is unchanged; consider fixing to "additional" while touching this line.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/platforms/shared/clockless_blocking.h` around lines 78 - 80, Fix the typo in the static assertion message for T3: update the diagnostic string in the FL_STATIC_ASSERT that references T3 (currently "addtional") to read "additional" so the message becomes "T3 (additional time for low tail duration) must be positive"; keep the existing FL_STATIC_ASSERT macro and T3 symbol unchanged besides correcting the spelling.ci/lint_cpp/test_banned_macros_checker.py (1)
29-58: LGTM — good coverage for the new rule.Tests exercise the positive, negative, comments, multiline-comment, and skip-path cases. One optional add that would have caught a real bug class: a test asserting that
FL_STATIC_ASSERT(cond, "msg");containing literal tokenstatic_assertinside a string (e.g.,FL_WARN("use FL_STATIC_ASSERT not static_assert");) is not flagged — see related comment onbanned_macros_checker.py.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/lint_cpp/test_banned_macros_checker.py` around lines 29 - 58, Add a test case to ensure tokens inside string literals are not flagged: in TestBannedMacrosChecker add an assertion calling _violations with a line like 'FL_WARN("use FL_STATIC_ASSERT not static_assert");' (or similar string containing the literal token static_assert) and assert len(...) == 0; this mirrors the existing comment tests and will validate the behavior implemented in BannedMacrosChecker/_violations (and the logic in banned_macros_checker.py) so string contents are ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/fl/fx/2d/noisepalette.cpp.hpp`:
- Around line 21-22: Add a direct include for the header that defines the
FL_STATIC_ASSERT macro (do not rely on transitive includes) so the assertion
that checks sizeof(currentPalette) == sizeof(CRGBPalette16) has a guaranteed
definition; place the include at the top of the file before the FL_STATIC_ASSERT
usage and ensure it references the project header that declares
FL_STATIC_ASSERT.
In `@src/fl/math/filter/savitzky_golay_filter_impl.h`:
- Around line 14-15: The header uses FL_STATIC_ASSERT but doesn't include its
definition; add an include for fl/stl/static_assert.h at the top of
savitzky_golay_filter_impl.h so FL_STATIC_ASSERT is defined before the
FL_STATIC_ASSERT(N == 0 || (N % 2 == 1), ...) check; ensure the include is
placed with the other project includes (or guarded by existing include patterns)
so the assertion compiles standalone.
In `@src/fl/stl/type_traits.cpp.hpp`:
- Around line 16-122: The file uses the FL_STATIC_ASSERT macro (seen in many
assertions like FL_STATIC_ASSERT(fl::is_integral<int>::value, ...)) but does not
directly include its header; add a direct include of the static assert header
(fl/stl/static_assert.h) near the top of this translation unit so the macro is
explicitly provided (instead of relying on transitive includes from
type_traits.h → noexcept.h → static_assert.h).
In `@src/fl/stl/unique_ptr.h`:
- Around line 14-16: unique_ptr.h uses the FL_STATIC_ASSERT macro but doesn't
include its definition; add an include for "fl/stl/static_assert.h" at the top
of unique_ptr.h (before the FL_STATIC_ASSERT usage) so the header is
self-contained and the macro is available when the unique_ptr
destructor/definition is instantiated.
In `@src/fl/stl/vector.h`:
- Line 114: vector.h uses the macro FL_STATIC_ASSERT at the top (the statement
"FL_STATIC_ASSERT(M <= N, \"Too many elements for FixedVector\")") but doesn't
include its definition; add a direct include of the static assert header
(fl/stl/static_assert.h) to vector.h so the file is self-contained and
FL_STATIC_ASSERT is defined where FixedVector is declared.
In `@src/platforms/esp/32/drivers/gpio_isr_rx/dual_isr_context.h`:
- Around line 30-31: The include of the C++-only header fl/stl/static_assert.h
should be moved behind a C++ guard so it is only pulled in when compiling as
C++: wrap the `#include` "fl/stl/static_assert.h" with an `#ifdef` __cplusplus /
`#endif` (leaving `#include` "fl/stl/stdint.h" unguarded) so the FL_STATIC_ASSERT
wrapper (and any C++ templates/namespaces inside static_assert.h) are only
available in C++ builds; update dual_isr_context.h accordingly so references to
FL_STATIC_ASSERT remain valid under __cplusplus but the header compiles cleanly
in C.
In `@src/platforms/esp/32/drivers/lcd_cam/clockless_lcd_i80_esp32.h.disabled`:
- Line 34: The static assertion using FL_STATIC_ASSERT around the strapping-pin
check contains a predicate that ends with "|| true", which makes the expression
always true so the assertion can never fire; update the predicate used in the
FL_STATIC_ASSERT (the strapping-pin check predicate) to remove the spurious "||
true" or replace it with the correct logical condition, or alternatively remove
the FL_STATIC_ASSERT entirely if the check is meant to be a non-blocking
warning; ensure you modify the assertion surrounding the strapping-pin logic
(the FL_STATIC_ASSERT invocation) so it reflects the intended check rather than
always evaluating true.
---
Outside diff comments:
In `@ci/lint_cpp/banned_macros_checker.py`:
- Around line 37-132: The false positives come from literal strings being
searched (e.g., STATIC_ASSERT_PATTERN matching inside "static_assert("), so in
check_file_content before using code_part for keyword checks and regex searches
(STATIC_ASSERT_PATTERN, HAS_INCLUDE_PATTERN) strip string literals from
code_part (both double-quoted and single-quoted, handling escaped quotes) into a
new variable (e.g., code_no_strings) and run the fast-path substring check and
regex searches against that sanitized text; keep the existing skips (comments,
FL_HAS_INCLUDE define) and only append violations based on matches found in the
string-stripped content.
In `@src/chipsets.h`:
- Around line 8-18: The header chipsets.h uses the FL_STATIC_ASSERT macro
(around the current line ~217) but does not include its definition; add an
explicit include of "fl/stl/static_assert.h" at the top of chipsets.h (near the
other fl/stl includes) so FL_STATIC_ASSERT is defined locally rather than
relying on transitive includes.
In `@src/FastLED.h`:
- Around line 1004-1027: Move the FL_STATIC_ASSERT check before any dependent
typedefs in the SPI addLeds overloads so the chipset validity is checked first:
in the template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN,
fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE> overload (where
ControllerTypeWithFreq is typedef'd), the template<ESPIChipsets CHIPSET, fl::u8
DATA_PIN, fl::u8 CLOCK_PIN> legacy overload (where ControllerType is typedef'd),
and the template<ESPIChipsets ... RGB_ORDER> overload (where
ControllerTypeWithOrder is typedef'd) place FL_STATIC_ASSERT(CHIP::IS_VALID,
"Unsupported chipset"); immediately after defining typedef
ClockedChipsetHelper<...> CHIP and before any typename/ControllerType typedefs;
also add an explicit include of the header that defines FL_STATIC_ASSERT (e.g.,
include the cpp_compat header that provides it) near the top of FastLED.h so the
static-assert symbol is not only transitively available.
In `@src/fl/asset.h`:
- Around line 28-33: Add a direct include of fl/stl/static_assert.h to
src/fl/asset.h so FL_ASSET can expand FL_STATIC_ASSERT() without relying on
caller include order; update the header comments around the FL_ASSET macro
(locations near the existing doc comments at lines ~26, ~82, and ~121/133 and
the block around 136-143) to stop referring to C++ static_assert and instead
mention FL_STATIC_ASSERT or “static validation via FL_STATIC_ASSERT” so the docs
match the implementation.
In `@src/fl/detail/async_log_queue.h`:
- Around line 6-24: The file is missing the header that defines
FL_STATIC_ASSERT; update src/fl/detail/async_log_queue.h to include the
static-assert header so the compile-time checks used in template AsyncLogQueue
(the FL_STATIC_ASSERT calls validating DescriptorCount and ArenaSize) are always
available: add an `#include` for "fl/stl/static_assert.h" near the other fl/stl
includes so FL_STATIC_ASSERT is defined without relying on users' translation
units.
In `@src/fl/fltest.h`:
- Around line 25-29: The header fltest.h uses the FL_STATIC_ASSERT macro (via
FL_TEST_CASE_TEMPLATE_INVOKE and FL_TEST_CASE_TEMPLATE_APPLY) but does not
include its defining header; add an explicit include for
"fl/stl/static_assert.h" to fltest.h to avoid relying on transitive includes and
ensure FL_STATIC_ASSERT is always defined when
FL_TEST_CASE_TEMPLATE_INVOKE/_APPLY are used.
In `@src/fl/math/filter/triangular_filter_impl.h`:
- Around line 3-7: The header is missing a direct include for
fl/stl/static_assert.h required by the FL_STATIC_ASSERT macro used in
triangular_filter_impl (see FL_STATIC_ASSERT at the top of the file); add
`#include` "fl/stl/static_assert.h" to the include list in
src/fl/math/filter/triangular_filter_impl.h so the FL_STATIC_ASSERT symbol is
resolved without relying on transitive includes.
In `@src/fl/stl/bit_cast.h`:
- Around line 10-13: Bit_cast.h uses the FL_STATIC_ASSERT macro (lines around
48–50) but doesn't include its defining header; add an include for
"fl/stl/static_assert.h" at the top of src/fl/stl/bit_cast.h alongside the other
includes so FL_STATIC_ASSERT is available when functions like bit_cast are
compiled.
In `@src/fl/stl/bitset.h`:
- Around line 1-10: The header uses the macro FL_STATIC_ASSERT (referenced in
bitset.h) but does not include its definition; add `#include`
"fl/stl/static_assert.h" to the includes at the top of src/fl/stl/bitset.h
(alongside the other fl/stl/*.h includes) so the macro is available when
bitset.h is used standalone.
In `@src/fl/stl/charconv.h`:
- Around line 12-15: The header fl/stl/charconv.h uses the FL_STATIC_ASSERT
macro but doesn't include its definition; add an include for the static-assert
wrapper (e.g. include "fl/stl/static_assert.h") at the top of charconv.h so
FL_STATIC_ASSERT is always available regardless of include order; ensure the
include appears alongside the other fl/stl/* includes so references to
FL_STATIC_ASSERT in this header compile unconditionally.
In `@src/fl/stl/function.h`:
- Around line 1-13: The file uses the FL_STATIC_ASSERT macro in multiple places
(lines referenced in the review) but doesn't directly include its header; add a
direct include of "fl/stl/static_assert.h" at the top of src/fl/stl/function.h
alongside the other includes so FL_STATIC_ASSERT is guaranteed to be available
(avoid relying on transitive inclusion from noexcept.h) and keep include
ordering consistent with other migrated files.
In `@src/fl/stl/not_null.h`:
- Around line 48-50: not_null.h uses the macro FL_STATIC_ASSERT but does not
include its header; add an explicit `#include` "fl/stl/static_assert.h" at the top
of not_null.h (near the other includes) so the file no longer relies on
transitive includes; apply the same change for the other occurrence later in the
file where FL_STATIC_ASSERT is used (the block around the functions/classes that
reference FL_STATIC_ASSERT).
In `@src/fl/stl/ratio.h`:
- Around line 9-11: The header uses the macro FL_STATIC_ASSERT (seen around the
static assertion at line 21) but only includes fl/stl/int.h transitively; make
the header self-contained by adding a direct `#include` for the header that
defines FL_STATIC_ASSERT (the library's static-assert header) at the top of
ratio.h before any usage, so FL_STATIC_ASSERT is always available when including
ratio.h.
In `@src/fl/stl/string.cpp.hpp`:
- Around line 1-14: The translation unit uses the FL_STATIC_ASSERT macro but
doesn't include its provider; add `#include` "fl/stl/static_assert.h" to this
fragment (and the corresponding second fragment around the other occurrence) so
FL_STATIC_ASSERT is defined directly rather than relying on other headers;
locate the uses of FL_STATIC_ASSERT in string.cpp.hpp and add the include near
the top with the other fl/stl/* includes to ensure the macro is available.
In `@src/fl/stl/type_traits.h`:
- Around line 7-10: type_traits.h uses the FL_STATIC_ASSERT macro without
including its provider; add `#include` "fl/stl/static_assert.h" to the top include
block (alongside fl/stl/move.h, fl/stl/int.h, fl/stl/noexcept.h) so
FL_STATIC_ASSERT is defined regardless of include order, and ensure the same
include is present where FL_STATIC_ASSERT is used later in the file (the other
occurrences around the 240-241 and 614-615 regions) so all uses reference the
header that provides the macro.
In `@src/fl/system/fastpin_base.h`:
- Around line 9-15: fastpin_base.h uses the FL_STATIC_ASSERT macro but does not
include its defining header; add an explicit include for
"fl/stl/static_assert.h" alongside the other includes at the top of
fastpin_base.h so FL_STATIC_ASSERT is always defined regardless of include
order; ensure the include appears before any use of FL_STATIC_ASSERT (used later
in this file) and keep it grouped with the other "fl/stl/..." includes.
---
Nitpick comments:
In `@ci/lint_cpp/test_banned_macros_checker.py`:
- Around line 29-58: Add a test case to ensure tokens inside string literals are
not flagged: in TestBannedMacrosChecker add an assertion calling _violations
with a line like 'FL_WARN("use FL_STATIC_ASSERT not static_assert");' (or
similar string containing the literal token static_assert) and assert len(...)
== 0; this mirrors the existing comment tests and will validate the behavior
implemented in BannedMacrosChecker/_violations (and the logic in
banned_macros_checker.py) so string contents are ignored.
In `@src/fl/stl/noexcept.h`:
- Around line 3-4: The include "fl/stl/static_assert.h" in noexcept.h is unused
(FL_STATIC_ASSERT isn't referenced) — either remove the include to keep the
header minimal or explicitly document that noexcept.h intentionally re-exports
static_assert for consumers; if you choose removal, delete the `#include` line
referencing static_assert.h from noexcept.h, and if you choose to keep it, add a
one-line comment above the include stating it is an intentional re-export for
API consumers (mentioning FL_STATIC_ASSERT) so its presence is explicitly
documented.
In `@src/platforms/shared/clockless_blocking.h`:
- Around line 78-80: Fix the typo in the static assertion message for T3: update
the diagnostic string in the FL_STATIC_ASSERT that references T3 (currently
"addtional") to read "additional" so the message becomes "T3 (additional time
for low tail duration) must be positive"; keep the existing FL_STATIC_ASSERT
macro and T3 symbol unchanged besides correcting the spelling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aed064d5-31be-433c-b3fb-36358f8c0c78
📒 Files selected for processing (91)
ci/lint_cpp/banned_macros_checker.pyci/lint_cpp/test_banned_macros_checker.pysrc/FastLED.hsrc/chipsets.hsrc/cpp_compat.hsrc/fl/asset.hsrc/fl/detail/async_log_queue.hsrc/fl/fltest.hsrc/fl/fx/2d/noisepalette.cpp.hppsrc/fl/math/filter/hampel_filter_impl.hsrc/fl/math/filter/median_filter_impl.hsrc/fl/math/filter/savitzky_golay_filter_impl.hsrc/fl/math/filter/triangular_filter_impl.hsrc/fl/math/fixed_point/traits.hsrc/fl/math/screenmap.cpp.hppsrc/fl/stl/allocator.hsrc/fl/stl/bit_cast.hsrc/fl/stl/bitset.hsrc/fl/stl/charconv.hsrc/fl/stl/function.hsrc/fl/stl/hash.hsrc/fl/stl/noexcept.hsrc/fl/stl/not_null.hsrc/fl/stl/pair.hsrc/fl/stl/ratio.hsrc/fl/stl/static_assert.hsrc/fl/stl/string.cpp.hppsrc/fl/stl/type_traits.cpp.hppsrc/fl/stl/type_traits.hsrc/fl/stl/unique_ptr.hsrc/fl/stl/vector.hsrc/fl/system/fastpin_base.hsrc/pixel_controller.hsrc/platforms/arm/common/m0clockless_c.hsrc/platforms/arm/compile_test.hppsrc/platforms/arm/k20/clockless_block_arm_k20.hsrc/platforms/arm/k66/clockless_block_arm_k66.hsrc/platforms/arm/nrf52/arbiter_nrf52.hsrc/platforms/arm/nrf52/clockless_arm_nrf52.hsrc/platforms/arm/nrf52/fastspi_arm_nrf52.hsrc/platforms/arm/sam/clockless_block_arm_sam.hsrc/platforms/arm/stm32/fastspi_arm_stm32.hsrc/platforms/arm/teensy/teensy31_32/clockless_block_arm_k20.hsrc/platforms/arm/teensy/teensy36/clockless_block_arm_k66.hsrc/platforms/avr/attiny/clockless_blocking.hsrc/platforms/avr/attiny/clockless_blocking_controller.hsrc/platforms/avr/clockless_avr.hsrc/platforms/compile_test.cpp.hppsrc/platforms/esp/32/clockless_block_esp32.hsrc/platforms/esp/32/core/fastpin_esp32.hsrc/platforms/esp/32/core/fastspi_esp32_arduino.hsrc/platforms/esp/32/core/fastspi_esp32_idf.hsrc/platforms/esp/32/drivers/gpio_isr_rx/dual_isr_context.hsrc/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.hsrc/platforms/esp/32/drivers/lcd_cam/clockless_lcd_i80_esp32.h.disabledsrc/platforms/esp/32/drivers/parlio/parlio_buffer_calc.hsrc/platforms/esp/32/drivers/rmt/rmt_4/idf4_clockless_rmt_esp32.hsrc/platforms/esp/32/drivers/rmt/rmt_5/idf5_clockless.hsrc/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hppsrc/platforms/esp/32/drivers/spi/idf5_clockless_spi_esp32.hsrc/platforms/esp/32/interrupts/riscv.hppsrc/platforms/intmap.hsrc/platforms/shared/clockless_blocking.hsrc/platforms/shared/spi_bitbang/spi_isr_16.hsrc/platforms/shared/spi_bitbang/spi_isr_32.hsrc/platforms/shared/spi_bitbang/spi_isr_8.hsrc/platforms/stub/thread_stub_stl.htests/fl/asset.cpptests/fl/force_inline.cpptests/fl/gfx/corkscrew.cpptests/fl/math/alpha.cpptests/fl/math/fixed_point.cpptests/fl/math/random.cpptests/fl/rx_device.cpptests/fl/stl/allocator.cpptests/fl/stl/array.cpptests/fl/stl/bit_cast.cpptests/fl/stl/cstddef.cpptests/fl/stl/functional.cpptests/fl/stl/limits.cpptests/fl/stl/limits.hpptests/fl/stl/move.cpptests/fl/stl/not_null.cpptests/fl/stl/pair.cpptests/fl/stl/range_access.cpptests/fl/stl/stdint.cpptests/fl/stl/type_traits.cpptests/fl/stl/utility.cpptests/fl/system/delay.cpptests/platforms/cycle_type.cpptests/platforms/shared/clockless_timing.cpp
📊 Header Compilation PerformanceTotal Time: 763.44ms Top 5 Slowest Headers
Warnings
Full Report |
Summary
Split out from #2386.
Validation
Note: uv run python ci/lint_cpp/run_all_checkers.py still reports existing unrelated colorutils/test path lint violations on master.
Summary by CodeRabbit
Release Notes
New Features
Chores