From abb11ca4d566b38131f2ef8ef69a31994426a63b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 3 Dec 2023 19:00:27 -0800 Subject: [PATCH] clang-tidy: use equals default Found with modernize-use-equals-default Signed-off-by: Rosen Penev --- modules/bindbackend/bindbackend2.hh | 4 +--- modules/geoipbackend/geoipinterface-dat.cc | 2 +- modules/geoipbackend/geoipinterface.hh | 2 +- modules/ldapbackend/ldapauthenticator.hh | 2 +- modules/lmdbbackend/lmdbbackend.hh | 2 +- modules/pipebackend/coprocess.hh | 2 +- modules/pipebackend/pipebackend.cc | 4 +--- pdns/anadns.hh | 3 +-- pdns/auth-packetcache.hh | 6 ++---- pdns/auth-querycache.hh | 6 ++---- pdns/auth-secondarycommunicator.cc | 4 ---- pdns/auth-zonecache.hh | 4 ++-- pdns/backends/gsql/gsqlbackend.cc | 3 +-- pdns/comment.hh | 2 +- pdns/dnsbackend.hh | 4 ++-- pdns/dnsname.hh | 5 ++--- pdns/dnsparser.hh | 2 +- pdns/dnsrecords.cc | 14 ++++++------ pdns/dnsrecords.hh | 25 +++++++++------------- pdns/dnssecinfra.hh | 2 +- pdns/dnswasher.cc | 9 +------- pdns/ednscookies.hh | 2 +- pdns/histogram.hh | 2 +- pdns/iputils.hh | 3 +-- pdns/libssl.cc | 4 +--- pdns/lock.hh | 12 +++-------- pdns/lua-auth4.cc | 2 +- pdns/lua-base4.cc | 5 ++--- pdns/lua-record.cc | 4 +--- pdns/misc.hh | 9 ++++---- pdns/mplexer.hh | 3 +-- pdns/pkcs11signers.cc | 5 ++--- pdns/pollmplexer.cc | 3 --- pdns/sha.hh | 6 ++---- pdns/stat_t.hh | 2 +- pdns/statbag.cc | 4 +--- pdns/statnode.hh | 5 +---- pdns/tcpiohandler.cc | 4 ---- pdns/tcpiohandler.hh | 8 +++---- pdns/tcpreceiver.cc | 5 +---- pdns/webserver.hh | 4 ++-- 41 files changed, 69 insertions(+), 130 deletions(-) diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index b61202267746..14aff4835c6d 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -108,9 +108,7 @@ template class LookButDontTouch { public: - LookButDontTouch() - { - } + LookButDontTouch() = default; LookButDontTouch(shared_ptr&& records) : d_records(std::move(records)) { diff --git a/modules/geoipbackend/geoipinterface-dat.cc b/modules/geoipbackend/geoipinterface-dat.cc index 198e60f08ab7..83cdebc72570 100644 --- a/modules/geoipbackend/geoipinterface-dat.cc +++ b/modules/geoipbackend/geoipinterface-dat.cc @@ -463,7 +463,7 @@ class GeoIPInterfaceDAT : public GeoIPInterface return false; } - ~GeoIPInterfaceDAT() {} + ~GeoIPInterfaceDAT() = default; private: unsigned int d_db_type; diff --git a/modules/geoipbackend/geoipinterface.hh b/modules/geoipbackend/geoipinterface.hh index 3ac8d8bcf75f..da745ada6189 100644 --- a/modules/geoipbackend/geoipinterface.hh +++ b/modules/geoipbackend/geoipinterface.hh @@ -62,7 +62,7 @@ public: boost::optional& alt, boost::optional& prec) = 0; - virtual ~GeoIPInterface() {} + virtual ~GeoIPInterface() = default; static unique_ptr makeInterface(const string& dbStr); diff --git a/modules/ldapbackend/ldapauthenticator.hh b/modules/ldapbackend/ldapauthenticator.hh index 160d250c0e72..a1d05c77eded 100644 --- a/modules/ldapbackend/ldapauthenticator.hh +++ b/modules/ldapbackend/ldapauthenticator.hh @@ -28,7 +28,7 @@ class LdapAuthenticator { public: - virtual ~LdapAuthenticator() {} + virtual ~LdapAuthenticator() = default; virtual bool authenticate(LDAP* connection) = 0; virtual std::string getError() const = 0; }; diff --git a/modules/lmdbbackend/lmdbbackend.hh b/modules/lmdbbackend/lmdbbackend.hh index e75b564c55a6..b4c0c157c219 100644 --- a/modules/lmdbbackend/lmdbbackend.hh +++ b/modules/lmdbbackend/lmdbbackend.hh @@ -243,7 +243,7 @@ public: class LMDBResourceRecord : public DNSResourceRecord { public: - LMDBResourceRecord() {} + LMDBResourceRecord() = default; LMDBResourceRecord(const DNSResourceRecord& rr) : DNSResourceRecord(rr), ordername(false) {} diff --git a/modules/pipebackend/coprocess.hh b/modules/pipebackend/coprocess.hh index 5fbf331935b9..0a0bbbf0929c 100644 --- a/modules/pipebackend/coprocess.hh +++ b/modules/pipebackend/coprocess.hh @@ -29,7 +29,7 @@ class CoRemote { public: - virtual ~CoRemote() {} + virtual ~CoRemote() = default; virtual void sendReceive(const string& send, string& receive) = 0; virtual void receive(string& rcv) = 0; virtual void send(const string& send) = 0; diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index d2f0c5db94f7..e79075a7f384 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -53,9 +53,7 @@ CoWrapper::CoWrapper(const string& command, int timeout, int abiVersion) // I think } -CoWrapper::~CoWrapper() -{ -} +CoWrapper::~CoWrapper() = default; void CoWrapper::launch() { diff --git a/pdns/anadns.hh b/pdns/anadns.hh index 8b68db8488cb..ec028ea8c361 100644 --- a/pdns/anadns.hh +++ b/pdns/anadns.hh @@ -29,8 +29,7 @@ struct QuestionIdentifier { - QuestionIdentifier() - {} + QuestionIdentifier() = default; bool operator<(const QuestionIdentifier& rhs) const { diff --git a/pdns/auth-packetcache.hh b/pdns/auth-packetcache.hh index efd11c082574..0b22e6282556 100644 --- a/pdns/auth-packetcache.hh +++ b/pdns/auth-packetcache.hh @@ -110,10 +110,8 @@ private: struct MapCombo { - MapCombo() { - } - ~MapCombo() { - } + MapCombo() = default; + ~MapCombo() = default; MapCombo(const MapCombo&) = delete; MapCombo& operator=(const MapCombo&) = delete; diff --git a/pdns/auth-querycache.hh b/pdns/auth-querycache.hh index 54a46b879bb6..b144b366700d 100644 --- a/pdns/auth-querycache.hh +++ b/pdns/auth-querycache.hh @@ -92,10 +92,8 @@ private: struct MapCombo { - MapCombo() { - } - ~MapCombo() { - } + MapCombo() = default; + ~MapCombo() = default; MapCombo(const MapCombo &) = delete; MapCombo & operator=(const MapCombo &) = delete; diff --git a/pdns/auth-secondarycommunicator.cc b/pdns/auth-secondarycommunicator.cc index 9b76a6652638..fb0e73c7a8a9 100644 --- a/pdns/auth-secondarycommunicator.cc +++ b/pdns/auth-secondarycommunicator.cc @@ -1042,10 +1042,6 @@ struct SecondarySenderReceiver map d_freshness; - SecondarySenderReceiver() - { - } - void deliverTimeout(const Identifier& /* i */) { } diff --git a/pdns/auth-zonecache.hh b/pdns/auth-zonecache.hh index c5b052a5378f..2a25cc4c8e25 100644 --- a/pdns/auth-zonecache.hh +++ b/pdns/auth-zonecache.hh @@ -66,8 +66,8 @@ private: struct MapCombo { - MapCombo() {} - ~MapCombo() {} + MapCombo() = default; + ~MapCombo() = default; MapCombo(const MapCombo&) = delete; MapCombo& operator=(const MapCombo&) = delete; diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index fcc5cc85d435..0cb0c13f6915 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -2327,6 +2327,5 @@ void GSQLBackend::extractComment(SSqlStatement::row_t& row, Comment& comment) comment.content = std::move(row[5]); } -SSqlStatement::~SSqlStatement() { // make sure vtable won't break -} +SSqlStatement::~SSqlStatement() = default; diff --git a/pdns/comment.hh b/pdns/comment.hh index 6854c094474e..1608cffec816 100644 --- a/pdns/comment.hh +++ b/pdns/comment.hh @@ -28,7 +28,7 @@ class Comment { public: Comment() : modified_at(0), domain_id(0) {}; - ~Comment() {}; + ~Comment() = default; // data DNSName qname; //!< the name of the associated RRset, for example: www.powerdns.com diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index a2ee00b41c9f..625a47807238 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -165,7 +165,7 @@ public: */ virtual bool list(const DNSName &target, int domain_id, bool include_disabled=false)=0; - virtual ~DNSBackend(){}; + virtual ~DNSBackend() = default; //! fills the soadata struct with the SOA details. Returns false if there is no SOA. virtual bool getSOA(const DNSName &name, SOAData &soadata); @@ -475,7 +475,7 @@ class BackendFactory { public: BackendFactory(const string &name) : d_name(name) {} - virtual ~BackendFactory(){} + virtual ~BackendFactory() = default; virtual DNSBackend *make(const string &suffix)=0; virtual DNSBackend *makeMetadataOnly(const string &suffix) { diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index 29c8325c5d60..101d17464c6e 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -80,7 +80,7 @@ class DNSName public: static const size_t s_maxDNSNameLength = 255; - DNSName() {} //!< Constructs an *empty* DNSName, NOT the root! + DNSName() = default; //!< Constructs an *empty* DNSName, NOT the root! // Work around assertion in some boost versions that do not like self-assignment of boost::container::string DNSName& operator=(const DNSName& rhs) { @@ -561,8 +561,7 @@ private: struct SuffixMatchNode { public: - SuffixMatchNode() - {} + SuffixMatchNode() = default; SuffixMatchTree d_tree; void add(const DNSName& dnsname) diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index dd87f252643c..20ce6396beb8 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -198,7 +198,7 @@ public: static string upgradeContent(const DNSName& qname, const QType& qtype, const string& content); virtual std::string getZoneRepresentation(bool noDot=false) const = 0; - virtual ~DNSRecordContent() {} + virtual ~DNSRecordContent() = default; virtual void toPacket(DNSPacketWriter& pw) const = 0; // returns the wire format of the content, possibly including compressed pointers pointing to the owner name (unless canonic or lowerCase are set) string serialize(const DNSName& qname, bool canonic=false, bool lowerCase=false) const diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 1cf4c2c82845..6b0079247ebc 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -360,7 +360,7 @@ boilerplate_conv(SMIMEA, conv.xfrHexBlob(d_cert, true); ) -DSRecordContent::DSRecordContent() {} +DSRecordContent::DSRecordContent() = default; boilerplate_conv(DS, conv.xfr16BitInt(d_tag); conv.xfr8BitInt(d_algorithm); @@ -368,7 +368,7 @@ boilerplate_conv(DS, conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) -CDSRecordContent::CDSRecordContent() {} +CDSRecordContent::CDSRecordContent() = default; boilerplate_conv(CDS, conv.xfr16BitInt(d_tag); conv.xfr8BitInt(d_algorithm); @@ -376,7 +376,7 @@ boilerplate_conv(CDS, conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) -DLVRecordContent::DLVRecordContent() {} +DLVRecordContent::DLVRecordContent() = default; boilerplate_conv(DLV, conv.xfr16BitInt(d_tag); conv.xfr8BitInt(d_algorithm); @@ -403,7 +403,7 @@ boilerplate_conv(RRSIG, conv.xfrBlob(d_signature); ) -RRSIGRecordContent::RRSIGRecordContent() {} +RRSIGRecordContent::RRSIGRecordContent() = default; boilerplate_conv(DNSKEY, conv.xfr16BitInt(d_flags); @@ -411,7 +411,7 @@ boilerplate_conv(DNSKEY, conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) -DNSKEYRecordContent::DNSKEYRecordContent() {} +DNSKEYRecordContent::DNSKEYRecordContent() = default; boilerplate_conv(CDNSKEY, conv.xfr16BitInt(d_flags); @@ -419,7 +419,7 @@ boilerplate_conv(CDNSKEY, conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) -CDNSKEYRecordContent::CDNSKEYRecordContent() {} +CDNSKEYRecordContent::CDNSKEYRecordContent() = default; boilerplate_conv(RKEY, conv.xfr16BitInt(d_flags); @@ -427,7 +427,7 @@ boilerplate_conv(RKEY, conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) -RKEYRecordContent::RKEYRecordContent() {} +RKEYRecordContent::RKEYRecordContent() = default; boilerplate_conv(NID, conv.xfr16BitInt(d_preference); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index dc2a1ce60048..1692d8795ad1 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -176,7 +176,7 @@ class TSIGRecordContent : public DNSRecordContent { public: includeboilerplate(TSIG) - TSIGRecordContent() {} + TSIGRecordContent() = default; uint16_t d_origID{0}; uint16_t d_fudge{0}; @@ -334,7 +334,7 @@ private: class OPTRecordContent : public DNSRecordContent { public: - OPTRecordContent(){} + OPTRecordContent() = default; includeboilerplate(OPT) void getData(vector > &opts) const; private: @@ -701,8 +701,7 @@ class NSECRecordContent : public DNSRecordContent { public: static void report(void); - NSECRecordContent() - {} + NSECRecordContent() = default; NSECRecordContent(const string& content, const DNSName& zone=DNSName()); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); @@ -739,8 +738,7 @@ class NSEC3RecordContent : public DNSRecordContent { public: static void report(void); - NSEC3RecordContent() - {} + NSEC3RecordContent() = default; NSEC3RecordContent(const string& content, const DNSName& zone=DNSName()); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); @@ -786,8 +784,7 @@ class CSYNCRecordContent : public DNSRecordContent { public: static void report(void); - CSYNCRecordContent() - {} + CSYNCRecordContent() = default; CSYNCRecordContent(const string& content, const DNSName& zone=DNSName()); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); @@ -815,8 +812,7 @@ class NSEC3PARAMRecordContent : public DNSRecordContent { public: static void report(void); - NSEC3PARAMRecordContent() - {} + NSEC3PARAMRecordContent() = default; NSEC3PARAMRecordContent(const string& content, const DNSName& zone=DNSName()); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); @@ -840,8 +836,7 @@ class LOCRecordContent : public DNSRecordContent { public: static void report(void); - LOCRecordContent() - {} + LOCRecordContent() = default; LOCRecordContent(const string& content, const string& zone=""); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); @@ -903,7 +898,7 @@ private: class EUI48RecordContent : public DNSRecordContent { public: - EUI48RecordContent() {}; + EUI48RecordContent() = default; static void report(void); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); static std::shared_ptr make(const string& zone); // FIXME400: DNSName& zone? @@ -918,7 +913,7 @@ private: class EUI64RecordContent : public DNSRecordContent { public: - EUI64RecordContent() {}; + EUI64RecordContent() = default; static void report(void); static std::shared_ptr make(const DNSRecord &dr, PacketReader& pr); static std::shared_ptr make(const string& zone); // FIXME400: DNSName& zone? @@ -945,7 +940,7 @@ typedef struct s_APLRDataElement { class APLRecordContent : public DNSRecordContent { public: - APLRecordContent() {}; + APLRecordContent() = default; includeboilerplate(APL) private: std::vector aplrdata; diff --git a/pdns/dnssecinfra.hh b/pdns/dnssecinfra.hh index 0ddb54eae6dc..617a9c7df03f 100644 --- a/pdns/dnssecinfra.hh +++ b/pdns/dnssecinfra.hh @@ -36,7 +36,7 @@ class DNSCryptoKeyEngine { public: explicit DNSCryptoKeyEngine(unsigned int algorithm) : d_algorithm(algorithm) {} - virtual ~DNSCryptoKeyEngine() {}; + virtual ~DNSCryptoKeyEngine() = default; [[nodiscard]] virtual string getName() const = 0; using stormap_t = std::map; diff --git a/pdns/dnswasher.cc b/pdns/dnswasher.cc index f370ce36aee4..a155305324e7 100644 --- a/pdns/dnswasher.cc +++ b/pdns/dnswasher.cc @@ -57,9 +57,7 @@ po::variables_map g_vm; class IPObfuscator { public: - virtual ~IPObfuscator() - { - } + virtual ~IPObfuscator() = default; virtual uint32_t obf4(uint32_t orig)=0; virtual struct in6_addr obf6(const struct in6_addr& orig)=0; }; @@ -71,9 +69,6 @@ class IPSeqObfuscator : public IPObfuscator { } - ~IPSeqObfuscator() - {} - static std::unique_ptr make() { return std::make_unique(); @@ -132,8 +127,6 @@ class IPCipherObfuscator : public IPObfuscator } } - ~IPCipherObfuscator() - {} static std::unique_ptr make(std::string key, bool decrypt) { return std::make_unique(key, decrypt); diff --git a/pdns/ednscookies.hh b/pdns/ednscookies.hh index 7eff3c63fe99..47800446f318 100644 --- a/pdns/ednscookies.hh +++ b/pdns/ednscookies.hh @@ -28,7 +28,7 @@ struct EDNSCookiesOpt static const size_t EDNSCookieSecretSize = 32; static const size_t EDNSCookieOptSize = 24; - EDNSCookiesOpt(){}; + EDNSCookiesOpt() = default; EDNSCookiesOpt(const std::string& option); EDNSCookiesOpt(const char* option, unsigned int len); diff --git a/pdns/histogram.hh b/pdns/histogram.hh index 4c50789f2871..4b9263bc8248 100644 --- a/pdns/histogram.hh +++ b/pdns/histogram.hh @@ -55,7 +55,7 @@ struct Bucket struct AtomicBucket { // We need the constructors in this case, since atomics have a disabled copy constructor. - AtomicBucket() {} + AtomicBucket() = default; AtomicBucket(std::string name, uint64_t boundary, uint64_t val) : d_name(std::move(name)), d_boundary(boundary), d_count(val) {} AtomicBucket(const AtomicBucket& rhs) : diff --git a/pdns/iputils.hh b/pdns/iputils.hh index ade4c82a3018..ee2f8f04f2d1 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -1358,8 +1358,7 @@ private: class NetmaskGroup { public: - NetmaskGroup() noexcept { - } + NetmaskGroup() noexcept = default; //! If this IP address is matched by any of the classes within diff --git a/pdns/libssl.cc b/pdns/libssl.cc index fa37b3e62c6e..ca35757f0c2e 100644 --- a/pdns/libssl.cc +++ b/pdns/libssl.cc @@ -626,9 +626,7 @@ OpenSSLTLSTicketKeysRing::OpenSSLTLSTicketKeysRing(size_t capacity) d_ticketKeys.write_lock()->set_capacity(capacity); } -OpenSSLTLSTicketKeysRing::~OpenSSLTLSTicketKeysRing() -{ -} +OpenSSLTLSTicketKeysRing::~OpenSSLTLSTicketKeysRing() = default; void OpenSSLTLSTicketKeysRing::addKey(std::shared_ptr&& newKey) { diff --git a/pdns/lock.hh b/pdns/lock.hh index d17a924cbebb..411af5b19bcb 100644 --- a/pdns/lock.hh +++ b/pdns/lock.hh @@ -81,9 +81,7 @@ class ReadWriteLock { public: - ReadWriteLock() - { - } + ReadWriteLock() = default; ReadWriteLock(const ReadWriteLock& rhs) = delete; ReadWriteLock(ReadWriteLock&& rhs) = delete; @@ -275,9 +273,7 @@ public: { } - explicit LockGuarded() - { - } + explicit LockGuarded() = default; LockGuardedTryHolder try_lock() { @@ -423,9 +419,7 @@ public: { } - explicit SharedLockGuarded() - { - } + explicit SharedLockGuarded() = default; SharedLockGuardedTryHolder try_write_lock() { diff --git a/pdns/lua-auth4.cc b/pdns/lua-auth4.cc index 0a2eb571a7f5..3efd2d7be7d5 100644 --- a/pdns/lua-auth4.cc +++ b/pdns/lua-auth4.cc @@ -170,4 +170,4 @@ std::unique_ptr AuthLua4::prequery(const DNSPacket& q) { return nullptr; } -AuthLua4::~AuthLua4() { } +AuthLua4::~AuthLua4() = default; diff --git a/pdns/lua-base4.cc b/pdns/lua-base4.cc index b150be832868..3984fe62e974 100644 --- a/pdns/lua-base4.cc +++ b/pdns/lua-base4.cc @@ -15,8 +15,7 @@ #include "ext/luawrapper/include/LuaContext.hpp" #include "dns_random.hh" -BaseLua4::BaseLua4() { -} +BaseLua4::BaseLua4() = default; void BaseLua4::loadFile(const std::string& fname) { @@ -296,4 +295,4 @@ void BaseLua4::loadStream(std::istream &is) { postLoad(); } -BaseLua4::~BaseLua4() { } +BaseLua4::~BaseLua4() = default; diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index c3358044abb9..4a9b8861ae0a 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -80,9 +80,7 @@ class IsUpOracle { d_checkerThreadStarted.clear(); } - ~IsUpOracle() - { - } + ~IsUpOracle() = default; bool isUp(const ComboAddress& remote, const opts_t& opts); bool isUp(const ComboAddress& remote, const std::string& url, const opts_t& opts); bool isUp(const CheckDesc& cd); diff --git a/pdns/misc.hh b/pdns/misc.hh index 740c32b816d8..209de32e060d 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -131,9 +131,8 @@ stringtok (Container &container, string const &in, template bool rfc1982LessThan(T a, T b) { - static_assert(std::is_unsigned::value, "rfc1982LessThan only works for unsigned types"); - typedef typename std::make_signed::type signed_t; - return static_cast(a - b) < 0; + static_assert(std::is_unsigned_v, "rfc1982LessThan only works for unsigned types"); + return std::make_signed_t(a - b) < 0; } // fills container with ranges, so {posbegin,posend} @@ -620,7 +619,7 @@ T valueOrEmpty(const P val) { // I'm not very OCD, but I appreciate loglines like "processing 1 delta", "processing 2 deltas" :-) template ::value, bool> = true> +typename std::enable_if_t, bool> = true> const char* addS(Integer siz, const char* singular = "", const char *plural = "s") { if (siz == 1) { @@ -630,7 +629,7 @@ const char* addS(Integer siz, const char* singular = "", const char *plural = "s } template ::value, bool> = true> +typename std::enable_if_t, bool> = true> const char* addS(const C& c, const char* singular = "", const char *plural = "s") { return addS(c.size(), singular, plural); diff --git a/pdns/mplexer.hh b/pdns/mplexer.hh index 33f5066131de..0fab1075883f 100644 --- a/pdns/mplexer.hh +++ b/pdns/mplexer.hh @@ -73,8 +73,7 @@ public: FDMultiplexer() : d_inrun(false) {} - virtual ~FDMultiplexer() - {} + virtual ~FDMultiplexer() = default; // The maximum number of events processed in a single run, not the maximum of watched descriptors static constexpr unsigned int s_maxevents = 1024; diff --git a/pdns/pkcs11signers.cc b/pdns/pkcs11signers.cc index db8c78702a94..d7ecd3f5e245 100644 --- a/pdns/pkcs11signers.cc +++ b/pdns/pkcs11signers.cc @@ -780,8 +780,7 @@ Pkcs11Token::Pkcs11Token(const std::shared_ptr>& slot, c if (this->d_slot->lock()->LoggedIn()) LoadAttributes(); } -Pkcs11Token::~Pkcs11Token() { -} +Pkcs11Token::~Pkcs11Token() = default; bool PKCS11ModuleSlotLogin(const std::string& module, const string& tokenId, const std::string& pin) { @@ -791,7 +790,7 @@ bool PKCS11ModuleSlotLogin(const std::string& module, const string& tokenId, con } PKCS11DNSCryptoKeyEngine::PKCS11DNSCryptoKeyEngine(unsigned int algorithm): DNSCryptoKeyEngine(algorithm) {} -PKCS11DNSCryptoKeyEngine::~PKCS11DNSCryptoKeyEngine() {} +PKCS11DNSCryptoKeyEngine::~PKCS11DNSCryptoKeyEngine() = default; PKCS11DNSCryptoKeyEngine::PKCS11DNSCryptoKeyEngine(const PKCS11DNSCryptoKeyEngine& orig) : DNSCryptoKeyEngine(orig.d_algorithm) {} void PKCS11DNSCryptoKeyEngine::create(unsigned int bits) { diff --git a/pdns/pollmplexer.cc b/pdns/pollmplexer.cc index 8d33123c3dd7..936c0c508800 100644 --- a/pdns/pollmplexer.cc +++ b/pdns/pollmplexer.cc @@ -30,9 +30,6 @@ class PollFDMultiplexer : public FDMultiplexer public: PollFDMultiplexer(unsigned int /* maxEventsHint */) {} - ~PollFDMultiplexer() - { - } int run(struct timeval* tv, int timeout = 500) override; void getAvailableFDs(std::vector& fds, int timeout) override; diff --git a/pdns/sha.hh b/pdns/sha.hh index e1c1e733cd83..92e6d387be9f 100644 --- a/pdns/sha.hh +++ b/pdns/sha.hh @@ -88,10 +88,8 @@ public: } } - ~SHADigest() - { - // No free of md needed and mdctx is cleaned up by unique_ptr - } + // No free of md needed and mdctx is cleaned up by unique_ptr + ~SHADigest() = default; void process(const std::string& msg) { diff --git a/pdns/stat_t.hh b/pdns/stat_t.hh index 389a62676bb7..d339cec37d22 100644 --- a/pdns/stat_t.hh +++ b/pdns/stat_t.hh @@ -71,7 +71,7 @@ namespace pdns { } private: - typename std::aligned_storage::type counter; + typename std::aligned_storage_t counter; }; typedef stat_t_trait stat_t; diff --git a/pdns/statbag.cc b/pdns/statbag.cc index 46066d2ca076..99046c62eaaa 100644 --- a/pdns/statbag.cc +++ b/pdns/statbag.cc @@ -166,9 +166,7 @@ AtomicCounter *StatBag::getPointer(const string &key) return d_stats[key].get(); } -StatBag::~StatBag() -{ -} +StatBag::~StatBag() = default; template StatRing::StatRing(unsigned int size) diff --git a/pdns/statnode.hh b/pdns/statnode.hh index 4f9590507e21..6748c3509c0a 100644 --- a/pdns/statnode.hh +++ b/pdns/statnode.hh @@ -30,10 +30,7 @@ public: struct Stat { - Stat() - { - } - + Stat() {}; uint64_t queries{0}; uint64_t noerrors{0}; uint64_t nxdomains{0}; diff --git a/pdns/tcpiohandler.cc b/pdns/tcpiohandler.cc index bb038e64c572..55f18554bd6b 100644 --- a/pdns/tcpiohandler.cc +++ b/pdns/tcpiohandler.cc @@ -62,10 +62,6 @@ class OpenSSLSession : public TLSSession { } - virtual ~OpenSSLSession() - { - } - std::unique_ptr getNative() { return std::move(d_sess); diff --git a/pdns/tcpiohandler.hh b/pdns/tcpiohandler.hh index 3f68828163de..9e0dfdf5aa8d 100644 --- a/pdns/tcpiohandler.hh +++ b/pdns/tcpiohandler.hh @@ -15,15 +15,13 @@ enum class IOState : uint8_t { Done, NeedRead, NeedWrite, Async }; class TLSSession { public: - virtual ~TLSSession() - { - } + virtual ~TLSSession() = default; }; class TLSConnection { public: - virtual ~TLSConnection() { } + virtual ~TLSConnection() = default; virtual void doHandshake() = 0; virtual IOState tryConnect(bool fastOpen, const ComboAddress& remote) = 0; virtual void connect(bool fastOpen, const ComboAddress& remote, const struct timeval& timeout) = 0; @@ -75,7 +73,7 @@ public: { d_rotatingTicketsKey.clear(); } - virtual ~TLSCtx() {} + virtual ~TLSCtx() = default; virtual std::unique_ptr getConnection(int socket, const struct timeval& timeout, time_t now) = 0; virtual std::unique_ptr getClientConnection(const std::string& host, bool hostIsAddr, int socket, const struct timeval& timeout) = 0; virtual void rotateTicketsKey(time_t now) = 0; diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index e1a6990c9aba..b84a6b9b4b4f 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -1303,10 +1303,7 @@ int TCPNameserver::doIXFR(std::unique_ptr& q, int outsock) return doAXFR(q->qdomain, q, outsock); } -TCPNameserver::~TCPNameserver() -{ -} - +TCPNameserver::~TCPNameserver() = default; TCPNameserver::TCPNameserver() { d_maxTransactionsPerConn = ::arg().asNum("max-tcp-transactions-per-conn"); diff --git a/pdns/webserver.hh b/pdns/webserver.hh index 28d901dbd52d..49f38b9ab319 100644 --- a/pdns/webserver.hh +++ b/pdns/webserver.hh @@ -165,7 +165,7 @@ public: d_server_socket.bind(d_local); d_server_socket.listen(); } - virtual ~Server() { }; + virtual ~Server() = default; ComboAddress d_local; @@ -181,7 +181,7 @@ class WebServer : public boost::noncopyable { public: WebServer(string listenaddress, int port); - virtual ~WebServer() { }; + virtual ~WebServer() = default; #ifdef RECURSOR void setSLog(Logr::log_t log)