]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix unused warnings coming from our own code.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 20 Jun 2023 07:24:50 +0000 (09:24 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 20 Jun 2023 07:24:50 +0000 (09:24 +0200)
Some third party warning remain, mostly coming from boost.

15 files changed:
ext/lmdb-safe/lmdb-typed.hh
modules/geoipbackend/geoipinterface-dat.cc
modules/geoipbackend/geoipinterface-mmdb.cc
modules/lmdbbackend/lmdbbackend.cc
pdns/credentials.cc
pdns/dnsdistdist/test-dnsdist-lua-ffi.cc
pdns/dnsreplay.cc
pdns/dynhandler.cc
pdns/dynlistener.cc
pdns/ednscookies.cc
pdns/recursordist/rec-snmp.cc
pdns/snmp-agent.cc
pdns/speedtest.cc
pdns/tcpiohandler.cc
pdns/webserver.cc

index ad5bb07c8a788c778535d8a6558ec1c3c1fc2429..45da5e00b5e3943ac267ea3725a30fbd5fc53c2c 100644 (file)
@@ -95,7 +95,7 @@ inline std::string keyConv(const T& t)
 
 
 namespace {
-  MDBOutVal getKeyFromCombinedKey(MDBInVal combined) {
+  inline MDBOutVal getKeyFromCombinedKey(MDBInVal combined) {
     if (combined.d_mdbval.mv_size < sizeof(uint32_t)) {
       throw std::runtime_error("combined key too short to get ID from");
     }
@@ -107,7 +107,7 @@ namespace {
     return ret;
   }
 
-  MDBOutVal getIDFromCombinedKey(MDBInVal combined) {
+  inline MDBOutVal getIDFromCombinedKey(MDBInVal combined) {
     if (combined.d_mdbval.mv_size < sizeof(uint32_t)) {
       throw std::runtime_error("combined key too short to get ID from");
     }
@@ -119,7 +119,7 @@ namespace {
     return ret;
   }
 
-  std::string makeCombinedKey(MDBInVal key, MDBInVal val)
+  inline std::string makeCombinedKey(MDBInVal key, MDBInVal val)
   {
     std::string lenprefix(sizeof(uint16_t), '\0');
     std::string skey((char*) key.d_mdbval.mv_data, key.d_mdbval.mv_size);
index 2a3f7596a801c37a85564b869be816d192765624..198e60f08ab770c364e0d91310909cc12bd3ac91 100644 (file)
@@ -481,7 +481,7 @@ unique_ptr<GeoIPInterface> GeoIPInterface::makeDATInterface(const string& fname,
 
 #else
 
-unique_ptr<GeoIPInterface> GeoIPInterface::makeDATInterface(const string& fname, const map<string, string>& opts)
+unique_ptr<GeoIPInterface> GeoIPInterface::makeDATInterface([[maybe_unused]] const string& fname, [[maybe_unused]] const map<string, string>& opts)
 {
   throw PDNSException("libGeoIP support not compiled in");
 }
index fae7c44d2883d8e5c113cec1c1a974c749e701bf..5866ae1a641db0f87a4772f989db5da0602dc189 100644 (file)
@@ -288,7 +288,7 @@ unique_ptr<GeoIPInterface> GeoIPInterface::makeMMDBInterface(const string& fname
 
 #else
 
-unique_ptr<GeoIPInterface> GeoIPInterface::makeMMDBInterface(const string& fname, const map<string, string>& opts)
+unique_ptr<GeoIPInterface> GeoIPInterface::makeMMDBInterface([[maybe_unused]] const string& fname, [[maybe_unused]] const map<string, string>& opts)
 {
   throw PDNSException("libmaxminddb support not compiled in");
 }
index d6eb3ba0e80c4991a31792941e4b2f3f17ed927f..ada437db984bb181169950626907fde96cd609f4 100644 (file)
@@ -1189,7 +1189,7 @@ bool LMDBBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q
   return true;
 }
 
-bool LMDBBackend::replaceComments(const uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<Comment>& comments)
+bool LMDBBackend::replaceComments([[maybe_unused]] const uint32_t domain_id, [[maybe_unused]] const DNSName& qname, [[maybe_unused]] const QType& qt, const vector<Comment>& comments)
 {
   // if the vector is empty, good, that's what we do here (LMDB does not store comments)
   // if it's not, report failure
index 137f1b7f67a8f8972994a887db3b917a2e86a9d5..343c1205ecac5d7e61ecc589d314da8575dd4979 100644 (file)
@@ -96,7 +96,7 @@ void SensitiveData::clear()
   d_data.clear();
 }
 
-static std::string hashPasswordInternal(const std::string& password, const std::string& salt, uint64_t workFactor, uint64_t parallelFactor, uint64_t blockSize)
+static std::string hashPasswordInternal([[maybe_unused]] const std::string& password, [[maybe_unused]] const std::string& salt, [[maybe_unused]] uint64_t workFactor, [[maybe_unused]] uint64_t parallelFactor, [[maybe_unused]] uint64_t blockSize)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   auto pctx = std::unique_ptr<EVP_PKEY_CTX, void (*)(EVP_PKEY_CTX*)>(EVP_PKEY_CTX_new_id(EVP_PKEY_SCRYPT, nullptr), EVP_PKEY_CTX_free);
@@ -165,7 +165,7 @@ static std::string generateRandomSalt()
 #endif
 }
 
-std::string hashPassword(const std::string& password, uint64_t workFactor, uint64_t parallelFactor, uint64_t blockSize)
+std::string hashPassword([[maybe_unused]] const std::string& password, [[maybe_unused]] uint64_t workFactor, [[maybe_unused]] uint64_t parallelFactor, [[maybe_unused]] uint64_t blockSize)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   if (workFactor == 0) {
@@ -197,7 +197,7 @@ std::string hashPassword(const std::string& password, uint64_t workFactor, uint6
 #endif
 }
 
-std::string hashPassword(const std::string& password)
+std::string hashPassword([[maybe_unused]] const std::string& password)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   return hashPassword(password, CredentialsHolder::s_defaultWorkFactor, CredentialsHolder::s_defaultParallelFactor, CredentialsHolder::s_defaultBlockSize);
@@ -206,7 +206,7 @@ std::string hashPassword(const std::string& password)
 #endif
 }
 
-bool verifyPassword(const std::string& binaryHash, const std::string& salt, uint64_t workFactor, uint64_t parallelFactor, uint64_t blockSize, const std::string& binaryPassword)
+bool verifyPassword([[maybe_unused]] const std::string& binaryHash, [[maybe_unused]] const std::string& salt, [[maybe_unused]] uint64_t workFactor, [[maybe_unused]] uint64_t parallelFactor, [[maybe_unused]] uint64_t blockSize, [[maybe_unused]] const std::string& binaryPassword)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   auto expected = hashPasswordInternal(binaryPassword, salt, workFactor, parallelFactor, blockSize);
@@ -217,7 +217,7 @@ bool verifyPassword(const std::string& binaryHash, const std::string& salt, uint
 }
 
 /* parse a hashed password in PHC string format */
-static void parseHashed(const std::string& hash, std::string& salt, std::string& hashedPassword, uint64_t& workFactor, uint64_t& parallelFactor, uint64_t& blockSize)
+static void parseHashed([[maybe_unused]] const std::string& hash, [[maybe_unused]] std::string& salt, [[maybe_unused]] std::string& hashedPassword, [[maybe_unused]] uint64_t& workFactor, [[maybe_unused]] uint64_t& parallelFactor, [[maybe_unused]] uint64_t& blockSize)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   auto parametersEnd = hash.find('$', pwhash_prefix.size());
@@ -282,7 +282,7 @@ static void parseHashed(const std::string& hash, std::string& salt, std::string&
 #endif
 }
 
-bool verifyPassword(const std::string& hash, const std::string& password)
+bool verifyPassword(const std::string& hash, [[maybe_unused]] const std::string& password)
 {
   if (!isPasswordHashed(hash)) {
     return false;
@@ -304,7 +304,7 @@ bool verifyPassword(const std::string& hash, const std::string& password)
 #endif
 }
 
-bool isPasswordHashed(const std::string& password)
+bool isPasswordHashed([[maybe_unused]] const std::string& password)
 {
 #if !defined(DISABLE_HASHED_CREDENTIALS) && defined(HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT)
   if (password.size() < pwhash_prefix_size || password.size() > pwhash_max_size) {
index d4367ea50e6362c88eb450b537573c86711045f5..e6f0e1e21c231115c012d4d7833a4936afb42ba7 100644 (file)
@@ -427,8 +427,8 @@ BOOST_AUTO_TEST_CASE(test_Server)
   BOOST_CHECK_EQUAL(dnsdist_ffi_server_is_up(&server), false);
   BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_name(&server), "");
   BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_name_with_addr(&server), dsAddr.toStringWithPort());
-  BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_weight(&server), 1U);
-  BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_order(&server), 1U);
+  BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_weight(&server), 1);
+  BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_order(&server), 1);
   BOOST_CHECK_EQUAL(dnsdist_ffi_server_get_latency(&server), 0.0);
 }
 
index 588ca66026166e2f91dd439da3f53fb9705f2dbe..b270f45a43a8ab5f94f3f23afa582c62a1832ffc 100644 (file)
@@ -595,7 +595,7 @@ static bool checkIPTransparentUsability()
 static bool g_rdSelector;
 static uint16_t g_pcapDnsPort;
 
-static bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote, int stamp, bool usePCAPSourceIP)
+static bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote, int stamp, [[maybe_unused]] bool usePCAPSourceIP)
 {
   bool sent=false;
   if (pr.d_len <= sizeof(dnsheader)) {
index 730d324cdb75fd882a890535cb0ce463577ae175..b2b35a8338ecdd16ba951608a14069c25f644b1d 100644 (file)
@@ -410,7 +410,7 @@ string DLListZones(const vector<string>& parts, Utility::pid_t /* ppid */)
 extern bool PKCS11ModuleSlotLogin(const std::string& module, const string& tokenId, const std::string& pin);
 #endif
 
-string DLTokenLogin(const vector<string>& parts, Utility::pid_t /* ppid */)
+string DLTokenLogin([[maybe_unused]] const vector<string>& parts, [[maybe_unused]] Utility::pid_t /* ppid */)
 {
 #ifndef HAVE_P11KIT1
   return "PKCS#11 support not compiled in";
index a659de4fdd9e6130a3790a9483babb05672776a3..456d62ba59d59007d5c871cadb40eb91e56d3058 100644 (file)
@@ -337,7 +337,7 @@ void DynListener::theListener()
   try {
     signal(SIGPIPE,SIG_IGN);
 
-    for(int n=0;;++n) {
+    for(;;) {
       string line=getLine();
       boost::trim_right(line);
 
index 5e57f04a86181ff9ccb6a11f67a1139221075f7d..eefa0f43f76b1746ee3e314604635895afc0c7a9 100644 (file)
@@ -74,7 +74,7 @@ void EDNSCookiesOpt::getEDNSCookiesOptFromString(const char* option, unsigned in
   }
 }
 
-bool EDNSCookiesOpt::isValid(const string& secret, const ComboAddress& source) const
+bool EDNSCookiesOpt::isValid([[maybe_unused]] const string& secret, [[maybe_unused]] const ComboAddress& source) const
 {
 #ifdef HAVE_CRYPTO_SHORTHASH
   if (server.length() != 16 || client.length() != 8) {
@@ -139,7 +139,7 @@ bool EDNSCookiesOpt::shouldRefresh() const
   return rfc1982LessThan(ts + 1800, now);
 }
 
-bool EDNSCookiesOpt::makeServerCookie(const string& secret, const ComboAddress& source)
+bool EDNSCookiesOpt::makeServerCookie([[maybe_unused]] const string& secret, [[maybe_unused]] const ComboAddress& source)
 {
 #ifdef HAVE_CRYPTO_SHORTHASH
   static_assert(EDNSCookieSecretSize == crypto_shorthash_KEYBYTES * 2, "The EDNSCookieSecretSize is not twice crypto_shorthash_KEYBYTES");
index 8773a158f1c57b903ca106cb64a87b34904cfdae..d9c70071271de948328e0c40804224a614112d64 100644 (file)
@@ -249,7 +249,7 @@ static void registerCounter64Stat(const std::string& name, const oid statOID[],
 
 std::shared_ptr<RecursorSNMPAgent> g_snmpAgent{nullptr};
 
-bool RecursorSNMPAgent::sendCustomTrap(const std::string& reason)
+bool RecursorSNMPAgent::sendCustomTrap([[maybe_unused]] const std::string& reason)
 {
 #ifdef HAVE_NET_SNMP
   netsnmp_variable_list* varList = nullptr;
index 18a088ea435307a9f3b9c4e3d90f449dd08ff0be..da56e4a42315dea3ff21fed89d98c065fd1af763 100644 (file)
@@ -161,7 +161,7 @@ void SNMPAgent::worker()
 #endif /* HAVE_NET_SNMP */
 }
 
-SNMPAgent::SNMPAgent(const std::string& name, const std::string& daemonSocket)
+SNMPAgent::SNMPAgent([[maybe_unused]] const std::string& name, [[maybe_unused]] const std::string& daemonSocket)
 {
 #ifdef HAVE_NET_SNMP
   netsnmp_enable_subagent();
index 1447080f2c31fbb3224b47aa1a3d4a0db6398656..77bb60fb0741b6104e21fc5030c44345835d5449 100644 (file)
@@ -1182,7 +1182,7 @@ private:
 };
 #endif
 
-int main(int argc, char** argv)
+int main()
 try
 {
   reportAllTypes();
index 8f4d3212390140bdfa27f27e475b5fc1f3e1b4f9..b75c3a97014e7082713b9a52764eaf551df0b135 100644 (file)
@@ -1854,7 +1854,7 @@ bool TLSFrontend::setupTLS()
   return true;
 }
 
-std::shared_ptr<TLSCtx> getTLSContext(const TLSContextParameters& params)
+std::shared_ptr<TLSCtx> getTLSContext([[maybe_unused]] const TLSContextParameters& params)
 {
 #ifdef HAVE_DNS_OVER_TLS
   /* get the "best" available provider */
index 43cd180e8225f9c9d58eab8319bae173a2115284..34577e70e5770a8bb301b723cff45f020bc1a155 100644 (file)
@@ -378,7 +378,7 @@ std::string Logging::IterLoggable<YaHTTP::strstr_map_t::const_iterator>::to_stri
 }
 #endif
 
-void WebServer::logRequest(const HttpRequest& req, const ComboAddress& remote) const {
+void WebServer::logRequest(const HttpRequest& req, [[maybe_unused]] const ComboAddress& remote) const {
   if (d_loglevel >= WebServer::LogLevel::Detailed) {
 #ifdef RECURSOR
     if (!g_slogStructured) {