diff --git a/esphome/components/api/api_pb2.cpp b/esphome/components/api/api_pb2.cpp index 4b86baf2c1d..829dd56d0a9 100644 --- a/esphome/components/api/api_pb2.cpp +++ b/esphome/components/api/api_pb2.cpp @@ -745,8 +745,9 @@ uint32_t ListEntitiesSensorResponse::calculate_size() const { #endif return size; } -__attribute__((optimize("O2"))) uint8_t *SensorStateResponse::encode( - ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const { +__attribute__((optimize("O2"))) // NOLINT(clang-diagnostic-unknown-attributes) +uint8_t * +SensorStateResponse::encode(ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const { uint8_t *__restrict__ pos = buffer.get_pos(); ProtoEncode::write_tag_and_fixed32(pos PROTO_ENCODE_DEBUG_ARG, 13, this->key); ProtoEncode::encode_float(pos PROTO_ENCODE_DEBUG_ARG, 2, this->state); @@ -756,7 +757,9 @@ __attribute__((optimize("O2"))) uint8_t *SensorStateResponse::encode( #endif return pos; } -__attribute__((optimize("O2"))) uint32_t SensorStateResponse::calculate_size() const { +__attribute__((optimize("O2"))) // NOLINT(clang-diagnostic-unknown-attributes) +uint32_t +SensorStateResponse::calculate_size() const { uint32_t size = 0; size += 5; size += ProtoSize::calc_float(1, this->state); @@ -2325,8 +2328,9 @@ bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, } return true; } -__attribute__((optimize("O2"))) uint8_t *BluetoothLERawAdvertisementsResponse::encode( - ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const { +__attribute__((optimize("O2"))) // NOLINT(clang-diagnostic-unknown-attributes) +uint8_t * +BluetoothLERawAdvertisementsResponse::encode(ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const { uint8_t *__restrict__ pos = buffer.get_pos(); for (uint16_t i = 0; i < this->advertisements_len; i++) { auto &sub_msg = this->advertisements[i]; @@ -2348,7 +2352,9 @@ __attribute__((optimize("O2"))) uint8_t *BluetoothLERawAdvertisementsResponse::e } return pos; } -__attribute__((optimize("O2"))) uint32_t BluetoothLERawAdvertisementsResponse::calculate_size() const { +__attribute__((optimize("O2"))) // NOLINT(clang-diagnostic-unknown-attributes) +uint32_t +BluetoothLERawAdvertisementsResponse::calculate_size() const { uint32_t size = 0; for (uint16_t i = 0; i < this->advertisements_len; i++) { auto &sub_msg = this->advertisements[i]; diff --git a/script/api_protobuf/api_protobuf.py b/script/api_protobuf/api_protobuf.py index 4f52b07809b..a58474f9fe9 100755 --- a/script/api_protobuf/api_protobuf.py +++ b/script/api_protobuf/api_protobuf.py @@ -2683,7 +2683,7 @@ def build_message_type( # When set, __attribute__((optimize("O2"))) is added to the definitions # so GCC inlines the small ProtoEncode helpers even under -Os. is_speed_optimized = get_opt(desc, pb.speed_optimized, False) - speed_attr = '__attribute__((optimize("O2"))) ' if is_speed_optimized else "" + speed_attr = '__attribute__((optimize("O2"))) // NOLINT(clang-diagnostic-unknown-attributes)\n' if is_speed_optimized else "" # Only generate encode method if this message needs encoding and has fields if needs_encode and encode and not is_inline_only: