From 764095f014cd7d651e68d722eadb842e6b1947b4 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 15 Jan 2025 12:12:18 -0500 Subject: [PATCH] Save more flash ... we should be at a net negative now --- src/app/AttributeValueEncoder.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/AttributeValueEncoder.h b/src/app/AttributeValueEncoder.h index a0f8fbb71dab00..d22f269fa93b48 100644 --- a/src/app/AttributeValueEncoder.h +++ b/src/app/AttributeValueEncoder.h @@ -64,6 +64,17 @@ class AttributeValueEncoder return mAttributeValueEncoder.EncodeListItem(std::forward(aArg)); } + // overrides that save flash: no need to care about the extra const + // Without this, we have a usage of: + // chip::ChipError chip::app::AttributeValueEncoder::EncodeListItem + // that uses 162 bytes of flash on ARM32 (at least on QPG) + // + // TODO: + // - we should figure where the extra const override is used + // - we should try to avoid having such footguns. This list template-explosion seems + // dangerous for flash. + CHIP_ERROR Encode(uint32_t const & aArg) const { return Encode((uint32_t &) aArg); } + private: AttributeValueEncoder & mAttributeValueEncoder; };