Skip to content

Commit

Permalink
Remove unused variables in faiss/IndexHNSW.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: meyering

Differential Revision: D52734573

fbshipit-source-id: edf315a4e2e7ddfaf8b879b7f4a3fc3a6c2e607f
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jan 14, 2024
1 parent b7efd3a commit f884ba2
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions faiss/IndexHNSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ int search_from_candidates_2(
int level,
int nres_in = 0) {
int nres = nres_in;
int ndis = 0;
for (int i = 0; i < candidates.size(); i++) {
idx_t v1 = candidates.ids[i];
FAISS_ASSERT(v1 >= 0);
Expand All @@ -756,7 +755,6 @@ int search_from_candidates_2(
if (vt.visited[v1] == vt.visno + 1) {
// nothing to do
} else {
ndis++;
float d = qdis(v1);
candidates.push(v1, d);

Expand Down

0 comments on commit f884ba2

Please sign in to comment.