1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-19 03:32:20 +01:00

Merge branch 'pre_preserve_looping_components' into integration

This commit is contained in:
J. Nick Koston
2025-06-22 22:57:38 +02:00
7 changed files with 28 additions and 5 deletions

View File

@@ -41,6 +41,6 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
cg.add_build_flag("-DUSE_HOST")
cg.add_define("USE_ESPHOME_HOST_MAC_ADDRESS", config[CONF_MAC_ADDRESS].parts)
cg.add_build_flag("-std=c++17")
cg.add_build_flag("-std=gnu++17")
cg.add_define("ESPHOME_BOARD", "host")
cg.add_platformio_option("platform", "platformio/native")

View File

@@ -261,6 +261,17 @@ void Application::teardown_components(uint32_t timeout_ms) {
}
void Application::calculate_looping_components_() {
// Count total components that need looping
size_t total_looping = 0;
for (auto *obj : this->components_) {
if (obj->has_overridden_loop()) {
total_looping++;
}
}
// Pre-reserve vector to avoid reallocations
this->looping_components_.reserve(total_looping);
// First add all active components
for (auto *obj : this->components_) {
if (obj->has_overridden_loop() &&

View File

@@ -616,6 +616,12 @@ def add_build_unflag(build_unflag: str) -> None:
def set_cpp_standard(standard: str) -> None:
"""Set C++ standard with compiler flag `-std={standard}`."""
CORE.add_build_unflag("-std=gnu++11")
CORE.add_build_unflag("-std=gnu++14")
CORE.add_build_unflag("-std=gnu++20")
CORE.add_build_unflag("-std=gnu++23")
CORE.add_build_unflag("-std=gnu++2a")
CORE.add_build_unflag("-std=gnu++2b")
CORE.add_build_unflag("-std=gnu++2c")
CORE.add_build_flag(f"-std={standard}")