Skip to content

[BLOCKER-#3325] LPC PIO build fails on C++14 digit separators in m0clockless_c.h — set -std=gnu++17 + drop digit separators #3329

Closed

Description

@zackees

Problem

Building the LPC845-BRK environment via the PlatformIO backend (bash compile lpc845brk --examples AutoResearch --platformio) fails with C++14 digit-separator parse errors:

lib\FastLED/platforms/arm/common/m0clockless_c.h:358:71: error: missing terminating ' character
lib\FastLED/platforms/arm/common/m0clockless_c.h:358:47: error: expected ')' before '\x393939'

Line 358 of src/platforms/arm/common/m0clockless_c.h:

return (fl::u32)(((u64)ns * (u64)F_CPU + 999'999'999ULL) / 1'000'000'000ULL);

The 999'999'999ULL and 1'000'000'000ULL are C++14 digit separators (P0245R1). Under -std=gnu++11 (PlatformIO's default for this environment) the compiler reads the single quote as a character-literal delimiter and chokes on the next 3 digits as '999' -> '\x393939'.

Why this blocks LPC bisection (#3325 / #3300)

To bisect the Arduino-core LPC8xx commit that broke bring-up, we need to build with a controllable framework version. fbuild (the default backend) has no per-commit pinning mechanism, so we're forced through PlatformIO, which respects platform_packages = framework-arduino-lpc8xx@<repo>#<sha> and re-fetches per pin. But PIO uses the older C++ standard by default, and the compile dies in FastLED's own header before we can even start.

This is a bisection blocker for #3300 / #3325.

Two-part fix

Part A (FastLED-side): make FastLED's m0clockless_c.h compile under both C++11 and C++14+

Easy and backwards-compatible. The single-quote separators are pure visual sugar; replace with plain digits:

- return (fl::u32)(((u64)ns * (u64)F_CPU + 999'999'999ULL) / 1'000'000'000ULL);
+ return (fl::u32)(((u64)ns * (u64)F_CPU + 999999999ULL) / 1000000000ULL);

Audit the rest of src/ for other digit-separator usages -- ban them via a small lint check (bare_digit_separator_checker.py) so this regression can't return when a contributor adds C++14 syntax to a file that downstream builds compile under C++11. The lint should give a clear "use plain digits for cross-standard compatibility" message.

Part B (PIO platform side): default the LPC environment to gnu++17

In [env:lpc845brk] in platformio.ini (and lpcxpresso804 / lpcxpresso845max if present):

build_unflags =
    -std=gnu++11
    -std=c++11
build_flags =
    -std=gnu++17
    ...

The fbuild backend already defaults to -std=gnu++17 for LPC (verified in ~/.fbuild/worktrees/lpc8xx-orch/crates/fbuild-build/src/nxplpc/configs/nxplpc.json). Bringing PIO into parity prevents a class of "fbuild builds but PIO doesn't" surprises that block bisection and CI parity.

Open question on Part B: does the cleaner home for this default live in the zackees/platform-nxplpc-arduino platform.json (as a build block) rather than every consumer's platformio.ini? That would let third-party users get the right default without copy-pasting flags. Either is fine for #3300; whichever the maintainer prefers.

Acceptance criteria

  • FastLED's m0clockless_c.h:358 (and any other digit-separator sites grep finds) replaced with plain digits.
  • New ci/lint_cpp/digit_separator_checker.py flags any future <digit>'<digit> pattern in src/ outside of suppressed sites. Lint passes on master.
  • bash compile lpc845brk --examples AutoResearch --platformio succeeds without manual build_flags plumbing in the caller's platformio.ini.
  • bash compile lpc845brk --examples AutoResearch (default fbuild backend) continues to succeed at -std=gnu++17.

Verification commands

# Should fail at master HEAD; should pass after the fix.
bash compile lpc845brk --examples AutoResearch --platformio

# Should still pass.
bash compile lpc845brk --examples AutoResearch
bash test --cpp

Refs

Filed mid-bisect on #3300 -- the digit-separator parse error blocked the very first bisect step (pin to last-known-working 4560e6c41d).

Activity

  1. added a commit that references this issue on Jun 20, 2026
    2c3e2f3
  2. moved this from Triage to Done in FastLED Trackeron Jun 20, 2026
  3. added a commit that references this issue on Jun 20, 2026
    d95b37e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions