Skip to content

fix(gfx): rename rgbw min3 helper that collides with Zephyr's min3 macro - #4422

Merged
zackees merged 1 commit into
masterfrom
fix/4416-zephyr-min3-collision
Sep 18, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4416-zephyr-min3-collision

Conversation

@zackees

@zackees zackees commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #4416.

ArduinoCore-zephyr (Arduino UNO Q) includes <zephyr/sys/util.h> via Arduino.h, and that header defines min3(a, b, c) as a function-like macro. The helper min3 in src/fl/gfx/rgbw.cpp.hpp got macro-expanded, so fl.gfx+.cpp failed to compile (expected unqualified-id before '{' token). The reporter confirmed that removing the collision makes it build.

The helper is renamed to rgbw_min3 and gets FL_NO_EXCEPT (the noexcept ratchet counts the renamed helper as a new function). I searched src/ for the other util.h function-like macros (max3, IN_RANGE, CLAMP, ROUND_UP, …) and found no other collisions.

Why CI missed it: build_arduino_uno_q.yml compiles against the STM32duino STM32U585 toolchain, not the Zephyr core (see the comment in ci/boards.py).

Validation

  • bash test rgbw (quick and --debug) passes
  • bash lint --cpp passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Renamed an internal color-conversion helper to avoid a naming conflict with platform-provided utilities.
    • Preserved existing RGB-to-RGBW conversion behavior.

ArduinoCore-zephyr (Arduino UNO Q) pulls <zephyr/sys/util.h> in through
Arduino.h, and it defines min3(a, b, c) as a function-like macro. The
anonymous-namespace helper in rgbw.cpp.hpp was also named min3, so the
macro expanded its declaration and the fl.gfx unity TU failed to compile.
Rename it to rgbw_min3.

CI's arduino_uno_q target builds against STM32duino, not the Zephyr core,
so it could not catch this.

Fixes #4416

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 3c639c24-71c8-44a1-ae5b-f6dcbda19905

📥 Commits

Reviewing files that changed from the base of the PR and between e2d34dc and 30367aa.

📒 Files selected for processing (1)
  • src/fl/gfx/rgbw.cpp.hpp

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The local RGBW min3 helper is renamed to rgbw_min3 to avoid a macro collision. The helper is marked FL_NO_EXCEPT, and all three RGBW conversion functions use the new name.

Changes

RGBW helper collision fix

Layer / File(s) Summary
Rename helper and update RGBW callers
src/fl/gfx/rgbw.cpp.hpp
The anonymous-namespace helper is renamed to rgbw_min3, marked FL_NO_EXCEPT, and documented. rgb_2_rgbw_exact, rgb_2_rgbw_max_brightness, and rgb_2_rgbw_white_boosted call the renamed helper.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 30367

The collision fix is complete at the helper and all three call sites, with no identified build or production regression. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: renaming the rgbw min3 helper to prevent a collision with Zephyr’s min3 macro.
Linked Issues check ✅ Passed For #4416, the PR renames the anonymous-namespace helper from min3 to rgbw_min3 in src/fl/gfx/rgbw.cpp.hpp. It updates all three call sites. The declaration no longer matches Zephyr's function-l…
Out of Scope Changes check ✅ Passed The changes stay within #4416. They modify only the affected RGBW helper, its three call sites, and the related collision comment. FL_NO_EXCEPT does not add unrelated behavior.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees merged commit b5eb3b8 into master Sep 18, 2026
25 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 18, 2026
@zackees
zackees deleted the fix/4416-zephyr-min3-collision branch September 18, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Arduino Uno Q compilation error

1 participant