]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Kill a bunch of warnings emitted by clang
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 1 Nov 2023 12:24:55 +0000 (13:24 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 1 Nov 2023 13:08:16 +0000 (14:08 +0100)
A few are coming from boost, I disabled those by adding #pragma's

15 files changed:
ext/lmdb-safe/lmdb-safe.cc
modules/geoipbackend/geoipbackend.cc
pdns/dnsbulktest.cc
pdns/dnsscope.cc
pdns/dnstcpbench.cc
pdns/histog.hh
pdns/ixfrdist.cc
pdns/libssl.cc
pdns/logging.hh
pdns/recursordist/rec-lua-conf.cc
pdns/recursordist/rec-main.cc
pdns/recursordist/rpzloader.cc
pdns/recursordist/ws-recursor.cc
pdns/tcpiohandler.cc
pdns/test-dns_random_hh.cc

index 6b93b3b7cfaf1bd994b02ff19475b420130a27b6..6d4f8c81988a107f221dddd2ab1e9e09053825ac 100644 (file)
@@ -78,7 +78,7 @@ namespace LMDBLS {
 
 #endif /* #ifndef DNSDIST */
 
-MDBDbi::MDBDbi(MDB_env* env, MDB_txn* txn, const string_view dbname, int flags)
+MDBDbi::MDBDbi(MDB_env* /* env */, MDB_txn* txn, const string_view dbname, int flags)
 {
   // A transaction that uses this function must finish (either commit or abort) before any other transaction in the process may use this function.
 
index 2d0523158b38c049403d98d346513c9e015e5f78..3a08f037db64ac68bb841c2ab2f040b91a0bb6ed 100644 (file)
 #include <fstream>
 #include <filesystem>
 #include <utility>
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshadow"
 #include <yaml-cpp/yaml.h>
+#pragma clang diagnostic pop
 
 ReadWriteLock GeoIPBackend::s_state_lock;
 
index 085a644d571256c9f457c31e97e060898a2cefb6..2505be3aff7eb26aac8bddf925479fa1fa3bda7a 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/array.hpp>
 #include <boost/accumulators/statistics.hpp>
+#pragma clang diagnostic pop
 #include <boost/program_options.hpp>
 #include "inflighter.cc"
 #include <deque>
index 5e52d407a5f9b5629acfad37d363edc3293a287e..a16b0de4cafca7f031a616f31971592133597eb0 100644 (file)
@@ -203,7 +203,7 @@ try
   int dnserrors=0, parsefail=0;
   typedef map<uint32_t,uint32_t> cumul_t;
   cumul_t cumul;
-  unsigned int untracked=0, errorresult=0, nonRDQueries=0, queries=0;
+  unsigned int untracked=0, nonRDQueries=0, queries=0;
   unsigned int ipv4DNSPackets=0, ipv6DNSPackets=0, fragmented=0, rdNonRAAnswers=0;
   unsigned int answers=0, nonDNSIP=0, rdFilterMismatch=0;
   unsigned int dnssecOK=0, edns=0;
@@ -373,8 +373,6 @@ try
             if(!noservfailstats || header.rcode != 2)
               cumul[usecs]++;
 
-            if(header.rcode != 0 && header.rcode!=3)
-              errorresult++;
             ComboAddress rem = pr.getDest();
             rem.sin4.sin_port=0;
 
index b35ebc7a9607a3a63f9ef826c343b5fc43ac0e18..b0d536654cbfd284e0c0378aa5e2a289fac14b40 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
 #include <boost/accumulators/statistics/median.hpp>
 #include <boost/accumulators/statistics/mean.hpp>
 #include <boost/accumulators/accumulators.hpp>
-
 #include <boost/accumulators/statistics.hpp>
+#pragma clang diagnostic pop
 
 #include <thread>
 
index fb695283264f5f8ed031a67a8a20c046f1b157b5..613b115e91c474a60e475594eb57e37ca4e6fb0c 100644 (file)
@@ -1,6 +1,10 @@
 #pragma once
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics.hpp>
+#pragma clang diagnostic pop
 
 #include <vector>
 #include <fstream>
index 65630ab36a7b941e0b67babc5f8c73de44736d1a..644f07e8f0bf0e6c1c31c6074d201eaa082fc235 100644 (file)
 #include "logger.hh"
 #include "ixfrdist-stats.hh"
 #include "ixfrdist-web.hh"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshadow"
 #include <yaml-cpp/yaml.h>
+#pragma clang diagnostic pop
 
 /* BEGIN Needed because of deeper dependencies */
 #include "arguments.hh"
index 610783fb82409774855f2a1c45cc62a1602aa175..a77d665157b1b366f6a6166d4e207c748311cd4d 100644 (file)
@@ -202,7 +202,7 @@ std::pair<bool, std::string> libssl_load_provider(const std::string& providerNam
 #endif /* HAVE_LIBSSL && OPENSSL_VERSION_MAJOR >= 3 && HAVE_TLS_PROVIDERS */
 
 #if defined(HAVE_LIBSSL) && !defined(HAVE_TLS_PROVIDERS)
-std::pair<bool, std::string> libssl_load_engine(const std::string& engineName, const std::optional<std::string>& defaultString)
+std::pair<bool, std::string> libssl_load_engine([[maybe_unused]] const std::string& engineName, [[maybe_unused]] const std::optional<std::string>& defaultString)
 {
 #ifdef OPENSSL_NO_ENGINE
   return { false, "OpenSSL has been built without engine support" };
index 637e97d67ee6ba590bf60c8b6698c431e290ac58..12c46ed581d112afae3c571867b3a5b7a6ff0812 100644 (file)
@@ -202,19 +202,21 @@ extern bool g_slogStructured;
 // SLOG(g_log<<Logger::Warning<<"Unable to parse configuration file '"<<configname<<"'"<<endl,
 //      startupLog->error("No such file", "Unable to parse configuration file", "config_file", Logging::Loggable(configname));
 //
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
 #define SLOG(oldStyle, slogCall) \
-  if (true) {                    \
+  do {                           \
     if (g_slogStructured) {      \
       slogCall;                  \
     }                            \
     else {                       \
       oldStyle;                  \
     }                            \
-  }
+  } while (0)
 
 #else // No structured logging (e.g. auth)
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
 #define SLOG(oldStyle, slogCall) \
   do {                           \
     oldStyle;                    \
-  } while (0);
+  } while (0)
 #endif // RECURSOR
index 96d12941705d5e85e6197bad77921e7af831a5b3..ee5f359b040092c751a8d81a994c853fe08cbd79 100644 (file)
@@ -884,7 +884,8 @@ void loadRecursorLuaConfig(const std::string& fname, luaConfigDelayedThreads& de
     catch (const PDNSException& exp) {
       // exp is the exception that was thrown from inside the lambda
       SLOG(g_log << exp.reason << std::endl,
-           lci.d_slog->error(Logr::Error, exp.reason, "Exception loading Lua", "exception", Logging::Loggable("PDNSException")))    }
+           lci.d_slog->error(Logr::Error, exp.reason, "Exception loading Lua", "exception", Logging::Loggable("PDNSException")));
+    }
     throw;
   }
   catch (std::exception& err) {
index 66508e17d0f7be4558a41c19e26943bda938cbd7..9cc1cde07ab463162800dd5ed8a213c02def9da4 100644 (file)
@@ -2788,7 +2788,7 @@ static void recursorThread()
     if (threadInfo.isHandler()) {
       if (::arg().mustDo("webserver")) {
         SLOG(g_log << Logger::Warning << "Enabling web server" << endl,
-             log->info(Logr::Info, "Enabling web server"))
+             log->info(Logr::Info, "Enabling web server"));
         try {
           rws = make_unique<RecursorWebServer>(t_fdm.get());
         }
@@ -2837,11 +2837,11 @@ static void recursorThread()
   }
   catch (PDNSException& ae) {
     SLOG(g_log << Logger::Error << "Exception: " << ae.reason << endl,
-         log->error(Logr::Error, ae.reason, "Exception in RecursorThread", "exception", Logging::Loggable("PDNSException")))
+         log->error(Logr::Error, ae.reason, "Exception in RecursorThread", "exception", Logging::Loggable("PDNSException")));
   }
   catch (std::exception& e) {
     SLOG(g_log << Logger::Error << "STL Exception: " << e.what() << endl,
-         log->error(Logr::Error, e.what(), "Exception in RecursorThread", "exception", Logging::Loggable("std::exception")))
+         log->error(Logr::Error, e.what(), "Exception in RecursorThread", "exception", Logging::Loggable("std::exception")));
   }
   catch (...) {
     SLOG(g_log << Logger::Error << "any other exception in main: " << endl,
index c99480fea3150136b1a60e596ee144084eba4661..fb6eb04463cd52700cf643cf7183070761884158 100644 (file)
@@ -508,7 +508,7 @@ void RPZIXFRTracker(const std::vector<ComboAddress>& primaries, const boost::opt
 
       if (luaconfsLocal->generation != configGeneration) {
         SLOG(g_log << Logger::Info << "A more recent configuration has been found, stopping the existing RPZ update thread for " << zoneName << endl,
-             logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread"))
+             logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread"));
         return;
       }
       oldZone = luaconfsLocal->dfe.getZone(zoneIdx);
index 2737f78ec02d8bdfbb52680b558f89742c6685fe..64c027da55bf006e99d6d4ba1f70b28742c2acc8 100644 (file)
@@ -1570,7 +1570,7 @@ void AsyncWebServer::serveConnection(const std::shared_ptr<Socket>& socket) cons
   }
   catch (...) {
     SLOG(g_log << Logger::Error << logprefix << "Unknown exception" << endl,
-         req.d_slog->error(Logr::Error, "Exception handing request"))
+         req.d_slog->error(Logr::Error, "Exception handing request"));
   }
 }
 
index a5d00ed73ba81333b8bde0ab59ea163e8959ce48..03468f8e367c450f1bd5d1727cae118e07840a42 100644 (file)
@@ -1129,9 +1129,9 @@ public:
 
   /* The callback prototype changed in 3.4.0. */
 #if GNUTLS_VERSION_NUMBER >= 0x030400
-  static int newTicketFromServerCb(gnutls_session_t session, unsigned int htype, unsigned post, unsigned int incoming, const gnutls_datum_t* msg)
+  static int newTicketFromServerCb(gnutls_session_t session, unsigned int htype, unsigned post, unsigned int /* incoming */, const gnutls_datum_t* /* msg */)
 #else
-  static int newTicketFromServerCb(gnutls_session_t session, unsigned int htype, unsigned post, unsigned int incoming)
+  static int newTicketFromServerCb(gnutls_session_t session, unsigned int htype, unsigned post, unsigned int /* incoming */)
 #endif /* GNUTLS_VERSION_NUMBER >= 0x030400 */
   {
     if (htype != GNUTLS_HANDSHAKE_NEW_SESSION_TICKET || post != GNUTLS_HOOK_POST || session == nullptr) {
@@ -1153,7 +1153,7 @@ public:
     return 0;
   }
 
-  IOState tryConnect(bool fastOpen, const ComboAddress& remote) override
+  IOState tryConnect(bool fastOpen, [[maybe_unused]] const ComboAddress& remote) override
   {
     int ret = 0;
 
index 7c19d72ec82a9944e8c80a6a5aa24cb870fbc5cd..7f7324ca29f8c85dbf3670cf01c852dc3c53868a 100644 (file)
@@ -7,10 +7,14 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/assign/std/map.hpp>
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
 #include <boost/accumulators/statistics/median.hpp>
 #include <boost/accumulators/statistics/mean.hpp>
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics.hpp>
+#pragma clang diagnostic pop
 
 #include "arguments.hh"
 #include "dns_random.hh"