aboutsummaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-02-07 13:14:06 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-02-07 13:14:06 +0100
commit32af101a25225ac4fb5966e3dc55fd9c2e26ab76 (patch)
tree407ab4102a3d7ac88fb68f5267880894aca15c34 /document
parent301f093c2d09369687dbdc495045e5ad53e724ed (diff)
Eliminate clang warnings in document
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/datatype/datatype_test.cpp7
-rw-r--r--document/src/tests/documentselectparsertest.cpp2
-rw-r--r--document/src/tests/fieldsettest.cpp10
-rw-r--r--document/src/tests/primitivefieldvaluetest.cpp2
-rw-r--r--document/src/tests/testbytebuffer.cpp11
-rw-r--r--document/src/vespa/document/base/exceptions.cpp6
-rw-r--r--document/src/vespa/document/base/exceptions.h1
-rw-r--r--document/src/vespa/document/base/fieldpath.h4
-rw-r--r--document/src/vespa/document/base/idstring.cpp5
-rw-r--r--document/src/vespa/document/base/idstring.h1
-rw-r--r--document/src/vespa/document/bucket/bucketidfactory.h1
-rw-r--r--document/src/vespa/document/fieldvalue/document.cpp6
-rw-r--r--document/src/vespa/document/fieldvalue/mapfieldvalue.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp8
-rw-r--r--document/src/vespa/document/fieldvalue/structuredfieldvalue.h1
-rw-r--r--document/src/vespa/document/select/valuenode.cpp2
-rw-r--r--document/src/vespa/document/update/tensormodifyupdate.h2
-rw-r--r--document/src/vespa/document/util/bytebuffer.cpp28
18 files changed, 55 insertions, 44 deletions
diff --git a/document/src/tests/datatype/datatype_test.cpp b/document/src/tests/datatype/datatype_test.cpp
index a04e37e3eca..61d44fcfd5e 100644
--- a/document/src/tests/datatype/datatype_test.cpp
+++ b/document/src/tests/datatype/datatype_test.cpp
@@ -12,10 +12,15 @@ using namespace document;
namespace {
+template <typename S>
+void assign(S &lhs, const S &rhs) {
+ lhs = rhs;
+}
+
TEST("require that ArrayDataType can be assigned to.") {
ArrayDataType type1(*DataType::STRING);
ArrayDataType type2(*DataType::INT);
- type1 = type1;
+ assign(type1, type1);
EXPECT_EQUAL(*DataType::STRING, type1.getNestedType());
type1 = type2;
EXPECT_EQUAL(*DataType::INT, type1.getNestedType());
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index 2e4f66cebd0..93b2eadaa0d 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -236,7 +236,7 @@ DocumentSelectParserTest::createDocs()
_doc.back()->getField("byteweightedset").getDataType());
wsbytes.add(ByteFieldValue(5));
wsbytes.add(ByteFieldValue(75));
- wsbytes.add(ByteFieldValue(255));
+ wsbytes.add(ByteFieldValue(static_cast<int8_t>(255)));
wsbytes.add(ByteFieldValue(0));
_doc.back()->setValue("byteweightedset", wsbytes);
}
diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp
index 55bf480da8c..f3bc2a03bc5 100644
--- a/document/src/tests/fieldsettest.cpp
+++ b/document/src/tests/fieldsettest.cpp
@@ -57,11 +57,11 @@ void FieldSetTest::testParsing()
FieldSetRepo repo;
- dynamic_cast<AllFields&>(*repo.parse(docRepo, "[all]"));
- dynamic_cast<NoFields&>(*repo.parse(docRepo, "[none]"));
- dynamic_cast<DocIdOnly&>(*repo.parse(docRepo, "[id]"));
- dynamic_cast<HeaderFields&>(*repo.parse(docRepo, "[header]"));
- dynamic_cast<BodyFields&>(*repo.parse(docRepo, "[body]"));
+ (void) dynamic_cast<AllFields&>(*repo.parse(docRepo, "[all]"));
+ (void) dynamic_cast<NoFields&>(*repo.parse(docRepo, "[none]"));
+ (void) dynamic_cast<DocIdOnly&>(*repo.parse(docRepo, "[id]"));
+ (void) dynamic_cast<HeaderFields&>(*repo.parse(docRepo, "[header]"));
+ (void) dynamic_cast<BodyFields&>(*repo.parse(docRepo, "[body]"));
FieldSet::UP set = repo.parse(docRepo, "testdoctype1:headerval,content");
FieldCollection& coll = dynamic_cast<FieldCollection&>(*set);
diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp
index 87e9e22293f..651d7292c70 100644
--- a/document/src/tests/primitivefieldvaluetest.cpp
+++ b/document/src/tests/primitivefieldvaluetest.cpp
@@ -378,7 +378,7 @@ PrimitiveFieldValueTest::testNumerics()
CPPUNIT_ASSERT_EQUAL(-1, (int) b2.getValue());
ShortFieldValue s1(-32768);
- ShortFieldValue s2(65535);
+ ShortFieldValue s2(static_cast<int16_t>(65535));
CPPUNIT_ASSERT_EQUAL((int16_t)-32768, s1.getValue());
CPPUNIT_ASSERT_EQUAL((int16_t)65535, s2.getValue());
CPPUNIT_ASSERT_EQUAL((int16_t)-1, s2.getValue());
diff --git a/document/src/tests/testbytebuffer.cpp b/document/src/tests/testbytebuffer.cpp
index baa4bb65249..777803d621b 100644
--- a/document/src/tests/testbytebuffer.cpp
+++ b/document/src/tests/testbytebuffer.cpp
@@ -13,6 +13,15 @@ using namespace document;
CPPUNIT_TEST_SUITE_REGISTRATION( ByteBuffer_Test );
+namespace {
+
+template <typename S>
+void assign(S &lhs, const S &rhs)
+{
+ lhs = rhs;
+}
+
+}
void ByteBuffer_Test::setUp()
{
@@ -79,7 +88,7 @@ void ByteBuffer_Test::test_assignment_operator()
// Test Selfassignment == no change
//
- b2 = b2;
+ assign(b2, b2);
CPPUNIT_ASSERT_EQUAL(b1.getPos(),b2.getPos());
diff --git a/document/src/vespa/document/base/exceptions.cpp b/document/src/vespa/document/base/exceptions.cpp
index 2cdb0391e3b..1dd891fc500 100644
--- a/document/src/vespa/document/base/exceptions.cpp
+++ b/document/src/vespa/document/base/exceptions.cpp
@@ -79,8 +79,7 @@ FieldNotFoundException(const vespalib::string& fieldName,
const vespalib::string& location)
: Exception("Field with name " + fieldName + " not found", location, 1),
_fieldName(fieldName),
- _fieldId(0),
- _serializationVersion(0)
+ _fieldId(0)
{
}
@@ -93,8 +92,7 @@ FieldNotFoundException(int fieldId,
vespalib::make_string("Field with id %i not found", fieldId), location, 1),
_fieldName(),
- _fieldId(fieldId),
- _serializationVersion(serializationVersion)
+ _fieldId(fieldId)
{
}
diff --git a/document/src/vespa/document/base/exceptions.h b/document/src/vespa/document/base/exceptions.h
index dff2f1ea4ce..49ddecc8441 100644
--- a/document/src/vespa/document/base/exceptions.h
+++ b/document/src/vespa/document/base/exceptions.h
@@ -123,7 +123,6 @@ class FieldNotFoundException : public vespalib::Exception
private:
vespalib::string _fieldName;
int32_t _fieldId;
- int16_t _serializationVersion;
public:
FieldNotFoundException(const vespalib::string& fieldName,
diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h
index 576c534e3db..cd246ed78b1 100644
--- a/document/src/vespa/document/base/fieldpath.h
+++ b/document/src/vespa/document/base/fieldpath.h
@@ -34,8 +34,8 @@ public:
*/
FieldPathEntry();
- FieldPathEntry(FieldPathEntry &&) noexcept = default;
- FieldPathEntry & operator=(FieldPathEntry &&) noexcept = default;
+ FieldPathEntry(FieldPathEntry &&) = default;
+ FieldPathEntry & operator=(FieldPathEntry &&) = default;
FieldPathEntry(const FieldPathEntry &);
FieldPathEntry & operator=(const FieldPathEntry &);
diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp
index eee8d3c38a2..7606ec58f9f 100644
--- a/document/src/vespa/document/base/idstring.cpp
+++ b/document/src/vespa/document/base/idstring.cpp
@@ -153,8 +153,13 @@ inline const char *
fmemchr(const char * s, const char * e)
{
while (s+15 < e) {
+#ifdef __clang__
+ v16qi tmpCurrent = __builtin_ia32_lddqu(s);
+ v16qi tmp0 = tmpCurrent == _G_zero;
+#else
v16qi tmpCurrent = __builtin_ia32_loaddqu(s);
v16qi tmp0 = __builtin_ia32_pcmpeqb128(tmpCurrent, _G_zero);
+#endif
uint32_t charMap = __builtin_ia32_pmovmskb128(tmp0); // 1 in charMap equals to '\0' in input buffer
if (__builtin_expect(charMap, 1)) {
return s + vespalib::Optimized::lsbIdx(charMap);
diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h
index 583e502e7ab..c458e7a62f4 100644
--- a/document/src/vespa/document/base/idstring.h
+++ b/document/src/vespa/document/base/idstring.h
@@ -69,7 +69,6 @@ private:
uint32_t _numComponents;
};
Offsets _offsets;
- uint32_t _nssComponentId;
vespalib::string _rawId;
};
diff --git a/document/src/vespa/document/bucket/bucketidfactory.h b/document/src/vespa/document/bucket/bucketidfactory.h
index bd1bbb9315b..24dbe37008d 100644
--- a/document/src/vespa/document/bucket/bucketidfactory.h
+++ b/document/src/vespa/document/bucket/bucketidfactory.h
@@ -27,7 +27,6 @@ class BucketIdFactory : public document::Printable
uint16_t _gidBits;
uint16_t _countBits;
uint64_t _locationMask;
- uint64_t _distributionMask;
uint64_t _gidMask;
uint64_t _initialCount;
diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp
index d915d9fd66d..f9107d6e984 100644
--- a/document/src/vespa/document/fieldvalue/document.cpp
+++ b/document/src/vespa/document/fieldvalue/document.cpp
@@ -321,9 +321,9 @@ Document::deserializeDocHeaderAndType(
}
namespace {
-void versionError(uint16_t version) __attribute__((noinline));
-void mainDocumentError(int64_t len) __attribute__((noinline));
-void notEnoughDocumentError(int32_t len, int64_t remaining) __attribute__((noinline));
+[[noreturn]] void versionError(uint16_t version) __attribute__((noinline));
+[[noreturn]] void mainDocumentError(int64_t len) __attribute__((noinline));
+[[noreturn]] void notEnoughDocumentError(int32_t len, int64_t remaining) __attribute__((noinline));
void versionError(uint16_t version) {
throw DeserializeException(make_string( "Unrecognized serialization version %d", version), VESPA_STRLOC);
diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
index 9c9c10c1a79..9c1b101e4ab 100644
--- a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
@@ -350,7 +350,7 @@ MapFieldValue::createValue() const {
void
MapFieldValue::ensureLookupMap() const {
if (!_lookupMap) {
- _lookupMap = std::move(buildLookupMap());
+ _lookupMap = buildLookupMap();
}
}
diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
index 273c0290684..2cf3a621b78 100644
--- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
@@ -18,15 +18,13 @@ using namespace fieldvalue;
IMPLEMENT_IDENTIFIABLE_ABSTRACT(StructuredFieldValue, FieldValue);
StructuredFieldValue::Iterator::Iterator()
- : _owner(0),
- _iterator(),
+ : _iterator(),
_field(0)
{
}
-StructuredFieldValue::Iterator::Iterator(const StructuredFieldValue& owner, const Field* first)
- : _owner(&const_cast<StructuredFieldValue&>(owner)),
- _iterator(owner.getIterator(first).release()),
+StructuredFieldValue::Iterator::Iterator([[maybe_unused]] const StructuredFieldValue& owner, const Field* first)
+ : _iterator(owner.getIterator(first).release()),
_field(_iterator->getNextField())
{
}
diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
index b179c701816..619c8cf7f06 100644
--- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
@@ -60,7 +60,6 @@ protected:
virtual const Field* getNextField() = 0;
};
class Iterator {
- const StructuredFieldValue* _owner;
StructuredIterator::UP _iterator;
const Field * _field;
diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp
index c0b09521edf..ae827e3f3ae 100644
--- a/document/src/vespa/document/select/valuenode.cpp
+++ b/document/src/vespa/document/select/valuenode.cpp
@@ -13,7 +13,7 @@ std::unique_ptr<Value>
ValueNode::defaultTrace(std::unique_ptr<Value> val, std::ostream& out) const
{
out << "Returning value " << *val << ".\n";
- return std::move(val);
+ return val;
}
}
diff --git a/document/src/vespa/document/update/tensormodifyupdate.h b/document/src/vespa/document/update/tensormodifyupdate.h
index dcb9bcf0470..65cf9f2c0e3 100644
--- a/document/src/vespa/document/update/tensormodifyupdate.h
+++ b/document/src/vespa/document/update/tensormodifyupdate.h
@@ -2,7 +2,7 @@
#include "valueupdate.h"
-namespace vespalib::tensor { class Tensor; }
+namespace vespalib::tensor { struct Tensor; }
namespace document {
diff --git a/document/src/vespa/document/util/bytebuffer.cpp b/document/src/vespa/document/util/bytebuffer.cpp
index 71f9050924e..ccbc2bc7790 100644
--- a/document/src/vespa/document/util/bytebuffer.cpp
+++ b/document/src/vespa/document/util/bytebuffer.cpp
@@ -334,7 +334,7 @@ void ByteBuffer::getNumericNetwork(int16_t & v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- uint16_t val = *(uint16_t *) getBufferAtPos();
+ uint16_t val = *(uint16_t *) (void *) getBufferAtPos();
v = ntohs(val);
incPosNoCheck(sizeof(v));
}
@@ -345,7 +345,7 @@ void ByteBuffer::getNumeric(int16_t & v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- v = *(int16_t *) getBufferAtPos();
+ v = *(int16_t *) (void *) getBufferAtPos();
incPosNoCheck(sizeof(v));
}
}
@@ -356,7 +356,7 @@ void ByteBuffer::putNumericNetwork(int16_t v) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
uint16_t val = htons(v);
- *(uint16_t *) getBufferAtPos() = val;
+ *(uint16_t *) (void *) getBufferAtPos() = val;
incPosNoCheck(sizeof(v));
}
}
@@ -366,7 +366,7 @@ void ByteBuffer::putNumeric(int16_t v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- *(int16_t *) getBufferAtPos() = v;
+ *(int16_t *) (void *) getBufferAtPos() = v;
incPosNoCheck(sizeof(v));
}
}
@@ -376,7 +376,7 @@ void ByteBuffer::getNumericNetwork(int32_t & v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- uint32_t val = *(uint32_t *) getBufferAtPos();
+ uint32_t val = *(uint32_t *) (void *) getBufferAtPos();
v = ntohl(val);
incPosNoCheck(sizeof(v));
}
@@ -387,7 +387,7 @@ void ByteBuffer::getNumeric(int32_t & v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- v = *(int32_t *) getBufferAtPos();
+ v = *(int32_t *) (void *) getBufferAtPos();
incPosNoCheck(sizeof(v));
}
}
@@ -399,7 +399,7 @@ void ByteBuffer::putNumericNetwork(int32_t v) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
uint32_t val = htonl(v);
- *(uint32_t *) getBufferAtPos() = val;
+ *(uint32_t *) (void *) getBufferAtPos() = val;
incPosNoCheck(sizeof(v));
}
}
@@ -409,7 +409,7 @@ void ByteBuffer::putNumeric(int32_t v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- *(int32_t *) getBufferAtPos() = v;
+ *(int32_t *) (void *) getBufferAtPos() = v;
incPosNoCheck(sizeof(v));
}
}
@@ -428,7 +428,7 @@ void ByteBuffer::getNumeric(float & v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- v = *(float *) getBufferAtPos();
+ v = *(float *) (void *) getBufferAtPos();
incPosNoCheck(sizeof(v));
}
}
@@ -447,7 +447,7 @@ void ByteBuffer::putNumeric(float v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- *(float *) getBufferAtPos() = v;
+ *(float *) (void *) getBufferAtPos() = v;
incPosNoCheck(sizeof(v));
}
}
@@ -456,7 +456,7 @@ void ByteBuffer::getNumeric(int64_t& v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- v = *(int64_t *) getBufferAtPos();
+ v = *(int64_t *) (void *) getBufferAtPos();
incPosNoCheck(sizeof(v));
}
}
@@ -465,7 +465,7 @@ void ByteBuffer::putNumeric(int64_t v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- *(int64_t *) getBufferAtPos() = v;
+ *(int64_t *) (void *) getBufferAtPos() = v;
incPosNoCheck(sizeof(v));
}
}
@@ -474,7 +474,7 @@ void ByteBuffer::getNumeric(double& v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- v = *(double *) getBufferAtPos();
+ v = *(double *) (void *) getBufferAtPos();
incPosNoCheck(sizeof(v));
}
}
@@ -483,7 +483,7 @@ void ByteBuffer::putNumeric(double v) {
if (__builtin_expect(getRemaining() < sizeof(v), 0)) {
throwOutOfBounds(getRemaining(), sizeof(v));
} else {
- *(double *) getBufferAtPos() = v;
+ *(double *) (void *) getBufferAtPos() = v;
incPosNoCheck(sizeof(v));
}
}