From b2dd79dc04e2939fb84e3a4ee3df9a191bebe529 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 11 Dec 2020 17:01:00 +0100 Subject: [PATCH] rec: Get rid of warnings when compiling with Boost 1.74 --- pdns/rec_channel_rec.cc | 23 ++++++++++++----------- pdns/test-dnsname_cc.cc | 8 +++++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 543606418c..bfefdd4434 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -3,7 +3,7 @@ #endif #include "utility.hh" #include "rec_channel.hh" -#include + #include #ifdef MALLOC_TRACE #include "malloctrace.hh" @@ -1166,26 +1166,27 @@ void registerAllStats() addGetStat("noedns-outqueries", &g_stats.noEdnsOutQueries); addGetStat("uptime", calculateUptime); - addGetStat("real-memory-usage", boost::bind(getRealMemoryUsage, string())); - addGetStat("special-memory-usage", boost::bind(getSpecialMemoryUsage, string())); - addGetStat("fd-usage", boost::bind(getOpenFileDescriptors, string())); + addGetStat("real-memory-usage", []{ return getRealMemoryUsage(string()); }); + addGetStat("special-memory-usage", []{ return getSpecialMemoryUsage(string()); }); + addGetStat("fd-usage", []{ return getOpenFileDescriptors(string()); }); // addGetStat("query-rate", getQueryRate); addGetStat("user-msec", getUserTimeMsec); addGetStat("sys-msec", getSysTimeMsec); #ifdef __linux__ - addGetStat("cpu-iowait", boost::bind(getCPUIOWait, string())); - addGetStat("cpu-steal", boost::bind(getCPUSteal, string())); + addGetStat("cpu-iowait", []{ return getCPUIOWait(string()); }); + addGetStat("cpu-steal", []{ return getCPUSteal(string()); }); #endif - for(unsigned int n=0; n < g_numThreads; ++n) - addGetStat("cpu-msec-thread-"+std::to_string(n), boost::bind(&doGetThreadCPUMsec, n)); + for (unsigned int n = 0; n < g_numThreads; ++n) { + addGetStat("cpu-msec-thread-"+std::to_string(n), [n]{ return doGetThreadCPUMsec(n);}); + } #ifdef MALLOC_TRACE - addGetStat("memory-allocs", boost::bind(&MallocTracer::getAllocs, g_mtracer, string())); - addGetStat("memory-alloc-flux", boost::bind(&MallocTracer::getAllocFlux, g_mtracer, string())); - addGetStat("memory-allocated", boost::bind(&MallocTracer::getTotAllocated, g_mtracer, string())); + addGetStat("memory-allocs", []{ return g_mtracer->getAllocs(string()); }); + addGetStat("memory-alloc-flux", []{ return g_mtracer->getAllocFlux(string()); }); + addGetStat("memory-allocated", []{ return g_mtracer->getTotAllocated(string()); }); #endif addGetStat("dnssec-validations", &g_stats.dnssecValidations); diff --git a/pdns/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index c96baef50d..cc80a0fab8 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -1,14 +1,16 @@ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_NO_MAIN #include -#include + +#include #include -#include +#include + #include "dnsname.hh" #include "misc.hh" #include "dnswriter.hh" #include "dnsrecords.hh" -#include + using namespace boost; using std::string; -- 2.47.2