Skip to content

Commit

Permalink
Remove unused variables in faiss/utils/partitioning.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: palmje

Differential Revision: D53779589

fbshipit-source-id: 2631d7b23f2bc79b0468a8d983f74547c15f9c15
  • Loading branch information
r-barnes authored and facebook-github-bot committed Feb 15, 2024
1 parent 873b1bc commit 8400ece
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion faiss/utils/partitioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ typename C::T partition_fuzzy_median3(
assert(n_eq_1 <= n_eq);
}

int wp = compress_array<C>(vals, ids, n, thresh, n_eq_1);
[[maybe_unused]] const int wp =
compress_array<C>(vals, ids, n, thresh, n_eq_1);

assert(wp == q);
if (q_out) {
Expand Down

0 comments on commit 8400ece

Please sign in to comment.