diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-17 18:51:06 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-17 18:51:06 +0100 |
commit | 4beb33aee4a74a298a548d27806e95946910c2e5 (patch) | |
tree | 1597b5e5fb68842a91fd05661e8d3ff3b9f20768 /searchlib/src | |
parent | 4b1fcd494ab08a368c01c566b48707fe9ca42f2f (diff) |
mark all temporary variables that only exist to assert (void), so that NDEBUG builds can succeed too.
Diffstat (limited to 'searchlib/src')
22 files changed, 50 insertions, 0 deletions
diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index 85f83d217eb..bcac0c94776 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -408,6 +408,7 @@ BitVectorTest::checkSearch(AttributePtr v, bool weights, bool checkStride) { + (void) checkStride; sb->initFullRange(); sb->seek(1u); uint32_t docId = sb->getDocId(); diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp index dcf0f69ee55..001a420e83f 100644 --- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp +++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp @@ -203,6 +203,7 @@ public: void addConstKFactory(int kValue, IDecodeFuncFactory factory) { + (void) kValue; assert(static_cast<unsigned int>(kValue) == _constK.size()); _constK.push_back(factory); } diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp index 03d73e84b42..d8ad1698c9d 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp @@ -499,6 +499,7 @@ checkCounts(const std::string &word, (void) word; (void) fileOffset; const WordIndexCounts *j = &i._counts; + (void) j; assert(counts._bitLength == j->_bitLength); assert(counts._numDocs == j->_numDocs); assert(fileOffset._fileOffset == j->_fileOffset); @@ -662,6 +663,7 @@ testWords(const std::string &logname, tuneFileWrite, fileHeaderContext); assert(openres); + (void) openres; for (std::vector<WordCounts>::const_iterator i = myrand.begin(), @@ -730,6 +732,7 @@ testWords(const std::string &logname, PostingListCounts rCounts; uint64_t wOffset; uint64_t rOffset; + (void) rOffset; PostingListOffsetAndCounts rOffsetAndCounts; uint64_t wordNum = 1; uint64_t checkWordNum = 5; diff --git a/searchlib/src/tests/util/statefile/statefile_test.cpp b/searchlib/src/tests/util/statefile/statefile_test.cpp index 583d21e1cec..b932ec03bb2 100644 --- a/searchlib/src/tests/util/statefile/statefile_test.cpp +++ b/searchlib/src/tests/util/statefile/statefile_test.cpp @@ -72,6 +72,7 @@ void setSize(const char *name, int64_t newSize) { int truncRes = truncate(name, newSize); + (void) truncRes; assert(truncRes == 0); } diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp index 430443cfc9d..fb93138d2c9 100644 --- a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp @@ -98,6 +98,7 @@ PostingStore<DataT>::removeSparseBitVectors() for (auto &i : _bvs) { RefType iRef(i); uint32_t typeId = getTypeId(iRef); + (void) typeId; assert(isBitVector(typeId)); BitVectorEntry *bve = getWBitVectorEntry(iRef); GrowableBitVector &bv = *bve->_bv.get(); @@ -107,6 +108,7 @@ PostingStore<DataT>::removeSparseBitVectors() assert(isBTree(iRef2)); const BTreeType *tree = getTreeEntry(iRef2); assert(tree->size(_allocator) == docFreq); + (void) tree; } if (docFreq < _minBvDocFreq) needscan = true; @@ -145,6 +147,7 @@ PostingStore<DataT>::removeSparseBitVectors() assert(isBTree(iRef2)); const BTreeType *tree = getTreeEntry(iRef2); assert(tree->size(_allocator) == docFreq); + (void) tree; } if (docFreq < _minBvDocFreq) { dropBitVector(ref); @@ -218,6 +221,7 @@ PostingStore<DataT>::dropBitVector(EntryRef &ref) RefType iRef(ref); uint32_t typeId = getTypeId(iRef); assert(isBitVector(typeId)); + (void) typeId; BitVectorEntry *bve = getWBitVectorEntry(iRef); AllocatedBitVector *bv = bve->_bv.get(); assert(bv); @@ -230,6 +234,8 @@ PostingStore<DataT>::dropBitVector(EntryRef &ref) assert(isBTree(ref2)); const BTreeType *tree = getTreeEntry(ref2); assert(tree->size(_allocator) == docFreq); + (void) tree; + (void) docFreq; _bvs.erase(ref.ref()); _store.holdElem(iRef, 1); _status.decBitVectors(); @@ -246,11 +252,13 @@ PostingStore<DataT>::makeBitVector(EntryRef &ref) RefType iRef(ref); uint32_t typeId = getTypeId(iRef); assert(isBTree(typeId)); + (void) typeId; std::shared_ptr<GrowableBitVector> bvsp; vespalib::GenerationHolder &genHolder = _store.getGenerationHolder(); bvsp.reset(new GrowableBitVector(_bvSize, _bvCapacity, genHolder)); AllocatedBitVector &bv = *bvsp.get(); uint32_t docIdLimit = _bvSize; + (void) docIdLimit; Iterator it = begin(ref); uint32_t expDocFreq = it.size(); (void) expDocFreq; @@ -292,6 +300,7 @@ PostingStore<DataT>::applyNewBitVector(EntryRef &ref, bvsp.reset(new GrowableBitVector(_bvSize, _bvCapacity, genHolder)); AllocatedBitVector &bv = *bvsp.get(); uint32_t docIdLimit = _bvSize; + (void) docIdLimit; uint32_t expDocFreq = ae - aOrg; (void) expDocFreq; for (AddIter a = aOrg; a != ae; ++a) { diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp index 06c96dc96ee..7ead25c3b6a 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp @@ -210,6 +210,7 @@ readHeader(vespalib::GenericHeader &header, int64_t fileSize) dataBuffer.moveFreeToData(headerLen - hhSize); } uint32_t len = header.read(bufferReader); + (void) len; assert(len >= header.getSize()); assert(len == headerLen); return headerLen; diff --git a/searchlib/src/vespa/searchlib/btree/btreestore.hpp b/searchlib/src/vespa/searchlib/btree/btreestore.hpp index ab9ebaaf95e..a0b8d688c27 100644 --- a/searchlib/src/vespa/searchlib/btree/btreestore.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreestore.hpp @@ -691,6 +691,7 @@ applyNewTree(EntryRef &ref, BTreeType *tree = tPair.second; applyBuildTree(tree, a, ae, nullptr, nullptr, comp); assert(tree->size(_allocator) == additionSize); + (void) additionSize; ref = tPair.first; } diff --git a/searchlib/src/vespa/searchlib/common/bitvector.cpp b/searchlib/src/vespa/searchlib/common/bitvector.cpp index 4f04a557085..e21d6c8e87a 100644 --- a/searchlib/src/vespa/searchlib/common/bitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvector.cpp @@ -284,6 +284,7 @@ BitVector::grow(Index newSize, Index newCapacity) (void) newSize; (void) newCapacity; assert(false); + return GenerationHeldBase::UP(); } size_t diff --git a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp index f3a4e87257c..6e8948b38c1 100644 --- a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp @@ -43,6 +43,7 @@ GrowableBitVector::shrink(Index newCapacity) { Index oldCapacity = capacity(); assert(newCapacity <= oldCapacity); + (void) oldCapacity; hold(grow(newCapacity, std::max(capacity(), newCapacity))); } diff --git a/searchlib/src/vespa/searchlib/common/packets.cpp b/searchlib/src/vespa/searchlib/common/packets.cpp index 274188c87f9..190f4d4ef63 100644 --- a/searchlib/src/vespa/searchlib/common/packets.cpp +++ b/searchlib/src/vespa/searchlib/common/packets.cpp @@ -468,6 +468,7 @@ bool FS4Packet_Shared::Decode(FNET_DataBuffer *, uint32_t ) { assert(false); + return false; } vespalib::string @@ -536,6 +537,7 @@ bool FS4Packet_PreSerialized::Decode(FNET_DataBuffer *, uint32_t) { assert(false); + return false; } vespalib::string diff --git a/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp b/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp index 76780114008..68501ecc41d 100644 --- a/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp +++ b/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp @@ -174,6 +174,7 @@ BufferState::onActive(uint32_t bufferId, uint32_t typeId, assert(_freeListList == NULL || _freeListList->_head != this); size_t reservedElements = typeHandler->getReservedElements(bufferId); + (void) reservedElements; size_t allocClusters = typeHandler->calcClustersToAlloc(bufferId, sizeNeeded, maxClusters); size_t allocSize = allocClusters * typeHandler->getClusterSize(); assert(allocSize >= reservedElements + sizeNeeded); diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp index 52379e2acb6..348262f1d0e 100644 --- a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp @@ -439,6 +439,9 @@ PageDict4FileSeqWrite::open(const vespalib::string &name, assert(pFileSize >= pBufferStartFilePos); assert(spFileSize >= spBufferStartFilePos); assert(ssFileSize >= ssBufferStartFilePos); + (void) pFileSize; + (void) spFileSize; + (void) ssFileSize; _pfile.SetSize(pBufferStartFilePos); _spfile.SetSize(spBufferStartFilePos); _ssfile.SetSize(ssBufferStartFilePos); diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index 732e844c757..091aa8949b8 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -428,6 +428,7 @@ bool LogDataStore::shouldCompactToActiveFile(size_t compactedSize) const { void LogDataStore::setNewFileChunk(const LockGuard & guard, FileChunk::UP file) { + (void) guard; assert(guard.locks(_updateLock)); size_t fileId = file->getFileId().getId(); assert( ! _fileChunks[fileId]); diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.h b/searchlib/src/vespa/searchlib/docstore/logdatastore.h index abb0c536fe2..b2519cdfdc2 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.h @@ -190,6 +190,7 @@ public: } FileId getActiveFileId(const vespalib::LockGuard & guard) const { assert(guard.locks(_updateLock)); + (void) guard; return _active; } @@ -230,20 +231,24 @@ private: WriteableFileChunk & getActive(const LockGuard & guard) { assert(guard.locks(_updateLock)); + (void) guard; return static_cast<WriteableFileChunk &>(*_fileChunks[_active.getId()]); } const WriteableFileChunk & getActive(const LockGuard & guard) const { assert(guard.locks(_updateLock)); + (void) guard; return static_cast<const WriteableFileChunk &>(*_fileChunks[_active.getId()]); } const FileChunk * getPrevActive(const LockGuard & guard) const { assert(guard.locks(_updateLock)); + (void) guard; return ( !_prevActive.isActive() ) ? _fileChunks[_prevActive.getId()].get() : NULL; } void setActive(const LockGuard & guard, FileId fileId) { assert(guard.locks(_updateLock)); + (void) guard; _prevActive = _active; _active = fileId; } diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp index 3c7f5d283f7..c462b23341f 100644 --- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp @@ -310,6 +310,7 @@ WriteableFileChunk::drainQ() void WriteableFileChunk::insertChunks(ProcessedChunkMap & orderedChunks, ProcessedChunkQ & newChunks, const uint32_t nextChunkId) { + (void) nextChunkId; for (auto &chunk : newChunks) { if (chunk.get() != 0) { assert(chunk->getChunkId() >= nextChunkId); @@ -372,6 +373,7 @@ WriteableFileChunk::computeChunkMeta(ProcessedChunkQ & chunks, size_t startPos, ChunkMetaV cmetaV; cmetaV.reserve(chunks.size()); uint64_t lastSerial(_lastPersistedSerialNum); + (void) lastSerial; LockGuard guard(_lock); if (!_pendingChunks.empty()) { @@ -468,6 +470,7 @@ WriteableFileChunk::fileWriter(const uint32_t firstChunkId) assert(_writeQ.empty()); assert(_chunkMap.empty()); for (const ChunkInfo & cm : _chunkInfo) { + (void) cm; assert(cm.valid() && cm.getSize() != 0); } _writeTaskIsRunning = false; @@ -530,6 +533,7 @@ WriteableFileChunk::getDiskFootprint() const size_t WriteableFileChunk::getDiskFootprint(const vespalib::MonitorGuard & guard) const { + (void) guard; assert(guard.monitors(_lock)); return frozen() ? FileChunk::getDiskFootprint() @@ -756,6 +760,7 @@ WriteableFileChunk::needFlushPendingChunks(uint64_t serialNum, uint64_t datFileL bool WriteableFileChunk::needFlushPendingChunks(const MonitorGuard & guard, uint64_t serialNum, uint64_t datFileLen) { + (void) guard; assert(guard.monitors(_lock)); if (_pendingChunks.empty()) return false; @@ -796,6 +801,7 @@ WriteableFileChunk::flushPendingChunks(uint64_t serialNum) { fastos::TimeStamp WriteableFileChunk::unconditionallyFlushPendingChunks(const vespalib::LockGuard &flushGuard, uint64_t serialNum, uint64_t datFileLen) { + (void) flushGuard; assert(flushGuard.locks(_flushLock)); if ( ! _dataFile.Sync()) { throw SummaryException("Failed fsync of dat file", _dataFile, VESPA_STRLOC); diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp index 59903668fdb..490130ec0ef 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp @@ -69,6 +69,7 @@ IndexEnvironment::addConstantValue(const vespalib::string &name, Constant(std::move(type), std::move(value))); assert(insertRes.second); // successful insert + (void) insertRes; } } // namespace test diff --git a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp index f10e872daeb..520e691203a 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp @@ -112,6 +112,7 @@ CompactDocumentWordsStore::Store::insert(const Builder &builder) uint32_t *begin = _store.getBufferEntry<uint32_t>(activeBufferId, oldSize); uint32_t *end = serialize(builder, begin); assert(size_t(end - begin) == serializedSize); + (void) end; state.pushed_back(serializedSize); return ref; diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp index 2708d74fdd9..baaafc853ff 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp @@ -223,10 +223,13 @@ namespace void checkMatchingType(const ValueType &lhs, const ValueType &rhs, size_t numCells) { + (void) numCells; size_t checkNumCells = 1u; auto rhsItr = rhs.dimensions().cbegin(); auto rhsItrEnd = rhs.dimensions().cend(); + (void) rhsItrEnd; for (const auto &dim : lhs.dimensions()) { + (void) dim; assert(rhsItr != rhsItrEnd); assert(dim.name == rhsItr->name); assert(rhsItr->is_bound()); @@ -245,6 +248,7 @@ setDenseTensorUnboundDimSizes(void *buffer, const ValueType &lhs, uint32_t numUn uint32_t *unboundDimSize = unboundDimSizeEnd - numUnboundDims; auto rhsItr = rhs.dimensions().cbegin(); auto rhsItrEnd = rhs.dimensions().cend(); + (void) rhsItrEnd; for (const auto &dim : lhs.dimensions()) { assert (rhsItr != rhsItrEnd); if (!dim.is_bound()) { diff --git a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp index 41cb1cea68a..0fd34af84a4 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp @@ -108,6 +108,7 @@ TestDiskIndex::openIndex(const std::string &dir, bool directio, bool readmmap, _index.reset(new DiskIndex(dir)); bool ok(_index->setup(tuneFileRead)); assert(ok); + (void) ok; } TestDiskIndex::TestDiskIndex() : diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp index a102533b139..d7d28b937ba 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp @@ -135,6 +135,7 @@ Domain::begin() const SerialNum Domain::begin(const LockGuard & guard) const { + (void) guard; assert(guard.locks(_lock)); SerialNum s(0); if ( ! _parts.empty() ) { @@ -152,6 +153,7 @@ Domain::end() const SerialNum Domain::end(const LockGuard & guard) const { + (void) guard; assert(guard.locks(_lock)); SerialNum s(0); if ( ! _parts.empty() ) { @@ -169,6 +171,7 @@ Domain::byteSize() const size_t Domain::byteSize(const LockGuard & guard) const { + (void) guard; assert(guard.locks(_lock)); size_t size = 0; for (const auto &entry : _parts) { @@ -232,6 +235,7 @@ uint64_t Domain::size() const uint64_t Domain::size(const LockGuard & guard) const { + (void) guard; assert(guard.locks(_lock)); uint64_t sz(0); for (const auto & part : _parts) { diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp index edec458c3b9..44172b95f92 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp @@ -672,6 +672,7 @@ int32_t DomainPart::calcCrc(Crc version, const void * buf, size_t sz) return calculator.checksum(); } else { assert(false); + return 0; } } diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp index 33918e373d1..b82e9f7ebe3 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp @@ -35,6 +35,7 @@ DomainPart::Crc getCrc(searchlib::TranslogserverConfig::Crcmethod crcType) return DomainPart::xxh64; } assert(false); + return DomainPart::xxh64; } } |