EventHandler: Deprecate SetUsed() and Used() as well.

Seems the latter isn't used outside of the functions that were deprecated
in the previous commit and with UsageAnalyzer not making use of this
information unclear why we should keep it around.

Relates to #3187.
This commit is contained in:
Arne Welzel 2023-11-02 18:29:50 +01:00
parent 398122206e
commit ff34a4aa7f
5 changed files with 35 additions and 2 deletions

View file

@ -21,14 +21,22 @@ EventHandlerPtr EventRegistry::Register(std::string_view name, bool is_from_scri
if ( ! is_from_script )
not_only_from_script.insert(std::string(name));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Remove in v7.1
h->SetUsed();
#pragma GCC diagnostic pop
return h;
}
h = new EventHandler(std::string(name));
event_registry->Register(h, is_from_script);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Remove in v7.1
h->SetUsed();
#pragma GCC diagnostic pop
return h;
}
@ -71,8 +79,11 @@ EventRegistry::string_list EventRegistry::UnusedHandlers() {
for ( const auto& entry : handlers ) {
EventHandler* v = entry.second.get();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if ( v->GetFunc() && ! v->Used() )
names.push_back(entry.first);
#pragma GCC diagnostic pop
}
return names;
@ -83,8 +94,11 @@ EventRegistry::string_list EventRegistry::UsedHandlers() {
for ( const auto& entry : handlers ) {
EventHandler* v = entry.second.get();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if ( v->GetFunc() && v->Used() )
names.push_back(entry.first);
#pragma GCC diagnostic pop
}
return names;