summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-12-13 16:17:28 +0100
committerGitHub <noreply@github.com>2023-12-13 16:17:28 +0100
commitf81958f7e92844ddeefe9d9ecc27ef3df7eaf16b (patch)
treeb1cc4ee3b750e790d61c03f0dd00004995f56f5c /vespalib
parent1e07133311d2fcd31b929552281f757768c5c099 (diff)
parent11dcd5067fce454916b8394f56bbb63f1c663c0b (diff)
Merge pull request #29634 from vespa-engine/balder/make-it-build-without-optimization
- Add some more extern templates to enable code to build with -O0.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp10
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.h12
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.hpp12
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.h3
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenodeallocator.h14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreerootbase.cpp14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreerootbase.h14
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator.h8
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h4
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store.hpp2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h26
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h10
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h10
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h14
-rw-r--r--vespalib/src/vespa/vespalib/text/utf8.h2
18 files changed, 82 insertions, 93 deletions
diff --git a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
index e162d69529f..9dea9848d3a 100644
--- a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
@@ -16,7 +16,7 @@ class Comparator : public EntryComparator {
private:
EntryRef _to_find;
- EntryRef resolve(EntryRef ref) const {
+ EntryRef resolve(EntryRef ref) const noexcept {
if (ref == EntryRef()) {
return _to_find;
}
@@ -24,16 +24,16 @@ private:
}
public:
- explicit Comparator(uint32_t to_find)
+ explicit Comparator(uint32_t to_find) noexcept
: _to_find(to_find)
{}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
return resolve(lhs).ref() < resolve(rhs).ref();
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
return resolve(lhs).ref() == resolve(rhs).ref();
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
return rhs.valid() ? rhs.ref() : _to_find.ref();
}
};
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
index 28c76a317e0..a03d9358069 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
@@ -8,9 +8,12 @@ namespace vespalib::btree {
template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
+template class BTreeIteratorBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated>;
+template class BTreeIteratorBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated>;
template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeConstIterator<uint32_t, int32_t, MinMaxAggregated>;
+template class BTreeConstIterator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, const datastore::EntryComparatorWrapper>;
template class BTreeIterator<uint32_t, uint32_t, NoAggregated>;
template class BTreeIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeIterator<uint32_t, int32_t, MinMaxAggregated>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.h b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
index cd63499a5ed..a0d189ef03c 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.h
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
@@ -5,6 +5,7 @@
#include "btreenode.h"
#include "btreenodeallocator.h"
#include "btreetraits.h"
+#include <vespa/vespalib/datastore/entry_comparator_wrapper.h>
#include <cassert>
namespace vespalib::btree {
@@ -255,7 +256,7 @@ protected:
*
* @param pathSize New tree height (number of levels of internal nodes)
*/
- VESPA_DLL_LOCAL void clearPath(uint32_t pathSize);
+ void clearPath(uint32_t pathSize);
/**
* Call func with leaf entry key value as argument for all leaf entries in subtree
@@ -366,7 +367,11 @@ public:
/**
* Setup iterator to be empty and not be associated with any tree.
*/
- VESPA_DLL_LOCAL void setupEmpty();
+ void setupEmpty() {
+ clearPath(0u);
+ _leaf.invalidate();
+ _leafRoot = nullptr;
+ }
/**
* Move iterator to beyond last element in the current tree.
@@ -845,10 +850,13 @@ private:
extern template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
+extern template class BTreeIteratorBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated>;
+extern template class BTreeIteratorBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
extern template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
extern template class BTreeConstIterator<uint32_t, int32_t, MinMaxAggregated>;
+extern template class BTreeConstIterator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, const datastore::EntryComparatorWrapper>;
extern template class BTreeIterator<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
extern template class BTreeIterator<uint32_t, int32_t, MinMaxAggregated>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
index b9afce54f6b..bdca5e2c4ff 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
@@ -95,18 +95,6 @@ template <typename KeyT, typename DataT, typename AggrT,
uint32_t INTERNAL_SLOTS, uint32_t LEAF_SLOTS, uint32_t PATH_SIZE>
void
BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>::
-setupEmpty()
-{
- clearPath(0u);
- _leaf.invalidate();
- _leafRoot = nullptr;
-}
-
-
-template <typename KeyT, typename DataT, typename AggrT,
- uint32_t INTERNAL_SLOTS, uint32_t LEAF_SLOTS, uint32_t PATH_SIZE>
-void
-BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>::
end()
{
if (_pathSize == 0) {
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.cpp b/vespalib/src/vespa/vespalib/btree/btreenode.cpp
index 246eba8917b..0e5e99482ba 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.cpp
@@ -14,9 +14,12 @@ template class BTreeNodeDataWrap<BTreeNoLeafData, 16>;
template class BTreeNodeT<uint32_t, 16>;
template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
+template class BTreeNodeTT<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, 16>;
+template class BTreeNodeTT<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>;
template class BTreeInternalNode<uint32_t, NoAggregated, 16>;
+template class BTreeInternalNode<datastore::AtomicEntryRef, NoAggregated, 16>;
template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>;
template class BTreeLeafNode<uint32_t, uint32_t, NoAggregated, 16>;
template class BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.h b/vespalib/src/vespa/vespalib/btree/btreenode.h
index 7a4fa8030d3..c4862a256c9 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.h
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.h
@@ -488,9 +488,12 @@ extern template class BTreeNodeDataWrap<BTreeNoLeafData, 16>;
extern template class BTreeNodeT<uint32_t, 16>;
extern template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
+extern template class BTreeNodeTT<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, 16>;
+extern template class BTreeNodeTT<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>;
extern template class BTreeInternalNode<uint32_t, NoAggregated, 16>;
+extern template class BTreeInternalNode<datastore::AtomicEntryRef, NoAggregated, 16>;
extern template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>;
extern template class BTreeLeafNode<uint32_t, uint32_t, NoAggregated, 16>;
extern template class BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
index 99faaa6e2e8..fa51a38ab9a 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
@@ -7,14 +7,10 @@ template class vespalib::Array<vespalib::datastore::EntryRef>;
namespace vespalib::btree {
-template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
index 16bd46a5596..e36d1507495 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
+++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
@@ -178,15 +178,11 @@ public:
const NodeStore &getNodeStore() const { return _nodeStore; }
};
-extern template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp b/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
index b6eb589ea4a..48f4754ec4c 100644
--- a/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
@@ -4,14 +4,10 @@
namespace vespalib::btree {
-template class BTreeRootBase<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreerootbase.h b/vespalib/src/vespa/vespalib/btree/btreerootbase.h
index 108cb2412a1..fa179dc8730 100644
--- a/vespalib/src/vespa/vespalib/btree/btreerootbase.h
+++ b/vespalib/src/vespa/vespalib/btree/btreerootbase.h
@@ -85,14 +85,10 @@ protected:
void recursiveDelete(BTreeNode::Ref node, NodeAllocatorType &allocator);
};
-extern template class BTreeRootBase<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
index 9de2628b318..205284ee299 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
@@ -14,14 +14,14 @@ namespace vespalib::datastore {
*/
class EntryComparator {
public:
- virtual ~EntryComparator() {}
+ virtual ~EntryComparator() = default;
/**
* Returns true if the value represented by lhs ref is less than the value represented by rhs ref.
*/
- virtual bool less(const EntryRef lhs, const EntryRef rhs) const = 0;
- virtual bool equal(const EntryRef lhs, const EntryRef rhs) const = 0;
- virtual size_t hash(const EntryRef rhs) const = 0;
+ virtual bool less(const EntryRef lhs, const EntryRef rhs) const noexcept = 0;
+ virtual bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept = 0;
+ virtual size_t hash(const EntryRef rhs) const noexcept = 0;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
index e31b639928a..02281ab0435 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
@@ -12,10 +12,10 @@ namespace vespalib::datastore {
class EntryComparatorWrapper {
const EntryComparator &_comp;
public:
- EntryComparatorWrapper(const EntryComparator &comp)
+ EntryComparatorWrapper(const EntryComparator &comp) noexcept
: _comp(comp)
{ }
- bool operator()(const AtomicEntryRef &lhs, const AtomicEntryRef &rhs) const {
+ bool operator()(const AtomicEntryRef &lhs, const AtomicEntryRef &rhs) const noexcept {
return _comp.less(lhs.load_acquire(), rhs.load_acquire());
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
index b2c4d4e8d7e..ab2770bc1b0 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
@@ -29,7 +29,7 @@ using DefaultUniqueStoreDictionary = UniqueStoreDictionary<DefaultDictionary>;
template <typename EntryT, typename RefT, typename Comparator, typename Allocator>
UniqueStore<EntryT, RefT, Comparator, Allocator>::UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator)
- : UniqueStore(std::move(memory_allocator), [](const auto& data_store) { return ComparatorType(data_store);})
+ : UniqueStore(std::move(memory_allocator), [](const auto& data_store) noexcept { return ComparatorType(data_store);})
{}
template <typename EntryT, typename RefT, typename Comparator, typename Allocator>
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
index 267245bc215..68a0a532ed3 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
@@ -16,13 +16,13 @@ namespace vespalib::datastore {
template <typename EntryT>
class UniqueStoreComparatorHelper {
public:
- static bool less(const EntryT& lhs, const EntryT& rhs) {
+ static bool less(const EntryT& lhs, const EntryT& rhs) noexcept {
return lhs < rhs;
}
- static bool equal(const EntryT& lhs, const EntryT& rhs) {
+ static bool equal(const EntryT& lhs, const EntryT& rhs) noexcept {
return lhs == rhs;
}
- static size_t hash(const EntryT& rhs) {
+ static size_t hash(const EntryT& rhs) noexcept {
vespalib::hash<EntryT> hasher;
return hasher(rhs);
}
@@ -36,7 +36,7 @@ template <typename EntryT>
class UniqueStoreFloatingPointComparatorHelper
{
public:
- static bool less(EntryT lhs, const EntryT rhs) {
+ static bool less(EntryT lhs, const EntryT rhs) noexcept {
if (std::isnan(lhs)) {
return !std::isnan(rhs);
} else if (std::isnan(rhs)) {
@@ -45,7 +45,7 @@ public:
return (lhs < rhs);
}
}
- static bool equal(EntryT lhs, const EntryT rhs) {
+ static bool equal(EntryT lhs, const EntryT rhs) noexcept {
if (std::isnan(lhs)) {
return std::isnan(rhs);
} else if (std::isnan(rhs)) {
@@ -54,7 +54,7 @@ public:
return (lhs == rhs);
}
}
- static size_t hash(EntryT rhs) {
+ static size_t hash(EntryT rhs) noexcept {
if (std::isnan(rhs)) {
return 0;
} else {
@@ -98,7 +98,7 @@ protected:
const DataStoreType &_store;
const EntryType _lookup_value;
- inline const EntryType &get(EntryRef ref) const {
+ const EntryType &get(EntryRef ref) const noexcept {
if (ref.valid()) {
RefType iRef(ref);
return _store.template getEntry<WrappedEntryType>(iRef)->value();
@@ -106,34 +106,34 @@ protected:
return _lookup_value;
}
}
- UniqueStoreComparator(const DataStoreType &store, const EntryType &lookup_value)
+ UniqueStoreComparator(const DataStoreType &store, const EntryType &lookup_value) noexcept
: _store(store),
_lookup_value(lookup_value)
{
}
public:
- UniqueStoreComparator(const DataStoreType &store)
+ UniqueStoreComparator(const DataStoreType &store) noexcept
: _store(store),
_lookup_value()
{
}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const EntryType &lhsValue = get(lhs);
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::less(lhsValue, rhsValue);
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const EntryType &lhsValue = get(lhs);
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::equal(lhsValue, rhsValue);
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::hash(rhsValue);
}
- UniqueStoreComparator<EntryT, RefT> make_for_lookup(const EntryType& lookup_value) const {
+ UniqueStoreComparator<EntryT, RefT> make_for_lookup(const EntryType& lookup_value) const noexcept {
return UniqueStoreComparator<EntryT, RefT>(_store, lookup_value);
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h b/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
index b8496f40464..a14e32ab2ad 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
@@ -15,18 +15,18 @@ namespace vespalib::datastore {
class UniqueStoreEntryBase {
mutable uint32_t _ref_count;
protected:
- constexpr UniqueStoreEntryBase()
+ constexpr UniqueStoreEntryBase() noexcept
: _ref_count(0u)
{
}
public:
- uint32_t get_ref_count() const { return _ref_count; }
- void set_ref_count(uint32_t ref_count) const { _ref_count = ref_count; }
- void inc_ref_count() const {
+ uint32_t get_ref_count() const noexcept { return _ref_count; }
+ void set_ref_count(uint32_t ref_count) const noexcept { _ref_count = ref_count; }
+ void inc_ref_count() const noexcept {
assert(_ref_count < std::numeric_limits<uint32_t>::max());
++_ref_count;
}
- void dec_ref_count() const {
+ void dec_ref_count() const noexcept {
assert(_ref_count > 0u);
--_ref_count;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
index 1294a936a38..06b51ad301c 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
@@ -32,12 +32,12 @@ uint32_t get_type_id(size_t string_len);
class UniqueStoreSmallStringEntry : public UniqueStoreEntryBase {
char _value[0];
public:
- constexpr UniqueStoreSmallStringEntry()
+ constexpr UniqueStoreSmallStringEntry() noexcept
: UniqueStoreEntryBase(),
_value()
{ }
- UniqueStoreSmallStringEntry(const char *value, size_t value_len, size_t array_size)
+ UniqueStoreSmallStringEntry(const char *value, size_t value_len, size_t array_size) noexcept
: UniqueStoreEntryBase()
{
assert(value_offset() + value_len < array_size);
@@ -45,12 +45,12 @@ public:
memset(&_value[0] + value_len, 0, array_size - value_len - value_offset());
}
- void clean_hold(size_t array_size) {
+ void clean_hold(size_t array_size) noexcept {
memset(&_value[0], 0, array_size - value_offset());
}
- const char *value() const { return &_value[0]; }
- size_t value_offset() const { return &_value[0] - reinterpret_cast<const char *>(this); }
+ const char *value() const noexcept { return &_value[0]; }
+ size_t value_offset() const noexcept { return &_value[0] - reinterpret_cast<const char *>(this); }
};
/*
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
index a0f338ad931..f91f2c1fd9b 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
@@ -23,7 +23,7 @@ protected:
const DataStoreType &_store;
const char *_lookup_value;
- const char *get(EntryRef ref) const {
+ const char *get(EntryRef ref) const noexcept {
if (ref.valid()) {
RefType iRef(ref);
const auto &meta = _store.getBufferMeta(iRef.bufferId());
@@ -37,33 +37,33 @@ protected:
return _lookup_value;
}
}
- UniqueStoreStringComparator(const DataStoreType &store, const char *lookup_value)
+ UniqueStoreStringComparator(const DataStoreType &store, const char *lookup_value) noexcept
: _store(store),
_lookup_value(lookup_value)
{
}
public:
- UniqueStoreStringComparator(const DataStoreType &store)
+ UniqueStoreStringComparator(const DataStoreType &store) noexcept
: _store(store),
_lookup_value(nullptr)
{
}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const char *lhs_value = get(lhs);
const char *rhs_value = get(rhs);
return (strcmp(lhs_value, rhs_value) < 0);
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const char *lhs_value = get(lhs);
const char *rhs_value = get(rhs);
return (strcmp(lhs_value, rhs_value) == 0);
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
const char *rhs_value = get(rhs);
vespalib::hash<const char *> hasher;
return hasher(rhs_value);
}
- UniqueStoreStringComparator<RefT> make_for_lookup(const char* lookup_value) const {
+ UniqueStoreStringComparator<RefT> make_for_lookup(const char* lookup_value) const noexcept {
return UniqueStoreStringComparator<RefT>(_store, lookup_value);
}
};
diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h
index b1168c48ccf..26439f16d66 100644
--- a/vespalib/src/vespa/vespalib/text/utf8.h
+++ b/vespalib/src/vespa/vespalib/text/utf8.h
@@ -304,7 +304,7 @@ public:
*
* @return a valid UCS-4 codepoint
**/
- uint32_t getChar() noexcept{ return getChar(Utf8::REPLACEMENT_CHAR); }
+ uint32_t getChar() noexcept { return getChar(Utf8::REPLACEMENT_CHAR); }
/**
* count the number of UCS-4 characters will be returned when