From ec6e5a9299125ffa6acd76d881b435b80a855778 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 21 Jul 2026 14:36:53 +1200 Subject: [PATCH] [esp32_hosted] Fix clang-tidy on the shared esp_now wire header The header is shared verbatim with the C co-processor firmware, so its types must use C's `typedef struct {...} name;` idiom and a C `` include, neither of which clang-tidy's C++ modernize checks accept. Wrap the struct block in NOLINTBEGIN/END(modernize-use-using) and select vs on __cplusplus so both the C++ host build and the C firmware build stay clean. --- esphome/components/esp32_hosted/esp_now_hosted_rpc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/esphome/components/esp32_hosted/esp_now_hosted_rpc.h b/esphome/components/esp32_hosted/esp_now_hosted_rpc.h index c4e7c64634..bf68c759ee 100644 --- a/esphome/components/esp32_hosted/esp_now_hosted_rpc.h +++ b/esphome/components/esp32_hosted/esp_now_hosted_rpc.h @@ -18,7 +18,11 @@ #ifndef ESP_NOW_HOSTED_RPC_H #define ESP_NOW_HOSTED_RPC_H +#ifdef __cplusplus +#include +#else #include +#endif #ifdef __cplusplus extern "C" { @@ -58,6 +62,11 @@ enum { /* ── Envelopes ──────────────────────────────────────────────────────────── */ +/* These payloads are shared verbatim with the C co-processor firmware, so they + * use C's `typedef struct {...} name;` idiom rather than C++ `using` aliases, + * which would not compile there. Silence clang-tidy's modernize-use-using for + * the shared struct block. */ +// NOLINTBEGIN(modernize-use-using) typedef struct { uint8_t opcode; /* one of ESP_NOW_HOSTED_OP_* */ uint8_t seq; /* wraps 0..255; echoed in the response for matching */ @@ -110,6 +119,7 @@ typedef struct { uint8_t des_addr[6]; uint8_t status; /* esp_now_send_status_t (0 = success) */ } __attribute__((packed)) esp_now_hosted_send_evt_t; +// NOLINTEND(modernize-use-using) #ifdef __cplusplus }