From e468db0fce6d547d4038ae55c9a64b75d698003a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 27 Feb 2026 21:08:36 -1000 Subject: [PATCH] Add friend declaration for original_setup used by cpp unit tests The cpp test framework renames setup() to original_setup() and replaces setup() with the gtest runner, so we need to friend both. Co-Authored-By: J. Nick Koston --- esphome/core/application.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/core/application.h b/esphome/core/application.h index b3daa4d7f24..194208c7013 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -108,8 +108,9 @@ namespace esphome::socket { class Socket; } // namespace esphome::socket -// Forward declaration for friend access from codegen-generated setup() +// Forward declarations for friend access from codegen-generated setup() void setup(); +void original_setup(); // Used by cpp unit tests which replace setup() with gtest runner namespace esphome { @@ -505,6 +506,7 @@ class Application { friend Component; friend class socket::Socket; friend void ::setup(); + friend void ::original_setup(); #ifdef USE_SOCKET_SELECT_SUPPORT /// Fast path for Socket::ready() via friendship - skips negative fd check.