From 61c428809754671cea4dd11342bed8174c8f1327 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 16 Feb 2026 15:27:11 -0600 Subject: [PATCH] [api] Address review: comment noinline, simplify non-debug signature --- esphome/components/api/proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index db07b0df44..c1d073596c 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -291,6 +291,7 @@ class ProtoWriteBuffer { this->debug_check_bounds_(1); *this->pos_++ = value ? 0x01 : 0x00; } + // noinline: 51 call sites; inlining causes net code growth vs a single out-of-line copy __attribute__((noinline)) void encode_fixed32(uint32_t field_id, uint32_t value, bool force = false) { if (value == 0 && !force) return; @@ -350,7 +351,7 @@ class ProtoWriteBuffer { #ifdef ESPHOME_DEBUG_API void debug_check_bounds_(size_t bytes, const char *caller = __builtin_FUNCTION()); #else - void debug_check_bounds_(size_t bytes, const char *caller = __builtin_FUNCTION()) {} + void debug_check_bounds_([[maybe_unused]] size_t bytes) {} #endif std::vector *buffer_;