From 9a315393643cf549238f4fccabb7d15d8c1c509a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 4 Dec 2023 17:34:57 -0800 Subject: [PATCH] clang-tidy: use override Found with modernize-use-override Signed-off-by: Rosen Penev --- modules/bindbackend/bindbackend2.hh | 2 +- modules/geoipbackend/geoipbackend.hh | 2 +- modules/geoipbackend/geoipinterface-dat.cc | 2 +- modules/geoipbackend/geoipinterface-mmdb.cc | 2 +- modules/gmysqlbackend/smysql.cc | 32 ++++++++++----------- modules/gmysqlbackend/smysql.hh | 2 +- modules/godbcbackend/sodbc.cc | 32 ++++++++++----------- modules/godbcbackend/sodbc.hh | 2 +- modules/gpgsqlbackend/spgsql.cc | 32 ++++++++++----------- modules/gpgsqlbackend/spgsql.hh | 2 +- modules/ldapbackend/ldapauthenticator_p.hh | 10 +++---- modules/ldapbackend/ldapbackend.hh | 2 +- modules/lmdbbackend/lmdbbackend.hh | 2 +- modules/lua2backend/lua2api2.hh | 6 ++-- modules/pipebackend/coprocess.hh | 2 +- modules/pipebackend/pipebackend.hh | 2 +- pdns/backends/gsql/gsqlbackend.hh | 4 +-- pdns/epollmplexer.cc | 2 +- pdns/lua-auth4.hh | 7 +++-- pdns/pkcs11signers.hh | 2 +- pdns/tcpiohandler.cc | 8 +++--- 21 files changed, 79 insertions(+), 78 deletions(-) diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index 2e88b8f696da..118151d66986 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -180,7 +180,7 @@ class Bind2Backend : public DNSBackend { public: Bind2Backend(const string& suffix = "", bool loadZones = true); - ~Bind2Backend(); + ~Bind2Backend() override; void getUnfreshSecondaryInfos(vector* unfreshDomains) override; void getUpdatedPrimaries(vector& changedDomains, std::unordered_set& catalogs, CatalogHashMap& catalogHashes) override; bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override; diff --git a/modules/geoipbackend/geoipbackend.hh b/modules/geoipbackend/geoipbackend.hh index 6185b2d9bd80..4fe284d3a1cf 100644 --- a/modules/geoipbackend/geoipbackend.hh +++ b/modules/geoipbackend/geoipbackend.hh @@ -53,7 +53,7 @@ class GeoIPBackend : public DNSBackend { public: GeoIPBackend(const std::string& suffix = ""); - ~GeoIPBackend(); + ~GeoIPBackend() override; void lookup(const QType& qtype, const DNSName& qdomain, int zoneId, DNSPacket* pkt_p = nullptr) override; bool list(const DNSName& /* target */, int /* domain_id */, bool /* include_disabled */ = false) override { return false; } // not supported diff --git a/modules/geoipbackend/geoipinterface-dat.cc b/modules/geoipbackend/geoipinterface-dat.cc index 83cdebc72570..61c98a6bb249 100644 --- a/modules/geoipbackend/geoipinterface-dat.cc +++ b/modules/geoipbackend/geoipinterface-dat.cc @@ -463,7 +463,7 @@ class GeoIPInterfaceDAT : public GeoIPInterface return false; } - ~GeoIPInterfaceDAT() = default; + ~GeoIPInterfaceDAT() override = default; private: unsigned int d_db_type; diff --git a/modules/geoipbackend/geoipinterface-mmdb.cc b/modules/geoipbackend/geoipinterface-mmdb.cc index 5866ae1a641d..b3f08fb1cc98 100644 --- a/modules/geoipbackend/geoipinterface-mmdb.cc +++ b/modules/geoipbackend/geoipinterface-mmdb.cc @@ -246,7 +246,7 @@ class GeoIPInterfaceMMDB : public GeoIPInterface return true; } - ~GeoIPInterfaceMMDB() { MMDB_close(&d_s); }; + ~GeoIPInterfaceMMDB() override { MMDB_close(&d_s); }; private: MMDB_s d_s; diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index c8a3d880b537..efcbffd18e45 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -88,7 +88,7 @@ class SMySQLStatement : public SSqlStatement } } - SSqlStatement* bind(const string& /* name */, bool value) + SSqlStatement* bind(const string& /* name */, bool value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -101,15 +101,15 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bind(const string& name, int value) + SSqlStatement* bind(const string& name, int value) override { return bind(name, (long)value); } - SSqlStatement* bind(const string& name, uint32_t value) + SSqlStatement* bind(const string& name, uint32_t value) override { return bind(name, (unsigned long)value); } - SSqlStatement* bind(const string& /* name */, long value) + SSqlStatement* bind(const string& /* name */, long value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -122,7 +122,7 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bind(const string& /* name */, unsigned long value) + SSqlStatement* bind(const string& /* name */, unsigned long value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -136,7 +136,7 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bind(const string& /* name */, long long value) + SSqlStatement* bind(const string& /* name */, long long value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -149,7 +149,7 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bind(const string& /* name */, unsigned long long value) + SSqlStatement* bind(const string& /* name */, unsigned long long value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -163,7 +163,7 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bind(const string& /* name */, const std::string& value) + SSqlStatement* bind(const string& /* name */, const std::string& value) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -180,7 +180,7 @@ class SMySQLStatement : public SSqlStatement d_paridx++; return this; } - SSqlStatement* bindNull(const string& /* name */) + SSqlStatement* bindNull(const string& /* name */) override { prepareStatement(); if (d_paridx >= d_parnum) { @@ -192,7 +192,7 @@ class SMySQLStatement : public SSqlStatement return this; } - SSqlStatement* execute() + SSqlStatement* execute() override { prepareStatement(); @@ -267,7 +267,7 @@ class SMySQLStatement : public SSqlStatement return this; } - bool hasNextRow() + bool hasNextRow() override { if (d_dolog && d_residx == d_resnum) { g_log << Logger::Warning << "Query " << ((long)(void*)this) << ": " << d_dtime.udiffNoReset() << " us total to last row" << endl; @@ -275,7 +275,7 @@ class SMySQLStatement : public SSqlStatement return d_residx < d_resnum; } - SSqlStatement* nextRow(row_t& row) + SSqlStatement* nextRow(row_t& row) override { int err; row.clear(); @@ -338,7 +338,7 @@ class SMySQLStatement : public SSqlStatement return this; } - SSqlStatement* getResult(result_t& result) + SSqlStatement* getResult(result_t& result) override { result.clear(); result.reserve(d_resnum); @@ -352,7 +352,7 @@ class SMySQLStatement : public SSqlStatement return this; } - SSqlStatement* reset() + SSqlStatement* reset() override { if (!d_stmt) return this; @@ -383,9 +383,9 @@ class SMySQLStatement : public SSqlStatement return this; } - const std::string& getQuery() { return d_query; } + const std::string& getQuery() override { return d_query; } - ~SMySQLStatement() + ~SMySQLStatement() override { releaseStatement(); } diff --git a/modules/gmysqlbackend/smysql.hh b/modules/gmysqlbackend/smysql.hh index 255649ca1ab0..f39e5b942750 100644 --- a/modules/gmysqlbackend/smysql.hh +++ b/modules/gmysqlbackend/smysql.hh @@ -35,7 +35,7 @@ public: bool setIsolation = false, unsigned int timeout = 10, bool threadCleanup = false, bool clientSSL = false); - ~SMySQL(); + ~SMySQL() override; SSqlException sPerrorException(const string& reason) override; void setLog(bool state) override; diff --git a/modules/godbcbackend/sodbc.cc b/modules/godbcbackend/sodbc.cc index 79797ae5cffa..c79ac2b26504 100644 --- a/modules/godbcbackend/sodbc.cc +++ b/modules/godbcbackend/sodbc.cc @@ -112,31 +112,31 @@ class SODBCStatement : public SSqlStatement return this; } - SSqlStatement* bind(const string& name, bool value) + SSqlStatement* bind(const string& name, bool value) override { prepareStatement(); return bind(name, (uint32_t)value); } - SSqlStatement* bind(const string& name, long value) + SSqlStatement* bind(const string& name, long value) override { prepareStatement(); return bind(name, (unsigned long)value); } - SSqlStatement* bind(const string& name, int value) + SSqlStatement* bind(const string& name, int value) override { prepareStatement(); return bind(name, (uint32_t)value); } - SSqlStatement* bind(const string& name, long long value) + SSqlStatement* bind(const string& name, long long value) override { prepareStatement(); return bind(name, (unsigned long long)value); } - SSqlStatement* bind(const string& name, uint32_t value) + SSqlStatement* bind(const string& name, uint32_t value) override { prepareStatement(); ODBCParam p; @@ -147,7 +147,7 @@ class SODBCStatement : public SSqlStatement return bind(name, p); } - SSqlStatement* bind(const string& name, unsigned long value) + SSqlStatement* bind(const string& name, unsigned long value) override { prepareStatement(); ODBCParam p; @@ -158,7 +158,7 @@ class SODBCStatement : public SSqlStatement return bind(name, p); } - SSqlStatement* bind(const string& name, unsigned long long value) + SSqlStatement* bind(const string& name, unsigned long long value) override { prepareStatement(); ODBCParam p; @@ -169,7 +169,7 @@ class SODBCStatement : public SSqlStatement return bind(name, p); } - SSqlStatement* bind(const string& name, const std::string& value) + SSqlStatement* bind(const string& name, const std::string& value) override { // cerr<<"asked to bind string "< (d_parnum + 1)) throw SSqlException("Trying to bind too many parameters."); @@ -207,7 +207,7 @@ class SODBCStatement : public SSqlStatement return bind(name, p); } - SSqlStatement* execute() + SSqlStatement* execute() override { prepareStatement(); SQLRETURN result; @@ -238,14 +238,14 @@ class SODBCStatement : public SSqlStatement return this; } - bool hasNextRow() + bool hasNextRow() override { // cerr<<"hasNextRow d_result="<readVariable>("dns_lookup").get_value_or(0); f_list = d_lw->readVariable>("dns_list").get_value_or(0); diff --git a/modules/pipebackend/coprocess.hh b/modules/pipebackend/coprocess.hh index 0a0bbbf0929c..c9185132abf4 100644 --- a/modules/pipebackend/coprocess.hh +++ b/modules/pipebackend/coprocess.hh @@ -39,7 +39,7 @@ class CoProcess : public CoRemote { public: CoProcess(const string& command, int timeout = 0, int infd = 0, int outfd = 1); - ~CoProcess(); + ~CoProcess() override; void sendReceive(const string& send, string& receive) override; void receive(string& rcv) override; void send(const string& send) override; diff --git a/modules/pipebackend/pipebackend.hh b/modules/pipebackend/pipebackend.hh index 91beedb46a88..776533a5a2bc 100644 --- a/modules/pipebackend/pipebackend.hh +++ b/modules/pipebackend/pipebackend.hh @@ -49,7 +49,7 @@ class PipeBackend : public DNSBackend { public: PipeBackend(const string& suffix = ""); - ~PipeBackend(); + ~PipeBackend() override; void lookup(const QType&, const DNSName& qdomain, int zoneId, DNSPacket* p = nullptr) override; bool list(const DNSName& target, int domain_id, bool include_disabled = false) override; bool get(DNSResourceRecord& r) override; diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index 51f1da599e4b..8f92d5fb8c46 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -36,7 +36,7 @@ class GSQLBackend : public DNSBackend { public: GSQLBackend(const string &mode, const string &suffix); //!< Makes our connection to the database. Throws an exception if it fails. - virtual ~GSQLBackend() + ~GSQLBackend() override { freeStatements(); d_db.reset(); @@ -277,7 +277,7 @@ protected: reconnect(); } virtual void reconnect() { } - virtual bool inTransaction() override + bool inTransaction() override { return d_inTransaction; } diff --git a/pdns/epollmplexer.cc b/pdns/epollmplexer.cc index 74de2c29607b..4ccb0a016c3d 100644 --- a/pdns/epollmplexer.cc +++ b/pdns/epollmplexer.cc @@ -37,7 +37,7 @@ class EpollFDMultiplexer : public FDMultiplexer { public: EpollFDMultiplexer(unsigned int maxEventsHint); - ~EpollFDMultiplexer() + ~EpollFDMultiplexer() override { if (d_epollfd >= 0) { close(d_epollfd); diff --git a/pdns/lua-auth4.hh b/pdns/lua-auth4.hh index 06ad247b60c1..fea41d640b99 100644 --- a/pdns/lua-auth4.hh +++ b/pdns/lua-auth4.hh @@ -19,10 +19,11 @@ public: std::unique_ptr prequery(const DNSPacket& p); - ~AuthLua4(); // this is so unique_ptr works with an incomplete type + ~AuthLua4() override; // this is so unique_ptr works with an incomplete type protected: - virtual void postPrepareContext() override; - virtual void postLoad() override; + void postPrepareContext() override; + void postLoad() override; + private: struct UpdatePolicyQuery { DNSName qname; diff --git a/pdns/pkcs11signers.hh b/pdns/pkcs11signers.hh index a54e83f3fabe..36cef9f54d09 100644 --- a/pdns/pkcs11signers.hh +++ b/pdns/pkcs11signers.hh @@ -32,7 +32,7 @@ class PKCS11DNSCryptoKeyEngine : public DNSCryptoKeyEngine public: PKCS11DNSCryptoKeyEngine(unsigned int algorithm); - ~PKCS11DNSCryptoKeyEngine(); + ~PKCS11DNSCryptoKeyEngine() override; PKCS11DNSCryptoKeyEngine(const PKCS11DNSCryptoKeyEngine& orig); diff --git a/pdns/tcpiohandler.cc b/pdns/tcpiohandler.cc index 55f18554bd6b..841d9e3217e3 100644 --- a/pdns/tcpiohandler.cc +++ b/pdns/tcpiohandler.cc @@ -813,7 +813,7 @@ class OpenSSLTLSIOCtx: public TLSCtx } } - void loadTicketsKeys(const std::string& keyFile) override final + void loadTicketsKeys(const std::string& keyFile) final { d_feContext->d_ticketKeys.loadTicketsKeys(keyFile); @@ -1011,7 +1011,7 @@ class GnuTLSSession : public TLSSession sess.size = 0; } - virtual ~GnuTLSSession() + ~GnuTLSSession() override { if (d_sess.data != nullptr && d_sess.size > 0) { safe_memory_release(d_sess.data, d_sess.size); @@ -1660,7 +1660,7 @@ class GnuTLSIOCtx: public TLSCtx } } - virtual ~GnuTLSIOCtx() override + ~GnuTLSIOCtx() override { d_creds.reset(); @@ -1744,7 +1744,7 @@ class GnuTLSIOCtx: public TLSCtx } } - void loadTicketsKeys(const std::string& file) override final + void loadTicketsKeys(const std::string& file) final { if (!d_enableTickets) { return;