From 905dae56655750c92c2eb7e61bcdf63a20b05691 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 21 Jan 2022 18:17:15 +0100 Subject: [PATCH] Stop using the boost version of tie and tuple by default Also try to pull a bit less of boost headers everywhere in our code base. --- pdns/anadns.hh | 4 ++-- pdns/auth-packetcache.hh | 6 +++++- pdns/auth-querycache.cc | 4 ++-- pdns/auth-querycache.hh | 6 +++++- pdns/auth-zonecache.cc | 16 ++++++++-------- pdns/auth-zonecache.hh | 4 ++-- pdns/communicator.hh | 2 +- pdns/dns.hh | 5 ----- pdns/dnsdist-dynbpf.cc | 4 ++-- pdns/dnsdist-dynbpf.hh | 13 +++++++------ pdns/dnsdist-lua.cc | 7 +++---- pdns/dnsdistdist/dnsdist-lbpolicies.cc | 4 ++-- pdns/dnsdistdist/dnsdist-rules.hh | 5 +++++ pdns/dnsdistdist/dnsdist-tcp-downstream.hh | 5 +++++ pdns/dnsparser.hh | 10 ++++------ pdns/dnssecsigner.cc | 2 +- pdns/inflighter.cc | 4 +++- pdns/iputils.hh | 12 +++++------- pdns/ixfrutils.hh | 4 ++++ pdns/misc.hh | 14 ++++---------- pdns/mplexer.hh | 9 +++------ pdns/namespaces.hh | 7 ------- pdns/recpacketcache.cc | 6 +++--- pdns/recpacketcache.hh | 1 + pdns/recursor_cache.cc | 8 ++++---- pdns/recursor_cache.hh | 2 +- pdns/recursordist/aggressive_nsec.hh | 2 ++ pdns/recursordist/negcache.cc | 12 ++++++------ pdns/recursordist/negcache.hh | 3 +++ pdns/statnode.hh | 2 +- pdns/syncres.cc | 4 ++-- pdns/syncres.hh | 14 +++++++------- pdns/tcpreceiver.cc | 2 +- pdns/test-auth-zonecache_cc.cc | 8 ++++---- pdns/ueberbackend.cc | 2 +- pdns/ws-auth.cc | 2 +- 36 files changed, 110 insertions(+), 105 deletions(-) diff --git a/pdns/anadns.hh b/pdns/anadns.hh index b1054bf979..0ac51aebab 100644 --- a/pdns/anadns.hh +++ b/pdns/anadns.hh @@ -37,8 +37,8 @@ struct QuestionIdentifier bool operator<(const QuestionIdentifier& rhs) const { return - tie(d_id, d_qtype, d_source, d_dest, d_qname) < - tie(rhs.d_id, rhs.d_qtype, rhs.d_source, rhs.d_dest, rhs.d_qname); + std::tie(d_id, d_qtype, d_source, d_dest, d_qname) < + std::tie(rhs.d_id, rhs.d_qtype, rhs.d_source, rhs.d_dest, rhs.d_qname); } diff --git a/pdns/auth-packetcache.hh b/pdns/auth-packetcache.hh index 618041cf17..efd11c0825 100644 --- a/pdns/auth-packetcache.hh +++ b/pdns/auth-packetcache.hh @@ -25,9 +25,13 @@ #include "dns.hh" #include #include "namespaces.hh" -using namespace ::boost::multi_index; +#include +#include #include +#include +#include +using namespace ::boost::multi_index; #include "dnspacket.hh" #include "lock.hh" diff --git a/pdns/auth-querycache.cc b/pdns/auth-querycache.cc index 6913296d84..dea4583e9f 100644 --- a/pdns/auth-querycache.cc +++ b/pdns/auth-querycache.cc @@ -97,7 +97,7 @@ void AuthQueryCache::insert(const DNSName &qname, const QType& qtype, vectorinsert(val); + std::tie(place, inserted) = map->insert(val); if (!inserted) { map->replace(place, std::move(val)); @@ -119,7 +119,7 @@ void AuthQueryCache::insert(const DNSName &qname, const QType& qtype, vector& value, int zoneID, time_t now) { auto& idx = boost::multi_index::get(map); - auto iter = idx.find(tie(qname, qtype, zoneID)); + auto iter = idx.find(std::tie(qname, qtype, zoneID)); if (iter == idx.end()) { (*d_statnummiss)++; diff --git a/pdns/auth-querycache.hh b/pdns/auth-querycache.hh index b5ee72db12..20c8ffb4d4 100644 --- a/pdns/auth-querycache.hh +++ b/pdns/auth-querycache.hh @@ -25,9 +25,13 @@ #include "dns.hh" #include #include "namespaces.hh" -using namespace ::boost::multi_index; +#include +#include #include +#include +#include +using namespace ::boost::multi_index; #include "dns.hh" #include "dnspacket.hh" diff --git a/pdns/auth-zonecache.cc b/pdns/auth-zonecache.cc index 80a0e469cd..b214a9b6f6 100644 --- a/pdns/auth-zonecache.cc +++ b/pdns/auth-zonecache.cc @@ -74,7 +74,7 @@ void AuthZoneCache::clear() purgeLockedCollectionsVector(d_maps); } -void AuthZoneCache::replace(const vector>& zone_indices) +void AuthZoneCache::replace(const vector>& zone_indices) { if (!d_refreshinterval) return; @@ -83,10 +83,10 @@ void AuthZoneCache::replace(const vector>& zone_indices) vector newMaps(d_maps.size()); // build new maps - for (const tuple& tup : zone_indices) { - const DNSName& zone = tup.get<0>(); + for (const std::tuple& tup : zone_indices) { + const DNSName& zone = std::get<0>(tup); CacheValue val; - val.zoneId = tup.get<1>(); + val.zoneId = std::get<1>(tup); auto& mc = newMaps[getMapIndex(zone)]; auto iter = mc.find(zone); if (iter != mc.end()) { @@ -101,11 +101,11 @@ void AuthZoneCache::replace(const vector>& zone_indices) // process zone updates done while data collection for replace() was already in progress. auto pending = d_pending.lock(); assert(pending->d_replacePending); // make sure we never forget to call setReplacePending() - for (const tuple& tup : pending->d_pendingUpdates) { - const DNSName& zone = tup.get<0>(); + for (const std::tuple& tup : pending->d_pendingUpdates) { + const DNSName& zone = std::get<0>(tup); CacheValue val; - val.zoneId = tup.get<1>(); - bool insert = tup.get<2>(); + val.zoneId = std::get<1>(tup); + bool insert = std::get<2>(tup); auto& mc = newMaps[getMapIndex(zone)]; auto iter = mc.find(zone); if (iter != mc.end()) { diff --git a/pdns/auth-zonecache.hh b/pdns/auth-zonecache.hh index 474b94641a..c1b91d2b58 100644 --- a/pdns/auth-zonecache.hh +++ b/pdns/auth-zonecache.hh @@ -32,7 +32,7 @@ class AuthZoneCache : public boost::noncopyable public: AuthZoneCache(size_t mapsCount = 1024); - void replace(const vector>& zone); + void replace(const vector>& zone); void add(const DNSName& zone, const int zoneId); void remove(const DNSName& zone); void setReplacePending(); //!< call this when data collection for the subsequent replace() call starts. @@ -91,7 +91,7 @@ private: struct PendingData { - std::vector> d_pendingUpdates; + std::vector> d_pendingUpdates; bool d_replacePending{false}; }; LockGuarded d_pending; diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 0ffeef30a7..b799e0159e 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -50,7 +50,7 @@ struct SuckRequest std::pair priorityAndOrder; bool operator<(const SuckRequest& b) const { - return tie(domain, master) < tie(b.domain, b.master); + return std::tie(domain, master) < std::tie(b.domain, b.master); } }; diff --git a/pdns/dns.hh b/pdns/dns.hh index a23ad5ba15..d6de3b7add 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -20,11 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once -#include -#include -#include -#include -#include #include "qtype.hh" #include "dnsname.hh" #include diff --git a/pdns/dnsdist-dynbpf.cc b/pdns/dnsdist-dynbpf.cc index ec549c32f9..c19844de73 100644 --- a/pdns/dnsdist-dynbpf.cc +++ b/pdns/dnsdist-dynbpf.cc @@ -49,8 +49,8 @@ void DynBPFFilter::purgeExpired(const struct timespec& now) { auto data = d_data.lock(); - typedef nth_index::type ordered_until; - ordered_until& ou = get<1>(data->d_entries); + typedef boost::multi_index::nth_index::type ordered_until; + ordered_until& ou = boost::multi_index::get<1>(data->d_entries); for (ordered_until::iterator it = ou.begin(); it != ou.end(); ) { if (it->d_until < now) { diff --git a/pdns/dnsdist-dynbpf.hh b/pdns/dnsdist-dynbpf.hh index afe7796527..907a7300b9 100644 --- a/pdns/dnsdist-dynbpf.hh +++ b/pdns/dnsdist-dynbpf.hh @@ -27,6 +27,7 @@ #include #include +#include class DynBPFFilter { @@ -59,12 +60,12 @@ private: ComboAddress d_addr; struct timespec d_until; }; - typedef multi_index_container, ComboAddress::addressOnlyLessThan >, - ordered_non_unique< member > - > - > container_t; + typedef boost::multi_index_container, ComboAddress::addressOnlyLessThan >, + boost::multi_index::ordered_non_unique< boost::multi_index::member > + > + > container_t; struct Data { container_t d_entries; std::shared_ptr d_bpf{nullptr}; diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index d7c94ddad2..d5a79a8e3b 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -50,9 +50,7 @@ #include "dnsdist-web.hh" #include "base64.hh" -#include "dnswriter.hh" #include "dolog.hh" -#include "lock.hh" #include "sodcrypto.hh" #ifdef HAVE_LIBSSL @@ -60,7 +58,7 @@ #endif #include -#include +#include #ifdef HAVE_SYSTEMD #include @@ -482,7 +480,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } if (vars.count("id")) { - ret->setId(boost::lexical_cast(boost::get(vars["id"]))); + ret->setId(boost::uuids::string_generator()((boost::get(vars["id"])))); } if (vars.count("checkName")) { @@ -2287,6 +2285,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) #endif return result; }); + luaCtx.writeFunction("addDOHLocal", [client](const std::string& addr, boost::optional, std::vector>, std::vector>>>> certFiles, boost::optional>>> keyFiles, boost::optional>>> urls, boost::optional vars) { if (client) { return; diff --git a/pdns/dnsdistdist/dnsdist-lbpolicies.cc b/pdns/dnsdistdist/dnsdist-lbpolicies.cc index d747ca763e..39d465c7b8 100644 --- a/pdns/dnsdistdist/dnsdist-lbpolicies.cc +++ b/pdns/dnsdistdist/dnsdist-lbpolicies.cc @@ -36,14 +36,14 @@ shared_ptr leastOutstanding(const ServerPolicy::NumberedServerV return servers[0].second; } - vector, size_t>> poss; + vector, size_t>> poss; /* so you might wonder, why do we go through this trouble? The data on which we sort could change during the sort, which would suck royally and could even lead to crashes. So first we snapshot on what we sort, and then we sort */ poss.reserve(servers.size()); size_t position = 0; for(const auto& d : servers) { if(d.second->isUp()) { - poss.emplace_back(make_tuple(d.second->outstanding.load(), d.second->order, d.second->latencyUsec), position); + poss.emplace_back(std::make_tuple(d.second->outstanding.load(), d.second->order, d.second->latencyUsec), position); } ++position; } diff --git a/pdns/dnsdistdist/dnsdist-rules.hh b/pdns/dnsdistdist/dnsdist-rules.hh index dda702e435..92b1a150aa 100644 --- a/pdns/dnsdistdist/dnsdist-rules.hh +++ b/pdns/dnsdistdist/dnsdist-rules.hh @@ -21,6 +21,11 @@ */ #pragma once +#include +#include +#include +#include + #include "cachecleaner.hh" #include "dnsdist.hh" #include "dnsdist-ecs.hh" diff --git a/pdns/dnsdistdist/dnsdist-tcp-downstream.hh b/pdns/dnsdistdist/dnsdist-tcp-downstream.hh index 547d266b8a..da403655bc 100644 --- a/pdns/dnsdistdist/dnsdist-tcp-downstream.hh +++ b/pdns/dnsdistdist/dnsdist-tcp-downstream.hh @@ -1,5 +1,10 @@ #pragma once +#include +#include +#include +#include + #include #include "sstuff.hh" diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 7d57daddbf..7f0ec5950d 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -29,8 +29,6 @@ // #include #include "misc.hh" -#include -#include #include "dns.hh" #include "dnswriter.hh" #include "dnsname.hh" @@ -303,10 +301,10 @@ struct DNSRecord bool operator<(const DNSRecord& rhs) const { - if(tie(d_name, d_type, d_class, d_ttl) < tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl)) + if(std::tie(d_name, d_type, d_class, d_ttl) < std::tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl)) return true; - if(tie(d_name, d_type, d_class, d_ttl) != tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl)) + if(std::tie(d_name, d_type, d_class, d_ttl) != std::tie(rhs.d_name, rhs.d_type, rhs.d_class, rhs.d_ttl)) return false; string lzrp, rzrp; @@ -329,10 +327,10 @@ struct DNSRecord if(b.d_name.canonCompare(a.d_name)) return false; - if(tie(aType, a.d_class, a.d_ttl) < tie(bType, b.d_class, b.d_ttl)) + if(std::tie(aType, a.d_class, a.d_ttl) < std::tie(bType, b.d_class, b.d_ttl)) return true; - if(tie(aType, a.d_class, a.d_ttl) != tie(bType, b.d_class, b.d_ttl)) + if(std::tie(aType, a.d_class, a.d_ttl) != std::tie(bType, b.d_class, b.d_ttl)) return false; string lzrp, rzrp; diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 3536902ca4..cdf265e074 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -173,7 +173,7 @@ uint64_t signatureCacheSize(const std::string& str) static bool rrsigncomp(const DNSZoneRecord& a, const DNSZoneRecord& b) { - return tie(a.dr.d_place, a.dr.d_type) < tie(b.dr.d_place, b.dr.d_type); + return std::tie(a.dr.d_place, a.dr.d_type) < std::tie(b.dr.d_place, b.dr.d_type); } static bool getBestAuthFromSet(const set& authSet, const DNSName& name, DNSName& auth) diff --git a/pdns/inflighter.cc b/pdns/inflighter.cc index 93d49f632f..e770ea4c4a 100644 --- a/pdns/inflighter.cc +++ b/pdns/inflighter.cc @@ -23,10 +23,12 @@ #include "config.h" #endif #include -#include #include #include +#include +#include + #include #include #include diff --git a/pdns/iputils.hh b/pdns/iputils.hh index d704bb3e2a..ab948b0298 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -32,8 +32,6 @@ #include "misc.hh" #include #include -#include -#include #include "namespaces.hh" @@ -91,7 +89,7 @@ union ComboAddress { bool operator==(const ComboAddress& rhs) const { - if(boost::tie(sin4.sin_family, sin4.sin_port) != boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) + if(std::tie(sin4.sin_family, sin4.sin_port) != std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) return false; if(sin4.sin_family == AF_INET) return sin4.sin_addr.s_addr == rhs.sin4.sin_addr.s_addr; @@ -109,9 +107,9 @@ union ComboAddress { if(sin4.sin_family == 0) { return false; } - if(boost::tie(sin4.sin_family, sin4.sin_port) < boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) + if(std::tie(sin4.sin_family, sin4.sin_port) < std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) return true; - if(boost::tie(sin4.sin_family, sin4.sin_port) > boost::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) + if(std::tie(sin4.sin_family, sin4.sin_port) > std::tie(rhs.sin4.sin_family, rhs.sin4.sin_port)) return false; if(sin4.sin_family == AF_INET) @@ -614,7 +612,7 @@ public: bool operator==(const Netmask& rhs) const { - return tie(d_network, d_bits) == tie(rhs.d_network, rhs.d_bits); + return std::tie(d_network, d_bits) == std::tie(rhs.d_network, rhs.d_bits); } bool empty() const @@ -1552,7 +1550,7 @@ public: bool operator==(const AddressAndPortRange& rhs) const { - return tie(d_addr, d_addrMask, d_portMask) == tie(rhs.d_addr, rhs.d_addrMask, rhs.d_portMask); + return std::tie(d_addr, d_addrMask, d_portMask) == std::tie(rhs.d_addr, rhs.d_addrMask, rhs.d_portMask); } bool operator<(const AddressAndPortRange& rhs) const diff --git a/pdns/ixfrutils.hh b/pdns/ixfrutils.hh index d42ee124cb..bce8c6b48f 100644 --- a/pdns/ixfrutils.hh +++ b/pdns/ixfrutils.hh @@ -22,7 +22,11 @@ #pragma once #include + #include +#include +#include + #include "dnsparser.hh" #include "dnsrecords.hh" diff --git a/pdns/misc.hh b/pdns/misc.hh index 92d8a2afc6..bedbf2c67c 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -26,14 +26,8 @@ #include #include #include -#include -#include -#include -#include -#include -#include -using namespace ::boost::multi_index; +#include #include "dns.hh" #include @@ -321,16 +315,16 @@ inline uint64_t uSec(const struct timeval& tv) inline bool operator<(const struct timeval& lhs, const struct timeval& rhs) { - return tie(lhs.tv_sec, lhs.tv_usec) < tie(rhs.tv_sec, rhs.tv_usec); + return std::tie(lhs.tv_sec, lhs.tv_usec) < std::tie(rhs.tv_sec, rhs.tv_usec); } inline bool operator<=(const struct timeval& lhs, const struct timeval& rhs) { - return tie(lhs.tv_sec, lhs.tv_usec) <= tie(rhs.tv_sec, rhs.tv_usec); + return std::tie(lhs.tv_sec, lhs.tv_usec) <= std::tie(rhs.tv_sec, rhs.tv_usec); } inline bool operator<(const struct timespec& lhs, const struct timespec& rhs) { - return tie(lhs.tv_sec, lhs.tv_nsec) < tie(rhs.tv_sec, rhs.tv_nsec); + return std::tie(lhs.tv_sec, lhs.tv_nsec) < std::tie(rhs.tv_sec, rhs.tv_nsec); } diff --git a/pdns/mplexer.hh b/pdns/mplexer.hh index 474ea89067..9ff4ab18c1 100644 --- a/pdns/mplexer.hh +++ b/pdns/mplexer.hh @@ -20,10 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once -#include #include -#include -#include #include #include #include @@ -55,7 +52,7 @@ class FDMultiplexer { public: typedef boost::any funcparam_t; - typedef boost::function callbackfunc_t; + typedef std::function callbackfunc_t; enum class EventKind : uint8_t { Read, @@ -196,11 +193,11 @@ public: std::vector> getTimeouts(const struct timeval& tv, bool writes = false) { std::vector> ret; - const auto tied = boost::tie(tv.tv_sec, tv.tv_usec); + const auto tied = std::tie(tv.tv_sec, tv.tv_usec); auto& idx = writes ? d_writeCallbacks.get() : d_readCallbacks.get(); for (auto it = idx.begin(); it != idx.end(); ++it) { - if (it->d_ttd.tv_sec == 0 || tied <= boost::tie(it->d_ttd.tv_sec, it->d_ttd.tv_usec)) { + if (it->d_ttd.tv_sec == 0 || tied <= std::tie(it->d_ttd.tv_sec, it->d_ttd.tv_usec)) { break; } ret.emplace_back(it->d_fd, it->d_parameter); diff --git a/pdns/namespaces.hh b/pdns/namespaces.hh index 9e1f3adaa8..e4e3fa6b08 100644 --- a/pdns/namespaces.hh +++ b/pdns/namespaces.hh @@ -21,7 +21,6 @@ */ #pragma once -#include #include #include #include @@ -31,12 +30,6 @@ #include #include -// We have a few paces where boost::tuple is used, and other places where an unscoped tuple is used -// prefer the boost one for now. We might want to switch to std::tuple one day. Same for tie. -using boost::make_tuple; -using boost::tuple; -using boost::tie; - using std::cerr; using std::clog; using std::cout; diff --git a/pdns/recpacketcache.cc b/pdns/recpacketcache.cc index dc36d898e9..926bf8003f 100644 --- a/pdns/recpacketcache.cc +++ b/pdns/recpacketcache.cc @@ -129,7 +129,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string& { *qhash = canHashPacket(queryPacket, s_skipOptions); const auto& idx = d_packetCache.get(); - auto range = idx.equal_range(tie(tag, *qhash, tcp)); + auto range = idx.equal_range(std::tie(tag, *qhash, tcp)); if (range.first == range.second) { d_misses++; @@ -144,7 +144,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string& { *qhash = canHashPacket(queryPacket, s_skipOptions); const auto& idx = d_packetCache.get(); - auto range = idx.equal_range(tie(tag, *qhash, tcp)); + auto range = idx.equal_range(std::tie(tag, *qhash, tcp)); if (range.first == range.second) { d_misses++; @@ -159,7 +159,7 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string& void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, std::string&& query, const DNSName& qname, uint16_t qtype, uint16_t qclass, std::string&& responsePacket, time_t now, uint32_t ttl, const vState& valState, OptPBData&& pbdata, bool tcp) { auto& idx = d_packetCache.get(); - auto range = idx.equal_range(tie(tag, qhash, tcp)); + auto range = idx.equal_range(std::tie(tag, qhash, tcp)); auto iter = range.first; for (; iter != range.second; ++iter) { diff --git a/pdns/recpacketcache.hh b/pdns/recpacketcache.hh index a88fc55840..df27be11ce 100644 --- a/pdns/recpacketcache.hh +++ b/pdns/recpacketcache.hh @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "packetcache.hh" diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index 159698db2b..fa740b6110 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -155,7 +155,7 @@ time_t MemRecursorCache::handleHit(MapCombo::LockedContent& content, MemRecursor MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSIndex(MapCombo::LockedContent& map, time_t now, const DNSName& qname, const QType qtype, bool requireAuth, const ComboAddress& who) { // MUTEX SHOULD BE ACQUIRED (as indicated by the reference to the content which is protected by a lock) - auto ecsIndexKey = tie(qname, qtype); + auto ecsIndexKey = std::tie(qname, qtype); auto ecsIndex = map.d_ecsIndex.find(ecsIndexKey); if (ecsIndex != map.d_ecsIndex.end() && !ecsIndex->isEmpty()) { /* we have netmask-specific entries, let's see if we match one */ @@ -221,7 +221,7 @@ MemRecursorCache::Entries MemRecursorCache::getEntries(MapCombo::LockedContent& map.d_cachedqname = qname; map.d_cachedrtag = rtag; const auto& idx = map.d_map.get(); - map.d_cachecache = idx.equal_range(tie(qname, rtag)); + map.d_cachecache = idx.equal_range(std::tie(qname, rtag)); map.d_cachecachevalid = true; } return map.d_cachecache; @@ -522,7 +522,7 @@ size_t MemRecursorCache::doWipeCache(const DNSName& name, bool sub, const QType } else { auto& ecsIdx = map->d_ecsIndex.get(); - auto ecsIndexRange = ecsIdx.equal_range(tie(name, qtype)); + auto ecsIndexRange = ecsIdx.equal_range(std::tie(name, qtype)); ecsIdx.erase(ecsIndexRange.first, ecsIndexRange.second); } } @@ -564,7 +564,7 @@ bool MemRecursorCache::doAgeCache(time_t now, const DNSName& name, const QType q { auto& mc = getMap(name); auto map = mc.lock(); - cache_t::iterator iter = map->d_map.find(tie(name, qtype)); + cache_t::iterator iter = map->d_map.find(std::tie(name, qtype)); if (iter == map->d_map.end()) { return false; } diff --git a/pdns/recursor_cache.hh b/pdns/recursor_cache.hh index 9c610f480d..51265b0a43 100644 --- a/pdns/recursor_cache.hh +++ b/pdns/recursor_cache.hh @@ -261,7 +261,7 @@ public: return; } - auto key = tie(entry.d_qname, entry.d_qtype); + auto key = std::tie(entry.d_qname, entry.d_qtype); auto ecsIndexEntry = map.d_ecsIndex.find(key); if (ecsIndexEntry != map.d_ecsIndex.end()) { ecsIndexEntry->removeNetmask(entry.d_netmask); diff --git a/pdns/recursordist/aggressive_nsec.hh b/pdns/recursordist/aggressive_nsec.hh index ec58593c2e..eb9d2bfa01 100644 --- a/pdns/recursordist/aggressive_nsec.hh +++ b/pdns/recursordist/aggressive_nsec.hh @@ -28,6 +28,8 @@ #include #include +using namespace ::boost::multi_index; + #include "base32.hh" #include "dnsname.hh" #include "dnsrecords.hh" diff --git a/pdns/recursordist/negcache.cc b/pdns/recursordist/negcache.cc index ea526bd1e4..b11d4ea265 100644 --- a/pdns/recursordist/negcache.cc +++ b/pdns/recursordist/negcache.cc @@ -62,7 +62,7 @@ bool NegCache::getRootNXTrust(const DNSName& qname, const struct timeval& now, N auto& map = getMap(lastLabel); auto content = map.lock(); - negcache_t::const_iterator ni = content->d_map.find(tie(lastLabel, qtnull)); + negcache_t::const_iterator ni = content->d_map.find(std::tie(lastLabel, qtnull)); while (ni != content->d_map.end() && ni->d_name == lastLabel && ni->d_auth.isRoot() && ni->d_qtype == qtnull) { // We have something @@ -142,7 +142,7 @@ void NegCache::updateValidationStatus(const DNSName& qname, const QType& qtype, { auto& mc = getMap(qname); auto map = mc.lock(); - auto range = map->d_map.equal_range(tie(qname, qtype)); + auto range = map->d_map.equal_range(std::tie(qname, qtype)); if (range.first != range.second) { range.first->d_validationState = newState; @@ -161,7 +161,7 @@ size_t NegCache::count(const DNSName& qname) { auto& map = getMap(qname); auto content = map.lock(); - return content->d_map.count(tie(qname)); + return content->d_map.count(std::tie(qname)); } /*! @@ -174,7 +174,7 @@ size_t NegCache::count(const DNSName& qname, const QType qtype) { auto& map = getMap(qname); auto content = map.lock(); - return content->d_map.count(tie(qname, qtype)); + return content->d_map.count(std::tie(qname, qtype)); } /*! @@ -190,7 +190,7 @@ size_t NegCache::wipe(const DNSName& name, bool subtree) if (subtree) { for (auto& map : d_maps) { auto m = map.lock(); - for (auto i = m->d_map.lower_bound(tie(name)); i != m->d_map.end();) { + for (auto i = m->d_map.lower_bound(std::tie(name)); i != m->d_map.end();) { if (!i->d_name.isPartOf(name)) break; i = m->d_map.erase(i); @@ -203,7 +203,7 @@ size_t NegCache::wipe(const DNSName& name, bool subtree) auto& map = getMap(name); auto content = map.lock(); - auto range = content->d_map.equal_range(tie(name)); + auto range = content->d_map.equal_range(std::tie(name)); auto i = range.first; while (i != range.second) { i = content->d_map.erase(i); diff --git a/pdns/recursordist/negcache.hh b/pdns/recursordist/negcache.hh index c2a0fcbf96..204406cbd2 100644 --- a/pdns/recursordist/negcache.hh +++ b/pdns/recursordist/negcache.hh @@ -23,7 +23,10 @@ #include #include +#include #include +#include +#include #include #include "dnsparser.hh" #include "dnsname.hh" diff --git a/pdns/statnode.hh b/pdns/statnode.hh index 586fe9891f..88b4a210aa 100644 --- a/pdns/statnode.hh +++ b/pdns/statnode.hh @@ -60,7 +60,7 @@ public: void submit(const DNSName& domain, int rcode, unsigned int bytes, boost::optional remote); Stat print(unsigned int depth=0, Stat newstat=Stat(), bool silent=false) const; - typedef boost::function visitor_t; + typedef std::function visitor_t; void visit(visitor_t visitor, Stat& newstat, unsigned int depth=0) const; bool empty() const { diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 00544f84d7..e2c3f573e5 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -320,7 +320,7 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, const QType qtype, std records.clear(); // partial lookup - std::pair range = d_records.equal_range(tie(qname)); + std::pair range = d_records.equal_range(std::tie(qname)); SyncRes::AuthDomain::records_t::const_iterator ziter; bool somedata = false; @@ -1675,7 +1675,7 @@ struct CacheKey QType type; DNSResourceRecord::Place place; bool operator<(const CacheKey& rhs) const { - return tie(type, place, name) < tie(rhs.type, rhs.place, rhs.name); + return std::tie(type, place, name) < std::tie(rhs.type, rhs.place, rhs.name); } }; typedef map tcache_t; diff --git a/pdns/syncres.hh b/pdns/syncres.hh index dd777e00f9..b9d9ffac69 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -832,8 +832,8 @@ private: uint8_t qtype; bool operator<(const GetBestNSAnswer &b) const { - return boost::tie(qtype, qname, bestns) < - boost::tie(b.qtype, b.qname, b.bestns); + return std::tie(qtype, qname, bestns) < + std::tie(b.qtype, b.qname, b.bestns); } }; @@ -1002,14 +1002,14 @@ struct PacketIDCompare { bool operator()(const std::shared_ptr& a, const std::shared_ptr& b) const { - if (tie(a->remote, a->tcpsock, a->type) < tie(b->remote, b->tcpsock, b->type)) { + if (std::tie(a->remote, a->tcpsock, a->type) < std::tie(b->remote, b->tcpsock, b->type)) { return true; } - if (tie(a->remote, a->tcpsock, a->type) > tie(b->remote, b->tcpsock, b->type)) { + if (std::tie(a->remote, a->tcpsock, a->type) > std::tie(b->remote, b->tcpsock, b->type)) { return false; } - return tie(a->domain, a->fd, a->id) < tie(b->domain, b->fd, b->id); + return std::tie(a->domain, a->fd, a->id) < std::tie(b->domain, b->fd, b->id); } }; @@ -1017,10 +1017,10 @@ struct PacketIDBirthdayCompare { bool operator()(const std::shared_ptr& a, const std::shared_ptr& b) const { - if (tie(a->remote, a->tcpsock, a->type) < tie(b->remote, b->tcpsock, b->type)) { + if (std::tie(a->remote, a->tcpsock, a->type) < std::tie(b->remote, b->tcpsock, b->type)) { return true; } - if (tie(a->remote, a->tcpsock, a->type) > tie(b->remote, b->tcpsock, b->type)) { + if (std::tie(a->remote, a->tcpsock, a->type) > std::tie(b->remote, b->tcpsock, b->type)) { return false; } return a->domain < b->domain; diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 5de32cf86b..28f542648f 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -828,7 +828,7 @@ int TCPNameserver::doAXFR(const DNSName &target, std::unique_ptr& q, // Group records by name and type, signpipe stumbles over interrupted rrsets if(securedZone && !presignedZone) { sort(zrrs.begin(), zrrs.end(), [](const DNSZoneRecord& a, const DNSZoneRecord& b) { - return tie(a.dr.d_name, a.dr.d_type) < tie(b.dr.d_name, b.dr.d_type); + return std::tie(a.dr.d_name, a.dr.d_type) < std::tie(b.dr.d_name, b.dr.d_type); }); } diff --git a/pdns/test-auth-zonecache_cc.cc b/pdns/test-auth-zonecache_cc.cc index 330f145201..de183ab425 100644 --- a/pdns/test-auth-zonecache_cc.cc +++ b/pdns/test-auth-zonecache_cc.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(test_replace) AuthZoneCache cache; cache.setRefreshInterval(3600); - vector> zone_indices{ + vector> zone_indices{ {DNSName("example.org."), 1}, }; cache.setReplacePending(); @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace) AuthZoneCache cache; cache.setRefreshInterval(3600); - vector> zone_indices{ + vector> zone_indices{ {DNSName("powerdns.org."), 1}}; cache.setReplacePending(); cache.add(DNSName("example.org."), 2); @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(test_remove_while_pending_replace) AuthZoneCache cache; cache.setRefreshInterval(3600); - vector> zone_indices{ + vector> zone_indices{ {DNSName("powerdns.org."), 1}}; cache.setReplacePending(); cache.remove(DNSName("powerdns.org.")); @@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(test_add_while_pending_replace_duplicate) AuthZoneCache cache; cache.setRefreshInterval(3600); - vector> zone_indices{ + vector> zone_indices{ {DNSName("powerdns.org."), 1}, {DNSName("example.org."), 2}, }; diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index b2559e7178..84243afdc4 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -278,7 +278,7 @@ void UeberBackend::updateZoneCache() { return; } - vector> zone_indices; + vector> zone_indices; g_zoneCache.setReplacePending(); for (vector::iterator i = backends.begin(); i != backends.end(); ++i ) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 01c7bf32e3..87333179d8 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -2048,7 +2048,7 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { di.backend->getDomainMetadataOne(zonename, "SOA-EDIT", soa_edit_kind); bool soa_edit_done = false; - set> seen; + set> seen; for (const auto& rrset : rrsets.array_items()) { string changetype = toUpper(stringFromJson(rrset, "changetype")); -- 2.47.3