[component] Devirtualize call_dump_config

Remove virtual from Component::call_dump_config() since only
MQTTComponent overrode it. The MQTT override skipped dump_config
for internal entities, which unnecessarily hid useful debug info
from startup logs. The is_internal flag means "don't expose to
Home Assistant", not "don't log config".

This also removes one vtable entry from every Component subclass
and eliminates the indirect call overhead.
This commit is contained in:
J. Nick Koston
2026-02-27 08:49:27 -10:00
parent 4ae7633418
commit 814b265d40
5 changed files with 3 additions and 11 deletions
@@ -405,12 +405,6 @@ void MQTTComponent::process_resend() {
this->schedule_resend_state();
}
}
void MQTTComponent::call_dump_config() {
if (this->is_internal())
return;
this->dump_config();
}
void MQTTComponent::schedule_resend_state() { this->resend_state_ = true; }
bool MQTTComponent::is_connected_() const { return global_mqtt_client->is_connected(); }
-2
View File
@@ -98,8 +98,6 @@ class MQTTComponent : public Component {
/// Override setup_ so that we can call send_discovery() when needed.
void call_setup() override;
void call_dump_config() override;
/// Send discovery info the Home Assistant, override this.
virtual void send_discovery(JsonObject root, SendDiscoveryConfig &config) = 0;
+1 -1
View File
@@ -256,7 +256,7 @@ void Application::process_dump_config_() {
#endif
}
this->components_[this->dump_config_at_]->call_dump_config();
this->components_[this->dump_config_at_]->call_dump_config_();
this->dump_config_at_++;
}
+1 -1
View File
@@ -211,7 +211,7 @@ bool Component::cancel_retry(uint32_t id) {
void Component::call_loop_() { this->loop(); }
void Component::call_setup() { this->setup(); }
void Component::call_dump_config() {
void Component::call_dump_config_() {
this->dump_config();
if (this->is_failed()) {
// Look up error message from global vector
+1 -1
View File
@@ -291,7 +291,7 @@ class Component {
void call_loop_();
virtual void call_setup();
virtual void call_dump_config();
void call_dump_config_();
/// Helper to set component state (clears state bits and sets new state)
void set_component_state_(uint8_t state);