Skip to content

Commit

Permalink
Remove unused variables in faiss/impl/index_write.cpp
Browse files Browse the repository at this point in the history
Summary:
LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.

This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: algoriddle

Differential Revision: D52981052

fbshipit-source-id: 203e7ead56c69ffd77ee4a61eed1d0a502a14866
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jan 23, 2024
1 parent a651069 commit e55a0ac
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions faiss/impl/index_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,11 @@ static void write_NSG(const NSG* nsg, IOWriter* f) {
FAISS_THROW_IF_NOT(K == nsg->R);
FAISS_THROW_IF_NOT(true == graph->own_fields);

int size = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < K; j++) {
int id = graph->at(i, j);
if (id != EMPTY_ID) {
WRITE1(id);
size += 1;
} else {
break;
}
Expand Down

0 comments on commit e55a0ac

Please sign in to comment.