summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-06 21:25:06 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-06 21:34:26 +0000
commit7ef38647f60cf0e6750bbddaacd09aa8f279d77d (patch)
treecb1cbe25af89221588f22db4ef3f804cecd6c26c
parent1c3d83a0499b854887e8a998cc33dd1101519738 (diff)
Use noexcept as advise by gcc -Wnoexcept
-rw-r--r--config/src/vespa/config/frt/frtconfigresponsev3.cpp2
-rw-r--r--document/src/vespa/document/base/field.h6
-rw-r--r--document/src/vespa/document/base/globalid.h8
-rw-r--r--document/src/vespa/document/bucket/bucketspace.h2
-rw-r--r--eval/src/vespa/eval/eval/basic_nodes.cpp10
-rw-r--r--eval/src/vespa/eval/eval/fast_forest.cpp16
-rw-r--r--eval/src/vespa/eval/eval/function.cpp2
-rw-r--r--eval/src/vespa/eval/eval/function.h2
-rw-r--r--eval/src/vespa/eval/eval/interpreted_function.h4
-rw-r--r--eval/src/vespa/eval/eval/llvm/compile_cache.h8
-rw-r--r--eval/src/vespa/eval/eval/simple_tensor.h2
-rw-r--r--eval/src/vespa/eval/eval/string_stuff.h4
-rw-r--r--eval/src/vespa/eval/eval/tensor_function.cpp2
-rw-r--r--eval/src/vespa/eval/eval/tensor_function.h2
-rw-r--r--eval/src/vespa/eval/eval/value_type.h4
-rw-r--r--eval/src/vespa/eval/gp/gp.h8
-rw-r--r--eval/src/vespa/eval/tensor/dense/onnx_wrapper.h8
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.cpp2
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.h10
-rw-r--r--eval/src/vespa/eval/tensor/tensor_address.h10
-rw-r--r--messagebus/src/vespa/messagebus/callstack.h2
-rw-r--r--staging_vespalib/src/vespa/vespalib/metrics/snapshots.cpp6
-rw-r--r--staging_vespalib/src/vespa/vespalib/metrics/snapshots.h8
-rw-r--r--staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h10
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp2
-rw-r--r--vdslib/src/vespa/vdslib/distribution/distribution.cpp2
-rw-r--r--vdslib/src/vespa/vdslib/distribution/distribution.h2
-rw-r--r--vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h4
-rw-r--r--vespalib/src/vespa/vespalib/data/memory.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/array_store_config.h2
-rw-r--r--vespalib/src/vespa/vespalib/net/async_resolver.h2
-rw-r--r--vespalib/src/vespa/vespalib/net/socket_address.h6
-rw-r--r--vespalib/src/vespa/vespalib/portal/portal.h2
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.h32
-rw-r--r--vespalib/src/vespa/vespalib/util/alloc.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/memory.h2
36 files changed, 96 insertions, 102 deletions
diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
index 328e86a2704..9635b4c811c 100644
--- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp
+++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp
@@ -25,7 +25,7 @@ std::string make_json(const Slime &slime, bool compact) {
class V3Payload : public Payload
{
public:
- explicit V3Payload(Slime::UP data)
+ explicit V3Payload(Slime::UP data) noexcept
: _data(std::move(data))
{
}
diff --git a/document/src/vespa/document/base/field.h b/document/src/vespa/document/base/field.h
index 305021ef29a..613fcd9df1b 100644
--- a/document/src/vespa/document/base/field.h
+++ b/document/src/vespa/document/base/field.h
@@ -91,9 +91,9 @@ public:
std::unique_ptr<FieldValue> createValue() const;
// Note that only id is checked for equality.
- bool operator==(const Field & other) const { return (_fieldId == other._fieldId); }
- bool operator!=(const Field & other) const { return (_fieldId != other._fieldId); }
- bool operator<(const Field & other) const { return (getName() < other.getName()); }
+ bool operator==(const Field & other) const noexcept { return (_fieldId == other._fieldId); }
+ bool operator!=(const Field & other) const noexcept { return (_fieldId != other._fieldId); }
+ bool operator<(const Field & other) const noexcept { return (getName() < other.getName()); }
const DataType &getDataType() const { return *_dataType; }
diff --git a/document/src/vespa/document/base/globalid.h b/document/src/vespa/document/base/globalid.h
index 391ed3a892a..1bb257b7cbf 100644
--- a/document/src/vespa/document/base/globalid.h
+++ b/document/src/vespa/document/base/globalid.h
@@ -89,7 +89,7 @@ public:
*/
explicit GlobalId(const void *gid) noexcept { set(gid); }
- GlobalId(const GlobalId &rhs) = default;
+ GlobalId(const GlobalId &rhs) noexcept = default;
/**
* Implements the assignment operator.
@@ -105,7 +105,7 @@ public:
* @param other The global id to compare to.
* @return True if this equals the other, false otherwise.
*/
- bool operator==(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) == 0); }
+ bool operator==(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) == 0); }
/**
* Implements the inequality operator.
@@ -113,7 +113,7 @@ public:
* @param other The global id to compare to.
* @return True if this does NOT equal the other, false otherwise.
*/
- bool operator!=(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) != 0); }
+ bool operator!=(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) != 0); }
/**
* Implements the less-than operator. If you intend to map global ids in such a way that they can
@@ -123,7 +123,7 @@ public:
* @param other The global id to compare to.
* @return True if comparing the bits of this to the other yields a negative result.
*/
- bool operator<(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) < 0); }
+ bool operator<(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) < 0); }
/**
* Copies the first LENGTH bytes from the given address into the internal byte array.
diff --git a/document/src/vespa/document/bucket/bucketspace.h b/document/src/vespa/document/bucket/bucketspace.h
index 99b510f7aff..ab9080efd78 100644
--- a/document/src/vespa/document/bucket/bucketspace.h
+++ b/document/src/vespa/document/bucket/bucketspace.h
@@ -29,7 +29,7 @@ public:
vespalib::string toString() const;
struct hash {
- size_t operator () (const BucketSpace& bs) const {
+ size_t operator () (const BucketSpace& bs) const noexcept {
return std::hash<Type>()(bs.getId());
}
};
diff --git a/eval/src/vespa/eval/eval/basic_nodes.cpp b/eval/src/vespa/eval/eval/basic_nodes.cpp
index bc7202bebc1..b869f2abe22 100644
--- a/eval/src/vespa/eval/eval/basic_nodes.cpp
+++ b/eval/src/vespa/eval/eval/basic_nodes.cpp
@@ -6,16 +6,14 @@
#include "interpreted_function.h"
#include "simple_tensor_engine.h"
-namespace vespalib {
-namespace eval {
-namespace nodes {
+namespace vespalib::eval::nodes {
namespace {
struct Frame {
const Node &node;
size_t child_idx;
- explicit Frame(const Node &node_in) : node(node_in), child_idx(0) {}
+ explicit Frame(const Node &node_in) noexcept : node(node_in), child_idx(0) {}
bool has_next_child() const { return (child_idx < node.num_children()); }
const Node &next_child() { return node.get_child(child_idx++); }
};
@@ -85,6 +83,4 @@ If::If(Node_UP cond_in, Node_UP true_expr_in, Node_UP false_expr_in, double p_tr
}
}
-} // namespace vespalib::eval::nodes
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/fast_forest.cpp b/eval/src/vespa/eval/eval/fast_forest.cpp
index be58c78d834..47932ff14fb 100644
--- a/eval/src/vespa/eval/eval/fast_forest.cpp
+++ b/eval/src/vespa/eval/eval/fast_forest.cpp
@@ -52,7 +52,7 @@ struct CmpNode {
uint32_t tree_id;
BitRange false_mask;
bool false_is_default;
- CmpNode(float v, uint32_t t, BitRange m, bool f_def)
+ CmpNode(float v, uint32_t t, BitRange m, bool f_def) noexcept
: value(v), tree_id(t), false_mask(m), false_is_default(f_def) {}
bool operator<(const CmpNode &rhs) const {
return (value < rhs.value);
@@ -170,14 +170,14 @@ struct FixedForest : FastForest {
float value;
uint32_t tree;
T bits;
- Mask(float v, uint32_t t, T b)
+ Mask(float v, uint32_t t, T b) noexcept
: value(v), tree(t), bits(b) {}
};
struct DMask {
uint32_t tree;
T bits;
- DMask(uint32_t t, T b)
+ DMask(uint32_t t, T b) noexcept
: tree(t), bits(b) {}
};
@@ -352,7 +352,7 @@ struct MultiWordForest : FastForest {
struct Sizes {
uint32_t fixed;
uint32_t rle;
- Sizes(uint32_t f, uint32_t r) : fixed(f), rle(r) {}
+ Sizes(uint32_t f, uint32_t r) noexcept : fixed(f), rle(r) {}
};
struct Mask {
@@ -362,9 +362,9 @@ struct MultiWordForest : FastForest {
uint32_t bits;
uint8_t rle_mask[3];
};
- Mask(float v, uint32_t word_offset, uint32_t mask_bits)
+ Mask(float v, uint32_t word_offset, uint32_t mask_bits) noexcept
: value(v), offset(word_offset), bits(mask_bits) {}
- Mask(float v, uint32_t byte_offset, uint8_t first_bits, uint8_t empty_bytes, uint8_t last_bits)
+ Mask(float v, uint32_t byte_offset, uint8_t first_bits, uint8_t empty_bytes, uint8_t last_bits) noexcept
: value(v), offset(byte_offset), rle_mask{first_bits, empty_bytes, last_bits} {}
};
@@ -374,9 +374,9 @@ struct MultiWordForest : FastForest {
uint32_t bits;
uint8_t rle_mask[3];
};
- DMask(uint32_t word_offset, uint32_t mask_bits)
+ DMask(uint32_t word_offset, uint32_t mask_bits) noexcept
: offset(word_offset), bits(mask_bits) {}
- DMask(uint32_t byte_offset, uint8_t first_bits, uint8_t empty_bytes, uint8_t last_bits)
+ DMask(uint32_t byte_offset, uint8_t first_bits, uint8_t empty_bytes, uint8_t last_bits) noexcept
: offset(byte_offset), rle_mask{first_bits, empty_bytes, last_bits} {}
};
diff --git a/eval/src/vespa/eval/eval/function.cpp b/eval/src/vespa/eval/eval/function.cpp
index 5d4d597bbf8..aeb53eaa6ba 100644
--- a/eval/src/vespa/eval/eval/function.cpp
+++ b/eval/src/vespa/eval/eval/function.cpp
@@ -96,7 +96,7 @@ struct ImplicitParams : Params {
struct ResolveContext {
const Params &params;
const SymbolExtractor *symbol_extractor;
- ResolveContext(const Params &params_in, const SymbolExtractor *symbol_extractor_in)
+ ResolveContext(const Params &params_in, const SymbolExtractor *symbol_extractor_in) noexcept
: params(params_in), symbol_extractor(symbol_extractor_in) {}
};
diff --git a/eval/src/vespa/eval/eval/function.h b/eval/src/vespa/eval/eval/function.h
index b9b9d091961..48b28d94d0b 100644
--- a/eval/src/vespa/eval/eval/function.h
+++ b/eval/src/vespa/eval/eval/function.h
@@ -43,7 +43,7 @@ private:
struct ctor_tag {};
public:
- Function(nodes::Node_UP root_in, std::vector<vespalib::string> params_in, ctor_tag)
+ Function(nodes::Node_UP root_in, std::vector<vespalib::string> params_in, ctor_tag) noexcept
: _root(std::move(root_in)), _params(std::move(params_in)) {}
Function(Function &&rhs) = delete;
Function(const Function &rhs) = delete;
diff --git a/eval/src/vespa/eval/eval/interpreted_function.h b/eval/src/vespa/eval/eval/interpreted_function.h
index f94e3144cc5..e5ec86d8a91 100644
--- a/eval/src/vespa/eval/eval/interpreted_function.h
+++ b/eval/src/vespa/eval/eval/interpreted_function.h
@@ -68,9 +68,9 @@ public:
op_function function;
uint64_t param;
public:
- explicit Instruction(op_function function_in)
+ explicit Instruction(op_function function_in) noexcept
: function(function_in), param(0) {}
- Instruction(op_function function_in, uint64_t param_in)
+ Instruction(op_function function_in, uint64_t param_in) noexcept
: function(function_in), param(param_in) {}
void perform(State &state) const {
if (function == nullptr) {
diff --git a/eval/src/vespa/eval/eval/llvm/compile_cache.h b/eval/src/vespa/eval/eval/llvm/compile_cache.h
index 61d0cc83d94..93ecd0a02e8 100644
--- a/eval/src/vespa/eval/eval/llvm/compile_cache.h
+++ b/eval/src/vespa/eval/eval/llvm/compile_cache.h
@@ -8,8 +8,7 @@
#include <atomic>
#include <mutex>
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
/**
* A compilation cache used to reduce application configuration cost
@@ -29,7 +28,7 @@ private:
std::mutex lock;
std::condition_variable cond;
CompiledFunction::UP compiled_function;
- Result() : cf(nullptr), lock(), cond(), compiled_function(nullptr) {}
+ Result() noexcept : cf(nullptr), lock(), cond(), compiled_function(nullptr) {}
};
struct Value {
size_t num_refs;
@@ -110,5 +109,4 @@ private:
};
};
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/simple_tensor.h b/eval/src/vespa/eval/eval/simple_tensor.h
index 28e11a4ffd3..1180296a396 100644
--- a/eval/src/vespa/eval/eval/simple_tensor.h
+++ b/eval/src/vespa/eval/eval/simple_tensor.h
@@ -41,7 +41,7 @@ public:
size_t index;
vespalib::string name;
static constexpr size_t npos = -1;
- Label(const TensorSpec::Label &label)
+ Label(const TensorSpec::Label &label) noexcept
: index(label.index), name(label.name) {}
bool operator<(const Label &rhs) const {
if (index != rhs.index) {
diff --git a/eval/src/vespa/eval/eval/string_stuff.h b/eval/src/vespa/eval/eval/string_stuff.h
index 692b7119691..58d37c4f98a 100644
--- a/eval/src/vespa/eval/eval/string_stuff.h
+++ b/eval/src/vespa/eval/eval/string_stuff.h
@@ -14,8 +14,8 @@ namespace vespalib::eval {
**/
struct CommaTracker {
bool first;
- CommaTracker() : first(true) {}
- CommaTracker(bool first_in) : first(first_in) {}
+ CommaTracker() noexcept : first(true) {}
+ CommaTracker(bool first_in) noexcept : first(first_in) {}
bool maybe_add_comma(vespalib::string &dst) {
if (first) {
first = false;
diff --git a/eval/src/vespa/eval/eval/tensor_function.cpp b/eval/src/vespa/eval/eval/tensor_function.cpp
index 85079b7a8e3..827f680679e 100644
--- a/eval/src/vespa/eval/eval/tensor_function.cpp
+++ b/eval/src/vespa/eval/eval/tensor_function.cpp
@@ -469,7 +469,7 @@ Peek::push_children(std::vector<Child::CREF> &children) const
[&](const Child &child) {
children.emplace_back(child);
},
- [](const TensorSpec::Label &){}
+ [](const TensorSpec::Label &) noexcept {}
}, dim.second);
}
}
diff --git a/eval/src/vespa/eval/eval/tensor_function.h b/eval/src/vespa/eval/eval/tensor_function.h
index 20631108775..7835e9b4147 100644
--- a/eval/src/vespa/eval/eval/tensor_function.h
+++ b/eval/src/vespa/eval/eval/tensor_function.h
@@ -68,7 +68,7 @@ struct TensorFunction
mutable const TensorFunction *ptr;
public:
using CREF = std::reference_wrapper<const Child>;
- Child(const TensorFunction &child) : ptr(&child) {}
+ Child(const TensorFunction &child) noexcept : ptr(&child) {}
const TensorFunction &get() const { return *ptr; }
void set(const TensorFunction &child) const { ptr = &child; }
};
diff --git a/eval/src/vespa/eval/eval/value_type.h b/eval/src/vespa/eval/eval/value_type.h
index a0934de2704..41ef0a3c7d5 100644
--- a/eval/src/vespa/eval/eval/value_type.h
+++ b/eval/src/vespa/eval/eval/value_type.h
@@ -23,9 +23,9 @@ public:
static constexpr size_type npos = -1;
vespalib::string name;
size_type size;
- Dimension(const vespalib::string &name_in)
+ Dimension(const vespalib::string &name_in) noexcept
: name(name_in), size(npos) {}
- Dimension(const vespalib::string &name_in, size_type size_in)
+ Dimension(const vespalib::string &name_in, size_type size_in) noexcept
: name(name_in), size(size_in) {}
bool operator==(const Dimension &rhs) const {
return ((name == rhs.name) && (size == rhs.size));
diff --git a/eval/src/vespa/eval/gp/gp.h b/eval/src/vespa/eval/gp/gp.h
index 88d187a40b6..5f08563fdf1 100644
--- a/eval/src/vespa/eval/gp/gp.h
+++ b/eval/src/vespa/eval/gp/gp.h
@@ -71,7 +71,7 @@ struct OpRepo {
vespalib::string name;
value_op2 fun;
size_t cost;
- Entry(const vespalib::string &name_in, value_op2 fun_in, size_t cost_in)
+ Entry(const vespalib::string &name_in, value_op2 fun_in, size_t cost_in) noexcept
: name(name_in), fun(fun_in), cost(cost_in) {}
};
feedback_fun _find_weakness;
@@ -119,7 +119,7 @@ struct Program : public Sim {
size_t code;
Ref lhs;
Ref rhs;
- Op(size_t code_in, Ref lhs_in, Ref rhs_in)
+ Op(size_t code_in, Ref lhs_in, Ref rhs_in) noexcept
: code(code_in), lhs(lhs_in), rhs(rhs_in) {}
};
struct Stats {
@@ -127,8 +127,8 @@ struct Program : public Sim {
size_t cost;
size_t born;
size_t alt;
- Stats(size_t gen) : weakness(0.0), cost(0), born(gen), alt(0) {}
- Stats(Weakness weakness_in, size_t cost_in, size_t born_in, size_t alt_in)
+ Stats(size_t gen) noexcept : weakness(0.0), cost(0), born(gen), alt(0) {}
+ Stats(Weakness weakness_in, size_t cost_in, size_t born_in, size_t alt_in) noexcept
: weakness(weakness_in), cost(cost_in), born(born_in), alt(alt_in) {}
bool operator<(const Stats &rhs) const {
if (weakness != rhs.weakness) {
diff --git a/eval/src/vespa/eval/tensor/dense/onnx_wrapper.h b/eval/src/vespa/eval/tensor/dense/onnx_wrapper.h
index 9b79e28884e..1f043a7de5e 100644
--- a/eval/src/vespa/eval/tensor/dense/onnx_wrapper.h
+++ b/eval/src/vespa/eval/tensor/dense/onnx_wrapper.h
@@ -42,9 +42,9 @@ public:
struct DimSize {
size_t value;
vespalib::string name;
- DimSize() : value(0), name() {}
- DimSize(size_t size) : value(size), name() {}
- DimSize(const vespalib::string &symbol) : value(0), name(symbol) {}
+ DimSize() noexcept : value(0), name() {}
+ DimSize(size_t size) noexcept : value(size), name() {}
+ DimSize(const vespalib::string &symbol) noexcept : value(0), name(symbol) {}
bool is_known() const { return (value > 0); }
bool is_symbolic() const { return !name.empty(); }
vespalib::string as_string() const;
@@ -66,7 +66,7 @@ public:
struct TensorType {
ElementType elements;
std::vector<int64_t> dimensions;
- TensorType(ElementType elements_in, std::vector<int64_t> dimensions_in)
+ TensorType(ElementType elements_in, std::vector<int64_t> dimensions_in) noexcept
: elements(elements_in), dimensions(std::move(dimensions_in)) {}
};
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.cpp
index ba40e37488e..e2929269ce6 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.cpp
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.cpp
@@ -6,7 +6,7 @@
namespace vespalib::tensor {
uint32_t
-SparseTensorAddressRef::calcHash() const {
+SparseTensorAddressRef::calcHash() const noexcept {
return XXH32(_start, _size, 0);
}
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.h b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.h
index 743a46d63e1..45fb7236152 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.h
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_address_ref.h
@@ -21,12 +21,12 @@ class SparseTensorAddressRef
return res;
}
public:
- SparseTensorAddressRef()
+ SparseTensorAddressRef() noexcept
: _start(nullptr), _size(0u), _hash(0u)
{
}
- SparseTensorAddressRef(const void *start_in, uint32_t size_in)
+ SparseTensorAddressRef(const void *start_in, uint32_t size_in) noexcept
: _start(start_in), _size(size_in),
_hash(calcHash())
{
@@ -40,9 +40,9 @@ public:
uint32_t hash() const { return _hash; }
- uint32_t calcHash() const;
+ uint32_t calcHash() const noexcept;
- bool operator<(const SparseTensorAddressRef &rhs) const {
+ bool operator<(const SparseTensorAddressRef &rhs) const noexcept {
size_t minSize = std::min(_size, rhs._size);
int res = memcmp(_start, rhs._start, minSize);
if (res != 0) {
@@ -51,7 +51,7 @@ public:
return _size < rhs._size;
}
- bool operator==(const SparseTensorAddressRef &rhs) const
+ bool operator==(const SparseTensorAddressRef &rhs) const noexcept
{
if (_size != rhs._size || _hash != rhs._hash) {
return false;
diff --git a/eval/src/vespa/eval/tensor/tensor_address.h b/eval/src/vespa/eval/tensor/tensor_address.h
index c8c60ef6fa6..b12a5ca2dbb 100644
--- a/eval/src/vespa/eval/tensor/tensor_address.h
+++ b/eval/src/vespa/eval/tensor/tensor_address.h
@@ -30,13 +30,13 @@ public:
public:
static const vespalib::string UNDEFINED_LABEL;
- Element(const vespalib::string &dimension_in, const vespalib::string &label_in)
+ Element(const vespalib::string &dimension_in, const vespalib::string &label_in) noexcept
: _dimension(dimension_in), _label(label_in)
{}
- Element(const Element &) = default;
- Element & operator = (const Element &) = default;
- Element(Element &&) = default;
- Element & operator = (Element &&) = default;
+ Element(const Element &) noexcept = default;
+ Element & operator = (const Element &) noexcept = default;
+ Element(Element &&) noexcept = default;
+ Element & operator = (Element &&) noexcept = default;
~Element();
const vespalib::string &dimension() const { return _dimension; }
const vespalib::string &label() const { return _label; }
diff --git a/messagebus/src/vespa/messagebus/callstack.h b/messagebus/src/vespa/messagebus/callstack.h
index 0f9d8c93b29..d4ef44c88bb 100644
--- a/messagebus/src/vespa/messagebus/callstack.h
+++ b/messagebus/src/vespa/messagebus/callstack.h
@@ -24,7 +24,7 @@ class CallStack
{
private:
struct Frame {
- Frame(IReplyHandler *r, IDiscardHandler * d, Context c) : replyHandler(r), discardHandler(d), ctx(c) {}
+ Frame(IReplyHandler *r, IDiscardHandler * d, Context c) noexcept : replyHandler(r), discardHandler(d), ctx(c) {}
IReplyHandler *replyHandler;
IDiscardHandler *discardHandler;
Context ctx;
diff --git a/staging_vespalib/src/vespa/vespalib/metrics/snapshots.cpp b/staging_vespalib/src/vespa/vespalib/metrics/snapshots.cpp
index 46de7beaac3..1e491fa29e3 100644
--- a/staging_vespalib/src/vespa/vespalib/metrics/snapshots.cpp
+++ b/staging_vespalib/src/vespa/vespalib/metrics/snapshots.cpp
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "snapshots.h"
-namespace vespalib {
-namespace metrics {
+namespace vespalib::metrics {
-} // namespace vespalib::metrics
-} // namespace vespalib
+}
diff --git a/staging_vespalib/src/vespa/vespalib/metrics/snapshots.h b/staging_vespalib/src/vespa/vespalib/metrics/snapshots.h
index ee5fc942e65..ae8ec7e6531 100644
--- a/staging_vespalib/src/vespa/vespalib/metrics/snapshots.h
+++ b/staging_vespalib/src/vespa/vespalib/metrics/snapshots.h
@@ -6,8 +6,7 @@
#include "counter_aggregator.h"
#include "gauge_aggregator.h"
-namespace vespalib {
-namespace metrics {
+namespace vespalib::metrics {
class DimensionBinding {
private:
@@ -17,7 +16,7 @@ public:
const vespalib::string &dimensionName() const { return _dimensionName; }
const vespalib::string &labelValue() const { return _labelValue; }
DimensionBinding(const vespalib::string &a,
- const vespalib::string &v)
+ const vespalib::string &v) noexcept
: _dimensionName(a), _labelValue(v)
{}
~DimensionBinding() {}
@@ -105,5 +104,4 @@ public:
void add(const GaugeSnapshot &entry) { _gauges.push_back(entry); }
};
-} // namespace vespalib::metrics
-} // namespace vespalib
+}
diff --git a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
index d1450f957de..593f9366b0b 100644
--- a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
+++ b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
@@ -35,7 +35,7 @@ private:
const JsonGetHandler *handler;
Hook(size_t seq_in,
vespalib::stringref prefix_in,
- const JsonGetHandler &handler_in)
+ const JsonGetHandler &handler_in) noexcept
: seq(seq_in), path_prefix(prefix_in), handler(&handler_in) {}
bool operator <(const Hook &rhs) const {
if (path_prefix.size() == rhs.path_prefix.size()) {
@@ -48,7 +48,7 @@ private:
struct Resource {
size_t seq;
vespalib::string path;
- Resource(size_t seq_in, vespalib::stringref path_in)
+ Resource(size_t seq_in, vespalib::stringref path_in) noexcept
: seq(seq_in), path(path_in) {}
};
@@ -58,7 +58,7 @@ private:
size_t seq;
std::vector<Hook> hooks;
std::vector<Resource> root_resources;
- State() : lock(), seq(0), hooks(), root_resources() {}
+ State() noexcept : lock(), seq(0), hooks(), root_resources() {}
size_t bind(vespalib::stringref path_prefix,
const JsonGetHandler &get_handler);
size_t add_root_resource(vespalib::stringref path);
@@ -68,8 +68,8 @@ private:
struct Unbinder : Token {
State::SP state;
size_t my_seq;
- Unbinder(State::SP state_in, size_t my_seq_in)
- : state(state_in), my_seq(my_seq_in) {}
+ Unbinder(State::SP state_in, size_t my_seq_in) noexcept
+ : state(std::move(state_in)), my_seq(my_seq_in) {}
~Unbinder() override {
state->unbind(my_seq);
}
diff --git a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
index b006e0501f3..dc4f8bbc1f1 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
+++ b/storageframework/src/vespa/storageframework/generic/thread/tickingthread.cpp
@@ -33,7 +33,7 @@ public:
TickingThreadRunner(vespalib::Monitor& m,
TickingThread& ticker,
- uint32_t threadIndex)
+ uint32_t threadIndex) noexcept
: _monitor(m), _tickingThread(ticker),
_threadIndex(threadIndex), _wantToFreeze(false), _frozen(false) {}
diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
index 452c910298c..0a154f3dec1 100644
--- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp
+++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
@@ -352,7 +352,7 @@ namespace {
double _score;
ScoredGroup() : _group(nullptr), _score(0) {}
- ScoredGroup(const Group* group, double score)
+ ScoredGroup(const Group* group, double score) noexcept
: _group(group), _score(score) {}
bool operator<(const ScoredGroup& other) const {
diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.h b/vdslib/src/vespa/vdslib/distribution/distribution.h
index 9ee505be7cd..14146af918f 100644
--- a/vdslib/src/vespa/vdslib/distribution/distribution.h
+++ b/vdslib/src/vespa/vdslib/distribution/distribution.h
@@ -49,7 +49,7 @@ private:
const Group* _group;
uint16_t _redundancy;
- ResultGroup(const Group& group, uint16_t redundancy)
+ ResultGroup(const Group& group, uint16_t redundancy) noexcept
: _group(&group), _redundancy(redundancy) {}
bool operator<(const ResultGroup& other) const {
diff --git a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h
index 87e4ee14e65..6e1e552d1e9 100644
--- a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h
+++ b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h
@@ -11,7 +11,7 @@ class PrivateKeyImpl : public PrivateKey {
EvpPkeyPtr _pkey;
Type _type;
public:
- PrivateKeyImpl(EvpPkeyPtr pkey, Type type)
+ PrivateKeyImpl(EvpPkeyPtr pkey, Type type) noexcept
: _pkey(std::move(pkey)),
_type(type)
{}
@@ -29,7 +29,7 @@ public:
class X509CertificateImpl : public X509Certificate {
X509Ptr _cert;
public:
- explicit X509CertificateImpl(X509Ptr cert) : _cert(std::move(cert)) {}
+ explicit X509CertificateImpl(X509Ptr cert) noexcept : _cert(std::move(cert)) {}
~X509CertificateImpl() = default;
::X509* native_cert() noexcept { return _cert.get(); }
diff --git a/vespalib/src/vespa/vespalib/data/memory.h b/vespalib/src/vespa/vespalib/data/memory.h
index eee0a1a3e4f..422435a8a2c 100644
--- a/vespalib/src/vespa/vespalib/data/memory.h
+++ b/vespalib/src/vespa/vespalib/data/memory.h
@@ -26,7 +26,7 @@ struct Memory
: data(str_ref.data()), size(str_ref.size()) {}
vespalib::string make_string() const;
vespalib::stringref make_stringref() const { return stringref(data, size); }
- bool operator == (const Memory &rhs) const {
+ bool operator == (const Memory &rhs) const noexcept {
return ((size == rhs.size) &&
((data == rhs.data) ||
(memcmp(data, rhs.data, size) == 0)));
diff --git a/vespalib/src/vespa/vespalib/datastore/array_store_config.h b/vespalib/src/vespa/vespalib/datastore/array_store_config.h
index fbe70eb2553..64c5b8df5ee 100644
--- a/vespalib/src/vespa/vespalib/datastore/array_store_config.h
+++ b/vespalib/src/vespa/vespalib/datastore/array_store_config.h
@@ -28,7 +28,7 @@ public:
AllocSpec(size_t minArraysInBuffer_,
size_t maxArraysInBuffer_,
size_t numArraysForNewBuffer_,
- float allocGrowFactor_)
+ float allocGrowFactor_) noexcept
: minArraysInBuffer(minArraysInBuffer_),
maxArraysInBuffer(maxArraysInBuffer_),
numArraysForNewBuffer(numArraysForNewBuffer_),
diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.h b/vespalib/src/vespa/vespalib/net/async_resolver.h
index c80fb7d938d..590e6672922 100644
--- a/vespalib/src/vespa/vespalib/net/async_resolver.h
+++ b/vespalib/src/vespa/vespalib/net/async_resolver.h
@@ -75,7 +75,7 @@ private:
HostResolver::SP _resolver;
seconds _max_resolve_time;
public:
- LoggingHostResolver(Clock::SP clock, HostResolver::SP resolver, seconds max_resolve_time)
+ LoggingHostResolver(Clock::SP clock, HostResolver::SP resolver, seconds max_resolve_time) noexcept
: _clock(std::move(clock)), _resolver(std::move(resolver)), _max_resolve_time(max_resolve_time) {}
vespalib::string ip_address(const vespalib::string &host_name) override;
};
diff --git a/vespalib/src/vespa/vespalib/net/socket_address.h b/vespalib/src/vespa/vespalib/net/socket_address.h
index 5e706742e1f..2b75eae8948 100644
--- a/vespalib/src/vespa/vespalib/net/socket_address.h
+++ b/vespalib/src/vespa/vespalib/net/socket_address.h
@@ -29,9 +29,9 @@ private:
const sockaddr_un *addr_un() const { return reinterpret_cast<const sockaddr_un *>(&_addr); }
SocketAddress(const sockaddr *addr_in, socklen_t addrlen_in);
public:
- SocketAddress() { memset(this, 0, sizeof(SocketAddress)); }
- SocketAddress(const SocketAddress &rhs) { memcpy(this, &rhs, sizeof(SocketAddress)); }
- SocketAddress &operator=(const SocketAddress &rhs) {
+ SocketAddress() noexcept { memset(this, 0, sizeof(SocketAddress)); }
+ SocketAddress(const SocketAddress &rhs) noexcept { memcpy(this, &rhs, sizeof(SocketAddress)); }
+ SocketAddress &operator=(const SocketAddress &rhs) noexcept {
memcpy(this, &rhs, sizeof(SocketAddress));
return *this;
}
diff --git a/vespalib/src/vespa/vespalib/portal/portal.h b/vespalib/src/vespa/vespalib/portal/portal.h
index fc3b81b37e6..1c5b9f88a5f 100644
--- a/vespalib/src/vespa/vespalib/portal/portal.h
+++ b/vespalib/src/vespa/vespalib/portal/portal.h
@@ -80,7 +80,7 @@ private:
uint64_t handle;
vespalib::string prefix;
GetHandler *handler;
- BindState(uint64_t handle_in, vespalib::string prefix_in, GetHandler &handler_in)
+ BindState(uint64_t handle_in, vespalib::string prefix_in, GetHandler &handler_in) noexcept
: handle(handle_in), prefix(prefix_in), handler(&handler_in) {}
bool operator<(const BindState &rhs) const {
if (prefix.size() == rhs.prefix.size()) {
diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h
index d85a01b8d52..7d4ed06c411 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.h
+++ b/vespalib/src/vespa/vespalib/stllike/string.h
@@ -23,9 +23,13 @@ public:
typedef size_t size_type;
static const size_type npos = static_cast<size_type>(-1);
stringref() : _s(""), _sz(0) { }
- stringref(const char * s) : _s(s), _sz(strlen(s)) { }
- stringref(const char * s, size_type sz) : _s(s), _sz(sz) { }
- stringref(const std::string & s) : _s(s.c_str()), _sz(s.size()) { }
+ stringref(const char * s) noexcept : _s(s), _sz(strlen(s)) { }
+ stringref(const char * s, size_type sz) noexcept : _s(s), _sz(sz) { }
+ stringref(const std::string & s) noexcept : _s(s.c_str()), _sz(s.size()) { }
+ stringref(const stringref &) noexcept = default;
+ stringref & operator =(const stringref &) noexcept = default;
+ stringref(stringref &&) noexcept = default;
+ stringref & operator =(stringref &&) noexcept = default;
/**
* return a pointer to the data held, or NULL.
@@ -172,10 +176,10 @@ public:
typedef char * reverse_iterator;
typedef const char * const_reverse_iterator;
static const size_type npos = static_cast<size_type>(-1);
- small_string() : _buf(_stack), _sz(0), _bufferSize(StackSize) { _stack[0] = '\0'; }
- small_string(const char * s) : _buf(_stack), _sz(s ? strlen(s) : 0) { init(s); }
- small_string(const void * s, size_type sz) : _buf(_stack), _sz(sz) { init(s); }
- small_string(stringref s) : _buf(_stack), _sz(s.size()) { init(s.data()); }
+ small_string() noexcept : _buf(_stack), _sz(0), _bufferSize(StackSize) { _stack[0] = '\0'; }
+ small_string(const char * s) noexcept : _buf(_stack), _sz(s ? strlen(s) : 0) { init(s); }
+ small_string(const void * s, size_type sz) noexcept : _buf(_stack), _sz(sz) { init(s); }
+ small_string(stringref s) noexcept : _buf(_stack), _sz(s.size()) { init(s.data()); }
small_string(const std::string & s) : _buf(_stack), _sz(s.size()) { init(s.data()); }
small_string(small_string && rhs) noexcept
: _sz(rhs.size()), _bufferSize(rhs._bufferSize)
@@ -216,13 +220,13 @@ public:
small_string& operator= (const small_string &rhs) noexcept {
return assign(rhs.data(), rhs.size());
}
- small_string & operator= (stringref rhs) {
+ small_string & operator= (stringref rhs) noexcept {
return assign(rhs.data(), rhs.size());
}
- small_string& operator= (const char *s) {
+ small_string& operator= (const char *s) noexcept {
return assign(s);
}
- small_string& operator= (const std::string &rhs) {
+ small_string& operator= (const std::string &rhs) noexcept {
return operator= (stringref(rhs));
}
void swap(small_string & rhs) noexcept {
@@ -544,7 +548,7 @@ private:
_reserveBytes(newBufferSize);
}
}
- void move(small_string && rhs) {
+ void move(small_string && rhs) noexcept {
if (rhs.isAllocated()) {
_buf = rhs._buf;
rhs._buf = rhs._stack;
@@ -627,21 +631,21 @@ operator + (const char * a, const small_string<StackSize> & b);
template<typename T, uint32_t StackSize>
bool
-operator == (const T& a, const small_string<StackSize>& b)
+operator == (const T& a, const small_string<StackSize>& b) noexcept
{
return b == a;
}
template<typename T, uint32_t StackSize>
bool
-operator != (const T& a, const small_string<StackSize>& b)
+operator != (const T& a, const small_string<StackSize>& b) noexcept
{
return b != a;
}
template<typename T, uint32_t StackSize>
bool
-operator < (const T& a, const small_string<StackSize>& b)
+operator < (const T& a, const small_string<StackSize>& b) noexcept
{
return b > a;
}
diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp
index c550964a19b..29285932f63 100644
--- a/vespalib/src/vespa/vespalib/util/alloc.cpp
+++ b/vespalib/src/vespa/vespalib/util/alloc.cpp
@@ -184,7 +184,7 @@ private:
struct MMapLimitAndAlignmentHash {
- std::size_t operator ()(MMapLimitAndAlignment key) const { return key.hash(); }
+ std::size_t operator ()(MMapLimitAndAlignment key) const noexcept { return key.hash(); }
};
using AutoAllocatorsMap = std::unordered_map<MMapLimitAndAlignment, AutoAllocator::UP, MMapLimitAndAlignmentHash>;
diff --git a/vespalib/src/vespa/vespalib/util/memory.h b/vespalib/src/vespa/vespalib/util/memory.h
index 43be0531aec..f1c7c7820f1 100644
--- a/vespalib/src/vespa/vespalib/util/memory.h
+++ b/vespalib/src/vespa/vespalib/util/memory.h
@@ -330,7 +330,7 @@ class CloneablePtr
{
public:
/** @brief construct (from pointer) */
- CloneablePtr(T * p=nullptr) : _p(p) { }
+ CloneablePtr(T * p=nullptr) noexcept : _p(p) { }
CloneablePtr(CloneablePtr && rhs) noexcept : _p(rhs._p) { rhs._p = nullptr; }
CloneablePtr & operator = (CloneablePtr && rhs) noexcept {