diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-05 16:23:51 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-05 16:23:51 +0100 |
commit | 7ce18031173d52b93073fa9fd9d2c57a9fdd1390 (patch) | |
tree | a66806e7817d9b963e376b43765f7b8e36294f4d | |
parent | 4b5cb9770f115b73f03fe59d6d1a4f30097cf739 (diff) |
Add noexcept specifiers to non-throwing constructors and operators.
20 files changed, 45 insertions, 41 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index c59edbef22f..735365f6aaf 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -69,17 +69,17 @@ namespace index { const uint32_t Schema::UNKNOWN_FIELD_ID(std::numeric_limits<uint32_t>::max()); -Schema::Field::Field(vespalib::stringref n, DataType dt) +Schema::Field::Field(vespalib::stringref n, DataType dt) noexcept : Field(n, dt, schema::CollectionType::SINGLE, "") { } -Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct) +Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct) noexcept : Field(n, dt, ct, "") { } -Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec) +Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec) noexcept : _name(n), _dataType(dt), _collectionType(ct), @@ -95,8 +95,8 @@ Schema::Field::Field(const std::vector<vespalib::string> & lines) { } -Schema::Field::Field(const Field &) = default; -Schema::Field & Schema::Field::operator = (const Field &) = default; +Schema::Field::Field(const Field &) noexcept = default; +Schema::Field & Schema::Field::operator = (const Field &) noexcept = default; Schema::Field::Field(Field &&) noexcept = default; Schema::Field & Schema::Field::operator = (Field &&) noexcept = default; @@ -125,7 +125,7 @@ Schema::Field::operator!=(const Field &rhs) const return !((*this) == rhs); } -Schema::IndexField::IndexField(vespalib::stringref name, DataType dt) +Schema::IndexField::IndexField(vespalib::stringref name, DataType dt) noexcept : Field(name, dt), _avgElemLen(512), _interleaved_features(false) @@ -133,7 +133,7 @@ Schema::IndexField::IndexField(vespalib::stringref name, DataType dt) } Schema::IndexField::IndexField(vespalib::stringref name, DataType dt, - CollectionType ct) + CollectionType ct) noexcept : Field(name, dt, ct), _avgElemLen(512), _interleaved_features(false) @@ -147,8 +147,8 @@ Schema::IndexField::IndexField(const std::vector<vespalib::string> &lines) { } -Schema::IndexField::IndexField(const IndexField &) = default; -Schema::IndexField & Schema::IndexField::operator = (const IndexField &) = default; +Schema::IndexField::IndexField(const IndexField &) noexcept = default; +Schema::IndexField & Schema::IndexField::operator = (const IndexField &) noexcept = default; Schema::IndexField::IndexField(IndexField &&) noexcept = default; Schema::IndexField & Schema::IndexField::operator = (IndexField &&) noexcept = default; diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index 9003578adaf..740cf4ffad6 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -38,16 +38,16 @@ public: vespalib::string _tensor_spec; public: - Field(vespalib::stringref n, DataType dt); - Field(vespalib::stringref n, DataType dt, CollectionType ct); - Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec); + Field(vespalib::stringref n, DataType dt) noexcept; + Field(vespalib::stringref n, DataType dt, CollectionType ct) noexcept; + Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec) noexcept; /** * Create this field based on the given config lines. **/ Field(const std::vector<vespalib::string> & lines); - Field(const Field &); - Field & operator = (const Field &); + Field(const Field &) noexcept; + Field & operator = (const Field &) noexcept; Field(Field &&) noexcept; Field & operator = (Field &&) noexcept; @@ -83,10 +83,10 @@ public: bool _interleaved_features; public: - IndexField(vespalib::stringref name, DataType dt); - IndexField(vespalib::stringref name, DataType dt, CollectionType ct); - IndexField(const IndexField &); - IndexField & operator = (const IndexField &); + IndexField(vespalib::stringref name, DataType dt) noexcept; + IndexField(vespalib::stringref name, DataType dt, CollectionType ct) noexcept; + IndexField(const IndexField &) noexcept; + IndexField & operator = (const IndexField &) noexcept; IndexField(IndexField &&) noexcept; IndexField & operator = (IndexField &&) noexcept; /** diff --git a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp index 080d98734bd..c2b0735ff8f 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp +++ b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp @@ -219,12 +219,12 @@ class ConstTextFieldGenerator : public FieldGenerator { string _value; public: - ConstTextFieldGenerator(std::vector<string> argv); + ConstTextFieldGenerator(std::vector<string> argv) noexcept; virtual ~ConstTextFieldGenerator() override; virtual void generateValue(vespalib::asciistream &doc, uint32_t id) override; }; -ConstTextFieldGenerator::ConstTextFieldGenerator(std::vector<string> argv) +ConstTextFieldGenerator::ConstTextFieldGenerator(std::vector<string> argv) noexcept : FieldGenerator(argv[0]), _value() { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 42971fe3d4c..a691c36097e 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -76,7 +76,7 @@ AttributeWriter::WriteField::buildFieldPath(const DocumentType &docType) _fieldPath = std::move(fp); } -AttributeWriter::WriteContext::WriteContext(ExecutorId executorId) +AttributeWriter::WriteContext::WriteContext(ExecutorId executorId) noexcept : _executorId(executorId), _fields(), _hasStructFieldAttribute(false), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h index f63a2c6efba..0ca03f07de3 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h @@ -56,7 +56,7 @@ public: // When this is true, the context only contains a single field. bool _use_two_phase_put; public: - WriteContext(ExecutorId executorId); + WriteContext(ExecutorId executorId) noexcept; WriteContext(WriteContext &&rhs) noexcept; ~WriteContext(); WriteContext &operator=(WriteContext &&rhs) noexcept; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index c254672bfd7..baa6c8eb450 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -71,7 +71,7 @@ DocumentDBConfig::DocumentDBConfig( const search::LogDocumentStore::Config & storeConfig, std::shared_ptr<const ThreadingServiceConfig> threading_service_config, const vespalib::string &configId, - const vespalib::string &docTypeName) + const vespalib::string &docTypeName) noexcept : _configId(configId), _docTypeName(docTypeName), _generation(generation), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index daca84d5fd1..dc163e91ade 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -170,7 +170,7 @@ public: const search::LogDocumentStore::Config & storeConfig, std::shared_ptr<const ThreadingServiceConfig> threading_service_config, const vespalib::string &configId, - const vespalib::string &docTypeName); + const vespalib::string &docTypeName) noexcept; DocumentDBConfig(const DocumentDBConfig &cfg); ~DocumentDBConfig(); diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 98cb8c0485e..e3d84683d70 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -65,7 +65,7 @@ using queryeval::SimpleResult; class DocSet : public std::set<uint32_t> { public: - DocSet(); + DocSet() noexcept; ~DocSet(); DocSet(const uint32_t *b, const uint32_t *e) : std::set<uint32_t>(b, e) {} DocSet & put(const uint32_t &v) { @@ -74,7 +74,7 @@ public: } }; -DocSet::DocSet() = default; +DocSet::DocSet() noexcept = default; DocSet::~DocSet() = default; template <typename V, typename T> diff --git a/searchlib/src/vespa/searchlib/expression/resultvector.h b/searchlib/src/vespa/searchlib/expression/resultvector.h index cf2f0730c37..2c10a26dd9a 100644 --- a/searchlib/src/vespa/searchlib/expression/resultvector.h +++ b/searchlib/src/vespa/searchlib/expression/resultvector.h @@ -82,6 +82,7 @@ public: DECLARE_NBO_SERIALIZE; using Vector = std::vector<B>; using BaseType = B; + ~ResultNodeVectorT() override; const Vector & getVector() const { return _result; } Vector & getVector() { return _result; } const ResultNode * find(const ResultNode & key) const override; @@ -109,6 +110,9 @@ private: }; template <typename B, typename C, typename G> +ResultNodeVectorT<B, C, G>::~ResultNodeVectorT() = default; + +template <typename B, typename C, typename G> ResultNodeVector & ResultNodeVectorT<B, C, G>::set(size_t index, const ResultNode & node) { _result[index].set(node); diff --git a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp index 53040bc42b1..c6def05ef25 100644 --- a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp +++ b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp @@ -10,7 +10,7 @@ BucketSpaceDistributionContext::BucketSpaceDistributionContext( std::shared_ptr<const lib::ClusterState> default_active_cluster_state, std::shared_ptr<const lib::ClusterState> pending_cluster_state, std::shared_ptr<const lib::Distribution> distribution, - uint16_t this_node_index) + uint16_t this_node_index) noexcept : _active_cluster_state(std::move(active_cluster_state)), _default_active_cluster_state(std::move(default_active_cluster_state)), _pending_cluster_state(std::move(pending_cluster_state)), diff --git a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h index 7a9c0fcae60..662a1b1daac 100644 --- a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h +++ b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h @@ -29,7 +29,7 @@ public: std::shared_ptr<const lib::ClusterState> default_active_cluster_state, std::shared_ptr<const lib::ClusterState> pending_cluster_state, std::shared_ptr<const lib::Distribution> distribution, - uint16_t this_node_index); + uint16_t this_node_index) noexcept; ~BucketSpaceDistributionContext(); static std::shared_ptr<BucketSpaceDistributionContext> make_state_transition( diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp index 44ab91528f2..f84eafe8d85 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp @@ -22,7 +22,7 @@ PendingMessageTracker::PendingMessageTracker(framework::ComponentRegister& cr) PendingMessageTracker::~PendingMessageTracker() = default; PendingMessageTracker::MessageEntry::MessageEntry(TimePoint timeStamp_, uint32_t msgType_, uint32_t priority_, - uint64_t msgId_, document::Bucket bucket_, uint16_t nodeIdx_) + uint64_t msgId_, document::Bucket bucket_, uint16_t nodeIdx_) noexcept : timeStamp(timeStamp_), msgType(msgType_), priority(priority_), diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.h b/storage/src/vespa/storage/distributor/pendingmessagetracker.h index 51c112152b6..51971a276b4 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.h +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.h @@ -136,7 +136,7 @@ private: uint16_t nodeIdx; MessageEntry(TimePoint timeStamp, uint32_t msgType, uint32_t priority, - uint64_t msgId, document::Bucket bucket, uint16_t nodeIdx); + uint64_t msgId, document::Bucket bucket, uint16_t nodeIdx) noexcept; vespalib::string toHtml() const; }; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index 5a7a598fb4c..d60b48a54ae 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -852,7 +852,7 @@ FileStorHandlerImpl::MessageEntry::MessageEntry(const std::shared_ptr<api::Stora { } -FileStorHandlerImpl::MessageEntry::MessageEntry(const MessageEntry& entry) +FileStorHandlerImpl::MessageEntry::MessageEntry(const MessageEntry& entry) noexcept : _command(entry._command), _timer(entry._timer), _bucket(entry._bucket), diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index b081d5f75e9..6006fdeb7fd 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -54,7 +54,7 @@ public: MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd, const document::Bucket &bId); MessageEntry(MessageEntry &&) noexcept ; - MessageEntry(const MessageEntry &); + MessageEntry(const MessageEntry &) noexcept; MessageEntry & operator = (const MessageEntry &) = delete; ~MessageEntry(); diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp index 1c89acf74b0..918a0ce2ee3 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.cpp +++ b/storage/src/vespa/storage/visiting/visitorthread.cpp @@ -22,7 +22,7 @@ using storage::api::ReturnCode; namespace storage { -VisitorThread::Event::Event(Event&& other) +VisitorThread::Event::Event(Event&& other) noexcept : _visitorId(other._visitorId), _message(other._message), _mbusReply(std::move(other._mbusReply)), @@ -34,7 +34,7 @@ VisitorThread::Event::Event(Event&& other) VisitorThread::Event::~Event() = default; VisitorThread::Event& -VisitorThread::Event::operator= (Event&& other) +VisitorThread::Event::operator= (Event&& other) noexcept { _visitorId = other._visitorId; _message = other._message; diff --git a/storage/src/vespa/storage/visiting/visitorthread.h b/storage/src/vespa/storage/visiting/visitorthread.h index 3dfe9571c1f..6df4ddd8819 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.h +++ b/storage/src/vespa/storage/visiting/visitorthread.h @@ -54,9 +54,9 @@ class VisitorThread : public framework::Runnable, metrics::MetricTimer _timer; Type _type; - Event() : _visitorId(0), _message(), _timer(), _type(NONE) {} - Event(Event&& other); - Event& operator= (Event&& other); + Event() noexcept : _visitorId(0), _message(), _timer(), _type(NONE) {} + Event(Event&& other) noexcept; + Event& operator= (Event&& other) noexcept; Event(const Event& other) = delete; Event& operator= (const Event& other) = delete; Event(api::VisitorId visitor, mbus::Reply::UP reply); diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.cpp b/vespalib/src/vespa/vespalib/net/async_resolver.cpp index 08e1774b1dd..c9ff9588fba 100644 --- a/vespalib/src/vespa/vespalib/net/async_resolver.cpp +++ b/vespalib/src/vespa/vespalib/net/async_resolver.cpp @@ -101,7 +101,7 @@ AsyncResolver::CachingHostResolver::store(const vespalib::string &host_name, con assert(_map.size() == _queue.size()); } -AsyncResolver::CachingHostResolver::CachingHostResolver(Clock::SP clock, HostResolver::SP resolver, size_t max_cache_size, seconds max_result_age) +AsyncResolver::CachingHostResolver::CachingHostResolver(Clock::SP clock, HostResolver::SP resolver, size_t max_cache_size, seconds max_result_age) noexcept : _clock(std::move(clock)), _resolver(std::move(resolver)), _max_cache_size(max_cache_size), diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.h b/vespalib/src/vespa/vespalib/net/async_resolver.h index f9f2079004b..3ead0802234 100644 --- a/vespalib/src/vespa/vespalib/net/async_resolver.h +++ b/vespalib/src/vespa/vespalib/net/async_resolver.h @@ -104,7 +104,7 @@ private: void store(const vespalib::string &host_name, const vespalib::string &ip_address); public: - CachingHostResolver(Clock::SP clock, HostResolver::SP resolver, size_t max_cache_size, seconds max_result_age); + CachingHostResolver(Clock::SP clock, HostResolver::SP resolver, size_t max_cache_size, seconds max_result_age) noexcept; vespalib::string ip_address(const vespalib::string &host_name) override; }; diff --git a/vespalib/src/vespa/vespalib/net/tls/policy_checking_certificate_verifier.cpp b/vespalib/src/vespa/vespalib/net/tls/policy_checking_certificate_verifier.cpp index 0a06a36c074..94b1f82bb22 100644 --- a/vespalib/src/vespa/vespalib/net/tls/policy_checking_certificate_verifier.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/policy_checking_certificate_verifier.cpp @@ -57,14 +57,14 @@ bool matches_all_policy_requirements(const PeerCredentials& peer_creds, const Pe class PolicyConfiguredCertificateVerifier : public CertificateVerificationCallback { AuthorizedPeers _authorized_peers; public: - explicit PolicyConfiguredCertificateVerifier(AuthorizedPeers authorized_peers); + explicit PolicyConfiguredCertificateVerifier(AuthorizedPeers authorized_peers) noexcept; ~PolicyConfiguredCertificateVerifier() override; bool verify(const PeerCredentials& peer_creds) const override; }; -PolicyConfiguredCertificateVerifier::PolicyConfiguredCertificateVerifier(AuthorizedPeers authorized_peers) +PolicyConfiguredCertificateVerifier::PolicyConfiguredCertificateVerifier(AuthorizedPeers authorized_peers) noexcept : _authorized_peers(std::move(authorized_peers)) {} PolicyConfiguredCertificateVerifier::~PolicyConfiguredCertificateVerifier() = default; |