Skip to content

Share print<N> body across buffer sizes via a span-based impl - #106

Merged
kammce merged 1 commit into
mainfrom
print-span-buffer
Aug 23, 2026
Merged

Share print<N> body across buffer sizes via a span-based impl#106
kammce merged 1 commit into
mainfrom
print-span-buffer

Conversation

@kammce

@kammce kammce commented Aug 23, 2026

Copy link
Copy Markdown
Member

Summary

  • write() no longer wraps its own coroutine; it returns the future from the call it forwards to directly, since it owns no local state that needs to survive the call.
  • print<buffer_size, Parameters...>() now owns its buffer and delegates to a non-exported span-based print(), so different buffer_size instantiations of the same Parameters pack share one function body instead of each generating a full copy — a real, measured reduction in embedded flash usage.
  • Drops a stray override on four test mock destructors (can/i2c/serial/spi) whose base class destructors are protected and non-virtual by design. This was masked by incremental build caching in local builds and only surfaced under a clean conan create build.

Test plan

  • conan build . -pr:a hal/tc/llvm --build=missing — all 15 test suites pass
  • conan create . -pr:a hal/tc/llvm --version=6.0.0 --build=missing — host package builds and test_package runs
  • conan create . -pr:a hal/tc/llvm -pr hal/mcu/stm32f103zg --version=6.0.0 --build=missing — cross-compiled package builds
  • Verified downstream: rebuilt libhal-arm-mcu and its demos against this version; USB CDC demo flash usage dropped as expected

write() no longer wraps its own coroutine; it just returns the
future from the call it forwards to, since it owns no local state
that needs to survive the call. print<buffer_size, ...>() now owns
its buffer and delegates to a non-exported print(span, ...) so that
different buffer_size instantiations of the same parameter pack
share one function body instead of each generating a full copy.

Also drops a stray `override` on four test mock destructors
(can/i2c/serial/spi) whose base class destructors are protected and
non-virtual by design; masked previously by incremental build
caching, surfaced by a clean conan create build.
@kammce
kammce merged commit 4c04930 into main Aug 23, 2026
9 checks passed
@kammce
kammce deleted the print-span-buffer branch August 23, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant