summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/net/async_resolver/async_resolver_test.cpp3
-rw-r--r--vespalib/src/tests/rendezvous/rendezvous_test.cpp23
-rw-r--r--vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp3
-rw-r--r--vespalib/src/tests/stllike/hash_test.cpp4
-rw-r--r--vespalib/src/tests/stllike/hashtable_test.cpp4
-rw-r--r--vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp2
-rw-r--r--vespalib/src/tests/testapp-debug/debugtest.cpp32
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreebuilder.hpp24
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeinserter.hpp8
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.hpp4
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.h4
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.hpp4
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeremover.hpp6
-rw-r--r--vespalib/src/vespa/vespalib/datastore/buffer_type.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp2
-rw-r--r--vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp22
-rw-r--r--vespalib/src/vespa/vespalib/net/async_resolver.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/net/async_resolver.h1
-rw-r--r--vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.h1
-rw-r--r--vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.h1
-rw-r--r--vespalib/src/vespa/vespalib/test/btree/btree_printer.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/CMakeLists.txt2
-rw-r--r--vespalib/src/vespa/vespalib/util/count_down_latch.cpp9
-rw-r--r--vespalib/src/vespa/vespalib/util/count_down_latch.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/gate.cpp9
-rw-r--r--vespalib/src/vespa/vespalib/util/gate.h1
28 files changed, 122 insertions, 58 deletions
diff --git a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
index 6e8e6e5f761..739f036fb5c 100644
--- a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
+++ b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp
@@ -22,12 +22,15 @@ struct MyClock : public AsyncResolver::Clock {
using time_point = AsyncResolver::time_point;
using seconds = AsyncResolver::seconds;
time_point my_now;
+ ~MyClock() override;
void set_now(seconds t) {
my_now = time_point(std::chrono::duration_cast<time_point::duration>(t));
}
AsyncResolver::time_point now() override { return my_now; }
};
+MyClock::~MyClock() = default;
+
struct BlockingHostResolver : public AsyncResolver::HostResolver {
CountDownLatch callers;
Gate barrier;
diff --git a/vespalib/src/tests/rendezvous/rendezvous_test.cpp b/vespalib/src/tests/rendezvous/rendezvous_test.cpp
index 616824af7f1..11bcf62d77e 100644
--- a/vespalib/src/tests/rendezvous/rendezvous_test.cpp
+++ b/vespalib/src/tests/rendezvous/rendezvous_test.cpp
@@ -15,6 +15,7 @@ struct Value {
template <typename T, bool ext_id>
struct Empty : Rendezvous<int, T, ext_id> {
Empty(size_t n) : Rendezvous<int, T, ext_id>(n) {}
+ ~Empty() override;
void mingle() override {}
T meet(size_t thread_id) {
if constexpr (ext_id) {
@@ -26,6 +27,9 @@ struct Empty : Rendezvous<int, T, ext_id> {
}
};
+template <typename T, bool ext_id>
+Empty<T, ext_id>::~Empty() = default;
+
template <bool ext_id>
struct Add : Rendezvous<size_t, std::pair<size_t, size_t>, ext_id> {
using Super = Rendezvous<size_t, std::pair<size_t, size_t>, ext_id>;
@@ -33,6 +37,7 @@ struct Add : Rendezvous<size_t, std::pair<size_t, size_t>, ext_id> {
using Super::in;
using Super::out;
Add(size_t n) : Super(n) {}
+ ~Add() override;
void mingle() override {
size_t sum = 0;
for (size_t i = 0; i < size(); ++i) {
@@ -45,12 +50,16 @@ struct Add : Rendezvous<size_t, std::pair<size_t, size_t>, ext_id> {
};
template <bool ext_id>
+Add<ext_id>::~Add() = default;
+
+template <bool ext_id>
struct Modify : Rendezvous<size_t, size_t, ext_id> {
using Super = Rendezvous<size_t, size_t, ext_id>;
using Super::size;
using Super::in;
using Super::out;
Modify(size_t n) : Super(n) {}
+ ~Modify() override;
void mingle() override {
for (size_t i = 0; i < size(); ++i) {
in(i) += 1;
@@ -61,6 +70,9 @@ struct Modify : Rendezvous<size_t, size_t, ext_id> {
}
};
+template <bool ext_id>
+Modify<ext_id>::~Modify() = default;
+
template <typename T, bool ext_id>
struct Swap : Rendezvous<T, T, ext_id> {
using Super = Rendezvous<T, T, ext_id>;
@@ -68,12 +80,16 @@ struct Swap : Rendezvous<T, T, ext_id> {
using Super::in;
using Super::out;
Swap() : Super(2) {}
+ ~Swap() override;
void mingle() override {
out(0) = std::move(in(1));
out(1) = std::move(in(0));
}
};
+template <typename T, bool ext_id>
+Swap<T, ext_id>::~Swap() = default;
+
template <bool ext_id>
struct DetectId : Rendezvous<int, size_t, ext_id> {
using Super = Rendezvous<int, size_t, ext_id>;
@@ -81,6 +97,7 @@ struct DetectId : Rendezvous<int, size_t, ext_id> {
using Super::in;
using Super::out;
DetectId(size_t n) : Super(n) {}
+ ~DetectId() override;
void mingle() override {
for (size_t i = 0; i < size(); ++i) {
out(i) = i;
@@ -96,8 +113,12 @@ struct DetectId : Rendezvous<int, size_t, ext_id> {
}
};
+template <bool ext_id>
+DetectId<ext_id>::~DetectId() = default;
+
struct Any : Rendezvous<bool, bool> {
Any(size_t n) : Rendezvous<bool, bool>(n) {}
+ ~Any() override;
void mingle() override {
bool result = false;
for (size_t i = 0; i < size(); ++i) {
@@ -110,6 +131,8 @@ struct Any : Rendezvous<bool, bool> {
bool check(bool flag) { return this->rendezvous(flag); }
};
+Any::~Any() = default;
+
TEST("require that creating an empty rendezvous will fail") {
EXPECT_EXCEPTION(Add<false>(0), IllegalArgumentException, "");
EXPECT_EXCEPTION(Add<true>(0), IllegalArgumentException, "");
diff --git a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp
index 8d5d393fe22..5d69a18112a 100644
--- a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp
+++ b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp
@@ -37,12 +37,15 @@ struct State {
struct Blocker : Runnable {
Gate start;
+ ~Blocker() override;
void run() override {
start.await();
}
Gate done; // set externally
};
+Blocker::~Blocker() = default;
+
TEST_MT_FF("require that signals can be counted and cancelled", 2, Signal, size_t(16000)) {
if (thread_id == 0) {
for (size_t i = 0; i < f2; ++i) {
diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp
index 5cba6f73e10..c530bbdb14a 100644
--- a/vespalib/src/tests/stllike/hash_test.cpp
+++ b/vespalib/src/tests/stllike/hash_test.cpp
@@ -455,8 +455,8 @@ class WrappedKey
public:
WrappedKey() : _key() { }
WrappedKey(int key) : _key(std::make_unique<const int>(key)) { }
- size_t hash() const { return vespalib::hash<int>()(*_key); }
- bool operator==(const WrappedKey &rhs) const { return *_key == *rhs._key; }
+ size_t hash() const noexcept { return vespalib::hash<int>()(*_key); }
+ bool operator==(const WrappedKey &rhs) const noexcept { return *_key == *rhs._key; }
};
}
diff --git a/vespalib/src/tests/stllike/hashtable_test.cpp b/vespalib/src/tests/stllike/hashtable_test.cpp
index 74490e413d1..ccb1136729e 100644
--- a/vespalib/src/tests/stllike/hashtable_test.cpp
+++ b/vespalib/src/tests/stllike/hashtable_test.cpp
@@ -17,7 +17,7 @@ using namespace vespalib;
namespace {
template<typename T>
-struct Dereference : std::unary_function<T, std::unique_ptr<T>> {
+struct Dereference {
T &operator()(std::unique_ptr<T>& p) const { return *p; }
const T& operator()(const std::unique_ptr<T>& p) const { return *p; }
};
@@ -119,7 +119,7 @@ TEST("require that you can insert duplicates") {
}
template<typename To, typename Vector>
-struct FirstInVector : std::unary_function<To, Vector> {
+struct FirstInVector {
To &operator()(Vector& v) const { return v[0]; }
const To& operator()(const Vector& v) const { return v[0]; }
};
diff --git a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
index 86c3dc1411c..7b9dfc98fa5 100644
--- a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
+++ b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
@@ -92,7 +92,7 @@ private:
Gid _gid;
};
-struct IndirectCmp : public std::binary_function<Slot*, Slot*, bool> {
+struct IndirectCmp {
bool operator() (const Slot* s1, const Slot* s2) noexcept {
return s1->cmp(*s2) < 0;
}
diff --git a/vespalib/src/tests/testapp-debug/debugtest.cpp b/vespalib/src/tests/testapp-debug/debugtest.cpp
index 2ff7affc323..78bf3d69215 100644
--- a/vespalib/src/tests/testapp-debug/debugtest.cpp
+++ b/vespalib/src/tests/testapp-debug/debugtest.cpp
@@ -5,25 +5,25 @@ using namespace vespalib;
void testDebug() {
TEST_DEBUG("lhs.out", "rhs.out");
- EXPECT_EQUAL("a\n"
- "b\n"
- "c\n",
+ EXPECT_EQUAL(string("a\n"
+ "b\n"
+ "c\n"),
- "a\n"
- "b\n"
- "c\n"
- "d\n");
- EXPECT_EQUAL("a\n"
- "d\n"
- "b\n"
- "c\n",
+ string("a\n"
+ "b\n"
+ "c\n"
+ "d\n"));
+ EXPECT_EQUAL(string("a\n"
+ "d\n"
+ "b\n"
+ "c\n"),
- "a\n"
- "b\n"
- "c\n"
- "d\n");
+ string("a\n"
+ "b\n"
+ "c\n"
+ "d\n"));
EXPECT_EQUAL(1, 2);
- EXPECT_EQUAL("foo", "bar");
+ EXPECT_EQUAL(string("foo"), string("bar"));
}
TEST_MAIN() {
diff --git a/vespalib/src/vespa/vespalib/btree/btreebuilder.hpp b/vespalib/src/vespa/vespalib/btree/btreebuilder.hpp
index 5abe2b2cebd..3162dfb4820 100644
--- a/vespalib/src/vespa/vespalib/btree/btreebuilder.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreebuilder.hpp
@@ -106,10 +106,10 @@ normalize()
/* Adjust validLeaves for rightmost nodes */
for (level = 0; level < _inodes.size(); level++) {
InternalNodeType *inode = _inodes[level].data;
- NodeRef lcRef(inode->getLastChild());
+ NodeRef lcRef(inode->get_last_child_relaxed());
assert(NodeAllocatorType::isValidRef(lcRef));
assert((level == 0) == _allocator.isLeafRef(lcRef));
- inode->incValidLeaves(_allocator.validLeaves(inode->getLastChild()));
+ inode->incValidLeaves(_allocator.validLeaves(inode->get_last_child_relaxed()));
inode->update(inode->validSlots() - 1,
level == 0 ?
_allocator.mapLeafRef(lcRef)->getLastKey() :
@@ -134,10 +134,10 @@ normalize()
inode = _allocator.mapInternalRef(iRef);
assert(inode != nullptr);
assert(inode->validSlots() >= 1);
- child = inode->getLastChild();
+ child = inode->get_last_child_relaxed();
} else {
/* Use next to last child of rightmost node on level */
- child = inode->getChild(inode->validSlots() - 2);
+ child = inode->get_child_relaxed(inode->validSlots() - 2);
}
if (level == 0)
break;
@@ -190,11 +190,11 @@ normalize()
}
if (pnode->validSlots() > 0) {
uint32_t s = pnode->validSlots() - 1;
- LeafNodeType *l = _allocator.mapLeafRef(pnode->getChild(s));
+ LeafNodeType *l = _allocator.mapLeafRef(pnode->get_child_relaxed(s));
pnode->writeKey(s, l->getLastKey());
if (s > 0) {
--s;
- l = _allocator.mapLeafRef(pnode->getChild(s));
+ l = _allocator.mapLeafRef(pnode->get_child_relaxed(s));
pnode->writeKey(s, l->getLastKey());
}
}
@@ -202,7 +202,7 @@ normalize()
InternalNodeType *lpnode =
_allocator.mapInternalRef(leftInodes[0]);
uint32_t s = lpnode->validSlots() - 1;
- LeafNodeType *l = _allocator.mapLeafRef(lpnode->getChild(s));
+ LeafNodeType *l = _allocator.mapLeafRef(lpnode->get_child_relaxed(s));
lpnode->writeKey(s, l->getLastKey());
}
}
@@ -256,11 +256,11 @@ normalize()
if (pnode->validSlots() > 0) {
uint32_t s = pnode->validSlots() - 1;
InternalNodeType *n =
- _allocator.mapInternalRef(pnode->getChild(s));
+ _allocator.mapInternalRef(pnode->get_child_relaxed(s));
pnode->writeKey(s, n->getLastKey());
if (s > 0) {
--s;
- n = _allocator.mapInternalRef(pnode->getChild(s));
+ n = _allocator.mapInternalRef(pnode->get_child_relaxed(s));
pnode->writeKey(s, n->getLastKey());
}
}
@@ -270,7 +270,7 @@ normalize()
_allocator.mapInternalRef(leftInodes[level + 1]);
uint32_t s = lpnode->validSlots() - 1;
InternalNodeType *n =
- _allocator.mapInternalRef(lpnode->getChild(s));
+ _allocator.mapInternalRef(lpnode->get_child_relaxed(s));
lpnode->writeKey(s, n->getLastKey());
}
}
@@ -333,7 +333,7 @@ allocNewLeafNode()
}
inode = _inodes[level].data;
assert(inode->validSlots() > 0);
- NodeRef lcRef(inode->getLastChild());
+ NodeRef lcRef(inode->get_last_child_relaxed());
inode->incValidLeaves(_allocator.validLeaves(lcRef));
inode->update(inode->validSlots() - 1,
level == 0 ?
@@ -358,7 +358,7 @@ allocNewLeafNode()
}
while (level > 0) {
assert(inode->validSlots() > 0);
- child = inode->getLastChild();
+ child = inode->get_last_child_relaxed();
assert(!_allocator.isLeafRef(child));
inode = _allocator.mapInternalRef(child);
level--;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeinserter.hpp b/vespalib/src/vespa/vespalib/btree/btreeinserter.hpp
index b5980e53f93..de6454f8bae 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeinserter.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeinserter.hpp
@@ -34,17 +34,17 @@ BTreeInserter<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>::rebalanceLeafEn
auto &pathElem = itr.getPath(0);
InternalNodeType *parentNode = pathElem.getWNode();
uint32_t parentIdx = pathElem.getIdx();
- BTreeNode::Ref leafRef = parentNode->getChild(parentIdx);
+ BTreeNode::Ref leafRef = parentNode->get_child_relaxed(parentIdx);
BTreeNode::Ref leftRef = BTreeNode::Ref();
LeafNodeType *leftNode = nullptr;
BTreeNode::Ref rightRef = BTreeNode::Ref();
LeafNodeType *rightNode = nullptr;
if (parentIdx > 0) {
- leftRef = parentNode->getChild(parentIdx - 1);
+ leftRef = parentNode->get_child_relaxed(parentIdx - 1);
leftNode = allocator.mapLeafRef(leftRef);
}
if (parentIdx + 1 < parentNode->validSlots()) {
- rightRef = parentNode->getChild(parentIdx + 1);
+ rightRef = parentNode->get_child_relaxed(parentIdx + 1);
rightNode = allocator.mapLeafRef(rightRef);
}
if (leftNode != nullptr && leftNode->validSlots() < LeafNodeType::maxSlots() &&
@@ -138,7 +138,7 @@ insert(BTreeNode::Ref &root,
idx = pe.getIdx();
AggrT olda(AggrCalcT::hasAggregated() ?
node->getAggregated() : AggrT());
- BTreeNode::Ref subNode = node->getChild(idx);
+ BTreeNode::Ref subNode = node->get_child_relaxed(idx);
node->update(idx, *lastKey, subNode);
node->incValidLeaves(1);
if (NodeAllocatorType::isValidRef(splitNodeRef)) {
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
index 042779f1b1b..8ecd26835c4 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
@@ -1163,13 +1163,13 @@ thaw(BTreeNode::Ref rootRef)
rootRef;
assert(node == allocator.mapInternalRef(nodeRef));
if (!node->getFrozen()) {
- node->setChild(pe.getIdx(), childRef);
+ node->set_child_relaxed(pe.getIdx(), childRef);
return rootRef;
}
InternalNodeTypeRefPair thawed = allocator.thawNode(nodeRef, node);
node = thawed.data;
pe.setNode(node);
- node->setChild(pe.getIdx(), childRef);
+ node->set_child_relaxed(pe.getIdx(), childRef);
childRef = thawed.ref;
++level;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.h b/vespalib/src/vespa/vespalib/btree/btreenode.h
index 468f17fcd1a..deeaad40ae6 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.h
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.h
@@ -336,8 +336,10 @@ private:
public:
BTreeNode::Ref getChild(uint32_t idx) const { return getData(idx); }
+ BTreeNode::Ref get_child_relaxed(uint32_t idx) const { return getData(idx); }
void setChild(uint32_t idx, BTreeNode::Ref child) { setData(idx, child); }
- BTreeNode::Ref getLastChild() const { return getChild(validSlots() - 1); }
+ void set_child_relaxed(uint32_t idx, BTreeNode::Ref child) { setData(idx, child); }
+ BTreeNode::Ref get_last_child_relaxed() const { return get_child_relaxed(validSlots() - 1); }
uint32_t validLeaves() const { return _validLeaves; }
void setValidLeaves(uint32_t newValidLeaves) { _validLeaves = newValidLeaves; }
void incValidLeaves(uint32_t delta) { _validLeaves += delta; }
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.hpp b/vespalib/src/vespa/vespalib/btree/btreenode.hpp
index 547dd6f5f3f..62773e57c6f 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.hpp
@@ -273,7 +273,7 @@ splitInsert(BTreeInternalNode *splitNode, uint32_t idx, const KeyT &key,
for (uint32_t i = sih.getMedian(); i < validSlots(); ++i) {
splitNode->_keys[i - sih.getMedian()] = _keys[i];
splitNode->setData(i - sih.getMedian(), getData(i));
- splitLeaves += allocator.validLeaves(getData(i));
+ splitLeaves += allocator.validLeaves(getChild(i));
}
splitNode->_validLeaves = splitLeaves;
this->cleanRange(sih.getMedian(), validSlots());
@@ -316,7 +316,7 @@ BTreeInternalNode<KeyT, AggrT, NumSlots>::countValidLeaves(uint32_t start, uint3
assert(end <= validSlots());
uint32_t leaves = 0;
for (uint32_t i = start; i < end; ++i) {
- leaves += allocator.validLeaves(getData(i));
+ leaves += allocator.validLeaves(getChild(i));
}
return leaves;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreeremover.hpp b/vespalib/src/vespa/vespalib/btree/btreeremover.hpp
index e0e41c1dd2d..24155abcff9 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeremover.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeremover.hpp
@@ -25,11 +25,11 @@ steal(InternalNodeType *pNode,
BTreeNode::Ref rightVictimRef = BTreeNode::Ref();
NodeType * rightVictim = nullptr;
if (idx > 0) {
- leftVictimRef = pNode->getChild(idx - 1);
+ leftVictimRef = pNode->get_child_relaxed(idx - 1);
leftVictim = allocator.template mapRef<NodeType>(leftVictimRef);
}
if (idx + 1 < pNode->validSlots()) {
- rightVictimRef = pNode->getChild(idx + 1);
+ rightVictimRef = pNode->get_child_relaxed(idx + 1);
rightVictim = allocator.template mapRef<NodeType>(rightVictimRef);
}
if (leftVictim != nullptr &&
@@ -141,7 +141,7 @@ remove(BTreeNode::Ref &root,
idx = pe.getIdx();
AggrT olda(AggrCalcT::hasAggregated() ?
node->getAggregated() : AggrT());
- BTreeNode::Ref subNode = node->getChild(idx);
+ BTreeNode::Ref subNode = node->get_child_relaxed(idx);
node->update(idx, allocator.getLastKey(subNode), subNode);
node->decValidLeaves(1);
if (level == 0) {
diff --git a/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp b/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
index 372370bc2d5..ca908d48210 100644
--- a/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
@@ -2,6 +2,7 @@
#include "atomic_entry_ref.h"
#include "buffer_type.hpp"
+#include <algorithm>
#include <cassert>
#include <cmath>
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp
index 83e9b10c6d6..ec3b0c54bda 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp
@@ -56,7 +56,7 @@ void
UniqueStoreEnumerator<RefT>::enumerateValues()
{
_next_enum_val = 1;
- _dict_snapshot->foreach_key([this](EntryRef ref) { enumerateValue(ref); });
+ _dict_snapshot->foreach_key([this](EntryRef ref) noexcept { enumerateValue(ref); });
}
template <typename RefT>
diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
index 3b063ce6805..76072aa6906 100644
--- a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
+++ b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
@@ -24,15 +24,17 @@ populationCount(const uint64_t *a, size_t sz) {
return count;
}
-template<typename T>
+template<typename T, unsigned ChunkSize>
T get(const void * base, bool invert) {
+ static_assert(sizeof(T) == ChunkSize, "sizeof(T) == ChunkSize");
T v;
memcpy(&v, base, sizeof(T));
return __builtin_expect(invert, false) ? ~v : v;
}
-template <typename T>
+template <typename T, unsigned ChunkSize>
const T * cast(const void * ptr, size_t offsetBytes) {
+ static_assert(sizeof(T) == ChunkSize, "sizeof(T) == ChunkSize");
return static_cast<const T *>(static_cast<const void *>(static_cast<const char *>(ptr) + offsetBytes));
}
@@ -43,14 +45,14 @@ andChunks(size_t offset, const std::vector<std::pair<const void *, bool>> & src,
static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize");
static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64");
Chunk * chunk = static_cast<Chunk *>(dest);
- const Chunk * tmp = cast<Chunk>(src[0].first, offset);
+ const Chunk * tmp = cast<Chunk, ChunkSize>(src[0].first, offset);
for (size_t n=0; n < Chunks; n++) {
- chunk[n] = get<Chunk>(tmp+n, src[0].second);
+ chunk[n] = get<Chunk, ChunkSize>(tmp+n, src[0].second);
}
for (size_t i(1); i < src.size(); i++) {
- tmp = cast<Chunk>(src[i].first, offset);
+ tmp = cast<Chunk, ChunkSize>(src[i].first, offset);
for (size_t n=0; n < Chunks; n++) {
- chunk[n] &= get<Chunk>(tmp+n, src[i].second);
+ chunk[n] &= get<Chunk, ChunkSize>(tmp+n, src[i].second);
}
}
}
@@ -62,14 +64,14 @@ orChunks(size_t offset, const std::vector<std::pair<const void *, bool>> & src,
static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize");
static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64");
Chunk * chunk = static_cast<Chunk *>(dest);
- const Chunk * tmp = cast<Chunk>(src[0].first, offset);
+ const Chunk * tmp = cast<Chunk, ChunkSize>(src[0].first, offset);
for (size_t n=0; n < Chunks; n++) {
- chunk[n] = get<Chunk>(tmp+n, src[0].second);
+ chunk[n] = get<Chunk, ChunkSize>(tmp+n, src[0].second);
}
for (size_t i(1); i < src.size(); i++) {
- tmp = cast<Chunk>(src[i].first, offset);
+ tmp = cast<Chunk, ChunkSize>(src[i].first, offset);
for (size_t n=0; n < Chunks; n++) {
- chunk[n] |= get<Chunk>(tmp+n, src[i].second);
+ chunk[n] |= get<Chunk, ChunkSize>(tmp+n, src[i].second);
}
}
}
diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.cpp b/vespalib/src/vespa/vespalib/net/async_resolver.cpp
index f66d34d4174..7eab9d7c13c 100644
--- a/vespalib/src/vespa/vespalib/net/async_resolver.cpp
+++ b/vespalib/src/vespa/vespalib/net/async_resolver.cpp
@@ -155,6 +155,8 @@ AsyncResolver::AsyncResolver(HostResolver::SP resolver, size_t num_threads)
{
}
+AsyncResolver::~AsyncResolver() = default;
+
void
AsyncResolver::wait_for_pending_resolves() {
_executor->sync();
diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.h b/vespalib/src/vespa/vespalib/net/async_resolver.h
index 28d04e76c16..64e2285acd2 100644
--- a/vespalib/src/vespa/vespalib/net/async_resolver.h
+++ b/vespalib/src/vespa/vespalib/net/async_resolver.h
@@ -124,6 +124,7 @@ private:
AsyncResolver(HostResolver::SP resolver, size_t num_threads);
public:
+ ~AsyncResolver();
void resolve_async(const vespalib::string &spec, ResultHandler::WP result_handler);
void wait_for_pending_resolves();
static AsyncResolver::SP create(Params params);
diff --git a/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.cpp b/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.cpp
index 91dc64e4165..832d52c0383 100644
--- a/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.cpp
+++ b/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.cpp
@@ -5,6 +5,8 @@
namespace vespalib {
+MaybeTlsCryptoEngine::~MaybeTlsCryptoEngine() = default;
+
CryptoSocket::UP
MaybeTlsCryptoEngine::create_client_crypto_socket(SocketHandle socket, const SocketSpec &spec)
{
diff --git a/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.h b/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.h
index 8c8a4452c80..2b82d6eb8bc 100644
--- a/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.h
+++ b/vespalib/src/vespa/vespalib/net/tls/maybe_tls_crypto_engine.h
@@ -28,6 +28,7 @@ public:
: _null_engine(std::make_shared<NullCryptoEngine>()),
_tls_engine(std::move(tls_engine)),
_use_tls_when_client(use_tls_when_client) {}
+ ~MaybeTlsCryptoEngine() override;
bool use_tls_when_client() const override { return _use_tls_when_client; }
bool always_use_tls_when_server() const override { return false; }
CryptoSocket::UP create_client_crypto_socket(SocketHandle socket, const SocketSpec &spec) override;
diff --git a/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.cpp b/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.cpp
index 119b4b93a54..9ae270780b5 100644
--- a/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.cpp
+++ b/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.cpp
@@ -6,6 +6,8 @@
namespace vespalib {
+TlsCryptoEngine::~TlsCryptoEngine() = default;
+
TlsCryptoEngine::TlsCryptoEngine(net::tls::TransportSecurityOptions tls_opts, net::tls::AuthorizationMode authz_mode)
: _tls_ctx(net::tls::TlsContext::create_default_context(tls_opts, authz_mode))
{
diff --git a/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.h b/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.h
index 13a514f6954..0e05363ab1b 100644
--- a/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.h
+++ b/vespalib/src/vespa/vespalib/net/tls/tls_crypto_engine.h
@@ -25,6 +25,7 @@ private:
public:
explicit TlsCryptoEngine(net::tls::TransportSecurityOptions tls_opts,
net::tls::AuthorizationMode authz_mode = net::tls::AuthorizationMode::Enforce);
+ ~TlsCryptoEngine() override;
std::unique_ptr<TlsCryptoSocket> create_tls_client_crypto_socket(SocketHandle socket, const SocketSpec &spec) override;
std::unique_ptr<TlsCryptoSocket> create_tls_server_crypto_socket(SocketHandle socket) override;
bool use_tls_when_client() const override { return true; }
diff --git a/vespalib/src/vespa/vespalib/test/btree/btree_printer.h b/vespalib/src/vespa/vespalib/test/btree/btree_printer.h
index acac4df90c8..8430dc894ba 100644
--- a/vespalib/src/vespa/vespalib/test/btree/btree_printer.h
+++ b/vespalib/src/vespa/vespalib/test/btree/btree_printer.h
@@ -60,7 +60,7 @@ class BTreePrinter
return;
}
for (uint32_t i = 0; i < n.validSlots(); ++i) {
- printNode(n.getData(i));
+ printNode(n.getChild(i));
}
}
diff --git a/vespalib/src/vespa/vespalib/util/CMakeLists.txt b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
index 752bf60c688..747ed736aad 100644
--- a/vespalib/src/vespa/vespalib/util/CMakeLists.txt
+++ b/vespalib/src/vespa/vespalib/util/CMakeLists.txt
@@ -18,6 +18,7 @@ vespa_add_library(vespalib_vespalib_util OBJECT
classname.cpp
compress.cpp
compressor.cpp
+ count_down_latch.cpp
cpu_usage.cpp
destructor_callbacks.cpp
dual_merge_director.cpp
@@ -26,6 +27,7 @@ vespa_add_library(vespalib_vespalib_util OBJECT
exceptions.cpp
executor_idle_tracking.cpp
file_area_freelist.cpp
+ gate.cpp
gencnt.cpp
generationhandler.cpp
generationholder.cpp
diff --git a/vespalib/src/vespa/vespalib/util/count_down_latch.cpp b/vespalib/src/vespa/vespalib/util/count_down_latch.cpp
new file mode 100644
index 00000000000..5064a0a962f
--- /dev/null
+++ b/vespalib/src/vespa/vespalib/util/count_down_latch.cpp
@@ -0,0 +1,9 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "count_down_latch.h"
+
+namespace vespalib {
+
+CountDownLatch::~CountDownLatch() = default;
+
+}
diff --git a/vespalib/src/vespa/vespalib/util/count_down_latch.h b/vespalib/src/vespa/vespalib/util/count_down_latch.h
index 613a60e90c5..d4298f0d5a9 100644
--- a/vespalib/src/vespa/vespalib/util/count_down_latch.h
+++ b/vespalib/src/vespa/vespalib/util/count_down_latch.h
@@ -90,7 +90,7 @@ public:
/**
* Empty. Needs to be virtual to reduce compiler warnings.
**/
- virtual ~CountDownLatch() = default;
+ virtual ~CountDownLatch();
};
} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/util/gate.cpp b/vespalib/src/vespa/vespalib/util/gate.cpp
new file mode 100644
index 00000000000..485c29dc5c8
--- /dev/null
+++ b/vespalib/src/vespa/vespalib/util/gate.cpp
@@ -0,0 +1,9 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "gate.h"
+
+namespace vespalib {
+
+Gate::~Gate() = default;
+
+}
diff --git a/vespalib/src/vespa/vespalib/util/gate.h b/vespalib/src/vespa/vespalib/util/gate.h
index c914a4f0911..315adb2939e 100644
--- a/vespalib/src/vespa/vespalib/util/gate.h
+++ b/vespalib/src/vespa/vespalib/util/gate.h
@@ -17,6 +17,7 @@ public:
* Sets the initial count to 1.
**/
Gate() noexcept : CountDownLatch(1) {}
+ ~Gate() override;
};
} // namespace vespalib