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 <nick@koston.org>
This commit is contained in:
J. Nick Koston
2026-02-27 21:08:36 -10:00
co-authored by J. Nick Koston
parent 73fd1d68d5
commit e468db0fce
+3 -1
View File
@@ -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.