Skip to content

Commit f2dcbb3

Browse files
authored
Fix warnings (iresearch-toolkit#551)
* Fix unused/unreachable code * Fix other warnings
1 parent 5d6061d commit f2dcbb3

File tree

88 files changed

+268
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+268
-516
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Checks: '*,
77
-mpi-*,
88
-objc-*,
99
-openmp-*,
10+
-fuchsia-trailing-return,
1011
-fuchsia-default-arguments-*,
1112
-fuchsia-overloaded-operator,
1213
-readability-identifier-length,

core/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,7 @@ set(IRESEARCH_EXTERNAL_INCLUDES
290290
${Fasttext_INCLUDE_DIR}
291291
${FROZEN_INCLUDE_DIR})
292292

293-
if (SUPPRESS_EXTERNAL_WARNINGS)
294-
include_directories(SYSTEM ${IRESEARCH_EXTERNAL_INCLUDES})
295-
else ()
296-
include_directories(${IRESEARCH_EXTERNAL_INCLUDES})
297-
endif ()
293+
include_directories(SYSTEM ${IRESEARCH_EXTERNAL_INCLUDES})
298294

299295
add_library(iresearch-static
300296
STATIC

core/analysis/delimited_token_stream.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ bool parse_vpack_options(const VPackSlice slice, std::string& delimiter) {
125125
delimiter = delim_type_slice.stringView();
126126
return true;
127127
}
128-
default: {
129-
} // fall through
128+
break;
129+
default:
130+
break;
130131
}
131132

132133
IRS_LOG_ERROR(absl::StrCat(

core/analysis/minhash_token_stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static uint64_t HashLen0to16(const char* s, size_t len) {
103103
uint8_t b = s[len >> 1];
104104
uint8_t c = s[len - 1];
105105
uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
106-
uint32_t z = len + (static_cast<uint32_t>(c) << 2);
106+
uint32_t z = static_cast<uint32_t>(len) + (static_cast<uint32_t>(c) << 2);
107107
return ShiftMix(y * k2 ^ z * k0) * k2;
108108
}
109109
return k2;

core/analysis/nearest_neighbors_stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ bool nearest_neighbors_stream::reset(std::string_view data) {
265265
std::istream ss{&buf};
266266

267267
model_dict_->getLine(ss, line_token_ids_, line_token_label_ids_);
268-
n_tokens_ = line_token_ids_.size();
268+
n_tokens_ = static_cast<int32_t>(line_token_ids_.size());
269269
current_token_ind_ = 0;
270270

271271
neighbors_.clear();

core/analysis/ngram_token_stream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ void ngram_token_stream_base::emit_original() noexcept {
399399
: EmitOriginal::WithEndMarker;
400400
inc.value = next_inc_val_;
401401
break;
402-
default:
403-
IRS_ASSERT(false); // should not be called when None
402+
case EmitOriginal::None:
403+
IRS_ASSERT(false);
404404
break;
405405
}
406406
next_inc_val_ = 0;

core/analysis/segmentation_token_stream.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,6 @@ bool accept_token(Iterator begin, Iterator end, word_break_t wb) {
275275
return std::find_if_not(begin, end, utf8_utils::CharIsWhiteSpace) != end;
276276
case word_break_t::ALPHA:
277277
return std::find_if(begin, end, utf8_utils::CharIsAlphanumeric) != end;
278-
default:
279-
IRS_ASSERT(false);
280-
return false;
281278
}
282279
}
283280

core/analysis/text_token_normalizing_stream.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,9 @@ bool normalizing_token_stream::reset(std::string_view data) {
401401
case UPPER:
402402
state_->token.toUpper(state_->options.locale); // inplace case-conversion
403403
break;
404-
default: {
405-
} // NOOP
406-
};
404+
case NONE:
405+
break;
406+
}
407407

408408
// collate value, e.g. remove accents
409409
if (state_->transliterator) {

core/analysis/text_token_stream.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ bool process_term(analysis::text_token_stream::state_t& state,
374374
case analysis::text_token_stream::UPPER:
375375
state.token.toUpper(state.options.locale); // inplace case-conversion
376376
break;
377-
default: {
378-
} // NOOP
379-
};
377+
case analysis::text_token_stream::NONE:
378+
break;
379+
}
380380

381381
// collate value, e.g. remove accents
382382
if (state.transliterator) {
@@ -399,7 +399,8 @@ bool process_term(analysis::text_token_stream::state_t& state,
399399
const sb_symbol* value =
400400
reinterpret_cast<const sb_symbol*>(word_utf8.c_str());
401401

402-
value = sb_stemmer_stem(state.stemmer.get(), value, (int)word_utf8.size());
402+
value = sb_stemmer_stem(state.stemmer.get(), value,
403+
static_cast<int>(word_utf8.size()));
403404

404405
if (value) {
405406
static_assert(sizeof(byte_type) == sizeof(sb_symbol));

core/analysis/token_stream.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class token_stream : public attribute_provider {
3333
public:
3434
using ptr = std::unique_ptr<token_stream>;
3535

36-
virtual ~token_stream() = default;
3736
virtual bool next() = 0;
3837
};
3938

0 commit comments

Comments
 (0)