summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fnet/src/vespa/fnet/frt/invokable.h5
-rw-r--r--searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp27
-rw-r--r--searchlib/src/tests/features/beta/beta_features.cpp41
-rw-r--r--searchlib/src/tests/grouping/sketch_test.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/common/sort.h5
-rw-r--r--searchlib/src/vespa/searchlib/grouping/sketch.h26
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.hpp3
7 files changed, 31 insertions, 84 deletions
diff --git a/fnet/src/vespa/fnet/frt/invokable.h b/fnet/src/vespa/fnet/frt/invokable.h
index 88502f23c5c..7afa0aba6a0 100644
--- a/fnet/src/vespa/fnet/frt/invokable.h
+++ b/fnet/src/vespa/fnet/frt/invokable.h
@@ -7,7 +7,7 @@ class FRT_RPCRequest;
class FRT_Invokable
{
public:
- virtual ~FRT_Invokable() {}
+ virtual ~FRT_Invokable() = default;
};
typedef void (FRT_Invokable::*FRT_METHOD_PT)(FRT_RPCRequest *);
@@ -21,10 +21,7 @@ template <class T>
FRT_METHOD_PT
frt_method_pt_cast(frt_method_precast_pt<T> pt)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wshift-negative-value"
return (FRT_METHOD_PT) pt;
-#pragma GCC diagnostic pop
}
}
diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp
index 1ee4e9614e0..e9b915a14d9 100644
--- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp
+++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp
@@ -132,12 +132,12 @@ public:
DCB &_dc;
- DecodeExpGolombConstK(DCB &dc)
+ explicit DecodeExpGolombConstK(DCB &dc)
: _dc(dc)
{
}
- virtual uint64_t decode() override
+ uint64_t decode() override
{
unsigned int length;
uint64_t val64;
@@ -146,14 +146,14 @@ public:
return val64;
}
- virtual void skip() override
+ void skip() override
{
unsigned int length;
UC64_SKIPEXPGOLOMB(_dc._val, _dc._valI, _dc._preRead,
_dc._cacheInt, kValue, EC);
}
- virtual uint64_t decodeSmall() override
+ uint64_t decodeSmall() override
{
unsigned int length;
uint64_t val64;
@@ -162,7 +162,7 @@ public:
return val64;
}
- virtual uint64_t decodeSmallApply() override
+ uint64_t decodeSmallApply() override
{
unsigned int length;
uint64_t val64;
@@ -171,7 +171,7 @@ public:
return val64;
}
- virtual void skipSmall() override
+ void skipSmall() override
{
unsigned int length;
UC64_SKIPEXPGOLOMB_SMALL(_dc._val, _dc._valI, _dc._preRead,
@@ -205,21 +205,16 @@ public:
void addConstKFactory(int kValue, IDecodeFuncFactory factory) {
(void) kValue;
assert(static_cast<unsigned int>(kValue) == _constK.size());
-#pragma GCC diagnostic push
-#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 12
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
_constK.push_back(factory);
-#pragma GCC diagnostic pop
}
- IDecodeFuncFactory getConstKFactory(int kValue) const {
+ [[nodiscard]] IDecodeFuncFactory getConstKFactory(int kValue) const {
assert(kValue >= 0 &&
static_cast<unsigned int>(kValue) < _constK.size());
return _constK[kValue];
}
- IDecodeFuncFactory getVarKFactory() const { return _varK; }
+ [[nodiscard]] IDecodeFuncFactory getVarKFactory() const { return _varK; }
};
@@ -237,7 +232,7 @@ struct RegisterFactoryPtr
{
RegisterFactory<bigEndian> _ptr;
- RegisterFactoryPtr(RegisterFactory<bigEndian> ptr)
+ explicit RegisterFactoryPtr(RegisterFactory<bigEndian> ptr)
: _ptr(ptr)
{
}
@@ -292,9 +287,9 @@ public:
using EC = EncodeContext64Base;
void fillRandNums();
- void calcBoundaries(int kValue, bool small, std::vector<uint64_t> &v);
+ static void calcBoundaries(int kValue, bool small, std::vector<uint64_t> &v);
- void
+ static void
testBoundaries(int kValue, bool small,
std::vector<uint64_t> &v,
DecodeContext64Base &dc,
diff --git a/searchlib/src/tests/features/beta/beta_features.cpp b/searchlib/src/tests/features/beta/beta_features.cpp
index f31b27c58fa..622228ff168 100644
--- a/searchlib/src/tests/features/beta/beta_features.cpp
+++ b/searchlib/src/tests/features/beta/beta_features.cpp
@@ -1,34 +1,17 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/searchlib/attribute/attributeguard.h>
-#include <vespa/searchlib/attribute/attributemanager.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/integerbase.h>
-#include <vespa/searchlib/attribute/floatbase.h>
#include <vespa/searchlib/attribute/stringbase.h>
-#include <vespa/searchlib/features/agefeature.h>
-#include <vespa/searchlib/features/attributefeature.h>
-#include <vespa/searchlib/features/attributematchfeature.h>
-#include <vespa/searchlib/features/fieldlengthfeature.h>
-#include <vespa/searchlib/features/fieldmatchfeature.h>
-#include <vespa/searchlib/features/fieldtermmatchfeature.h>
-#include <vespa/searchlib/features/firstphasefeature.h>
#include <vespa/searchlib/features/flow_completeness_feature.h>
#include <vespa/searchlib/features/jarowinklerdistancefeature.h>
-#include <vespa/searchlib/features/matchfeature.h>
-#include <vespa/searchlib/features/nowfeature.h>
#include <vespa/searchlib/features/proximityfeature.h>
-#include <vespa/searchlib/features/queryfeature.h>
#include <vespa/searchlib/features/querycompletenessfeature.h>
-#include <vespa/searchlib/features/randomfeature.h>
#include <vespa/searchlib/features/rankingexpressionfeature.h>
#include <vespa/searchlib/features/reverseproximityfeature.h>
#include <vespa/searchlib/features/setup.h>
#include <vespa/searchlib/features/termeditdistancefeature.h>
-#include <vespa/searchlib/features/termfeature.h>
#include <vespa/searchlib/features/utils.h>
-#include <vespa/searchlib/fef/featurenamebuilder.h>
-#include <vespa/searchlib/fef/indexproperties.h>
#include <vespa/searchlib/fef/test/plugin/setup.h>
#include <vespa/vespalib/util/rand48.h>
#include <vespa/searchlib/fef/test/ftlib.h>
@@ -40,28 +23,12 @@ using namespace search::fef::test;
using CollectionType = FieldInfo::CollectionType;
//---------------------------------------------------------------------------------------------------------------------
-// TermPositionList
-//---------------------------------------------------------------------------------------------------------------------
-using TermPosition = std::pair<uint32_t, uint32_t>;
-class TermPositionList : public std::vector<TermPosition> {
-public:
- TermPositionList &add(uint32_t termId, uint32_t pos) {
- push_back(TermPosition(termId, pos));
- return *this;
- }
- TermPositionList &clear() {
- std::vector<TermPosition>::clear();
- return *this;
- }
-};
-
-//---------------------------------------------------------------------------------------------------------------------
// Test
//---------------------------------------------------------------------------------------------------------------------
class Test : public FtTestApp {
public:
Test();
- ~Test();
+ ~Test() override;
int Main() override;
void testJaroWinklerDistance();
void testProximity();
@@ -82,8 +49,8 @@ private:
TEST_APPHOOK(Test);
-Test::Test() {}
-Test::~Test() {}
+Test::Test() = default;
+Test::~Test() = default;
int
Test::Main()
@@ -723,8 +690,6 @@ Test::testTermEditDistance()
}
}
-// #pragma GCC diagnostic ignored "-Wstrict-aliasing"
-
void
Test::assertTermEditDistance(const vespalib::string &query, const vespalib::string &field,
uint32_t expectedDel, uint32_t expectedIns, uint32_t expectedSub)
diff --git a/searchlib/src/tests/grouping/sketch_test.cpp b/searchlib/src/tests/grouping/sketch_test.cpp
index 10f5cbaa8ef..f8f5b79af75 100644
--- a/searchlib/src/tests/grouping/sketch_test.cpp
+++ b/searchlib/src/tests/grouping/sketch_test.cpp
@@ -1,15 +1,15 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Unit tests for sketch.
-#include <vespa/log/log.h>
-LOG_SETUP("sketch_test");
-
#include <vespa/searchlib/grouping/sketch.h>
#include <vespa/vespalib/objects/nboserializer.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/log/log.h>
+LOG_SETUP("sketch_test");
+
using vespalib::NBOSerializer;
using vespalib::nbostream;
using namespace search;
@@ -28,10 +28,10 @@ template <typename NormalSketch>
void checkBucketValue(NormalSketch &sketch, size_t bucket, uint32_t value) {
#pragma GCC diagnostic push
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 11 || __GNUC__ <= 12)
+//TODO Remove when compiler bug has been fixed...
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
EXPECT_EQUAL(value, static_cast<size_t>(sketch.bucket[bucket]));
-#pragma GCC diagnostic pop
}
template <int BucketBits, typename HashT>
diff --git a/searchlib/src/vespa/searchlib/common/sort.h b/searchlib/src/vespa/searchlib/common/sort.h
index bfe98194dcc..b02d71b070e 100644
--- a/searchlib/src/vespa/searchlib/common/sort.h
+++ b/searchlib/src/vespa/searchlib/common/sort.h
@@ -233,12 +233,7 @@ void ShiftBasedRadixSorterBase<GR, T, SHIFT>::radix_fetch(GR R, size_t cnt[256],
}
}
for(; p < n; p++) {
-#pragma GCC diagnostic push
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
-#endif
cnt[(R(a[p]) >> SHIFT) & 0xFF]++;
-#pragma GCC diagnostic pop
}
}
diff --git a/searchlib/src/vespa/searchlib/grouping/sketch.h b/searchlib/src/vespa/searchlib/grouping/sketch.h
index 380145e6f34..b973a99da92 100644
--- a/searchlib/src/vespa/searchlib/grouping/sketch.h
+++ b/searchlib/src/vespa/searchlib/grouping/sketch.h
@@ -31,11 +31,11 @@ struct Sketch {
static const HashT BUCKET_COUNT = HashT(1) << BucketBits;
static const HashT BUCKET_MASK = BUCKET_COUNT - 1;
- virtual ~Sketch() {}
+ virtual ~Sketch() = default;
virtual int aggregate(HashT hash) = 0;
- virtual uint32_t getClassId() const = 0;
+ [[nodiscard]] virtual uint32_t getClassId() const = 0;
virtual void serialize(vespalib::Serializer &os) const = 0;
virtual void deserialize(vespalib::Deserializer &is) = 0;
@@ -74,19 +74,18 @@ struct SparseSketch : Sketch<BucketBits, HashT> {
};
std::unordered_set<HashT, IdentityHash> hash_set;
- size_t getSize() const { return hash_set.size(); }
+ [[nodiscard]] size_t getSize() const { return hash_set.size(); }
int aggregate(HashT hash) override {
return hash_set.insert(hash).second ? 1 : 0;
}
- uint32_t getClassId() const override { return classId; }
+ [[nodiscard]] uint32_t getClassId() const override { return classId; }
void serialize(vespalib::Serializer &os) const override;
void deserialize(vespalib::Deserializer &is) override;
bool operator==(const SketchType &other) const override {
- const SparseSketch<BucketBits, HashT> *other_sparse =
- dynamic_cast<const SparseSketch<BucketBits, HashT> *>(&other);
+ const auto *other_sparse = dynamic_cast<const SparseSketch<BucketBits, HashT> *>(&other);
if (!other_sparse) {
return false;
}
@@ -135,7 +134,7 @@ struct NormalSketch : Sketch<BucketBits, HashT> {
NormalSketch() { memset(&bucket[0], 0, BUCKET_COUNT); }
- virtual int aggregate(HashT hash) override {
+ int aggregate(HashT hash) override {
uint8_t existing_value = bucket[hash & BUCKET_MASK];
uint8_t new_value = countPrefixZeros(hash | BUCKET_MASK);
if (new_value > existing_value) {
@@ -147,13 +146,12 @@ struct NormalSketch : Sketch<BucketBits, HashT> {
uint32_t compress_buckets_into(char *buffer, uint32_t size) const;
void decompress_buckets_from(char *buffer, uint32_t size);
- virtual uint32_t getClassId() const override { return classId; }
- virtual void serialize(vespalib::Serializer &os) const override;
- virtual void deserialize(vespalib::Deserializer &is) override;
+ [[nodiscard]] uint32_t getClassId() const override { return classId; }
+ void serialize(vespalib::Serializer &os) const override;
+ void deserialize(vespalib::Deserializer &is) override;
- virtual bool operator==(const SketchType &other) const override {
- const NormalSketch<BucketBits, HashT> *other_normal =
- dynamic_cast<const NormalSketch<BucketBits, HashT> *>(&other);
+ bool operator==(const SketchType &other) const override {
+ const auto *other_normal = dynamic_cast<const NormalSketch<BucketBits, HashT> *>(&other);
if (!other_normal) {
return false;
}
@@ -168,7 +166,7 @@ struct NormalSketch : Sketch<BucketBits, HashT> {
return operator==(static_cast<const SketchType&>(other));
}
- virtual void print(std::ostream &out) const override {
+ void print(std::ostream &out) const override {
for (size_t i = 0; i < BUCKET_COUNT; ++i) {
out << " " << int(bucket[i]);
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.hpp b/vespalib/src/vespa/vespalib/btree/btreenode.hpp
index 62773e57c6f..c8bc4ec614c 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.hpp
@@ -81,10 +81,7 @@ BTreeNodeTT<KeyT, DataT, AggrT, NumSlots>::insert(uint32_t idx,
assert(validSlots() < NodeType::maxSlots());
assert(!getFrozen());
for (uint32_t i = validSlots(); i > idx; --i) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds" // This dirty one is due a suspected bug in gcc 6.2
_keys[i] = _keys[i - 1];
-#pragma GCC diagnostic pop
setData(i, getData(i - 1));
}
_keys[idx] = key;