From 3c5ce2ca2d39da365b1b36c34b08731175f6f85d Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Fri, 13 Dec 2024 11:26:13 -0800 Subject: [PATCH] Enable `-Wunused-variable` in glean/PACKAGE Summary: This diff enables compilation warning flags for the directory in question. Further details are in [this workplace post](https://fb.workplace.com/permalink.php?story_fbid=pfbid02XaWNiCVk69r1ghfvDVpujB8Hr9Y61uDvNakxiZFa2jwiPHscVdEQwCBHrmWZSyMRl&id=100051201402394). This is a low-risk diff. There are **no run-time effects** and the diff has already been observed to compile locally. **If the code compiles, it work; test errors are spurious.** Reviewed By: palmje Differential Revision: D66847527 fbshipit-source-id: be53693c0d05047e6b0fe28238a1491e1ec7b006 --- glean/rocksdb/database-impl.cpp | 5 ++--- glean/rts/stacked.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/glean/rocksdb/database-impl.cpp b/glean/rocksdb/database-impl.cpp index fb91b604e..61c4aae48 100644 --- a/glean/rocksdb/database-impl.cpp +++ b/glean/rocksdb/database-impl.cpp @@ -269,8 +269,7 @@ struct SeekIterator final : rts::FactIterator { Fact::Ref get(Demand demand) override { if (iter_->Valid()) { auto key = input(iter_->key()); - auto ty = key.fixed(); - assert(ty == type_); + assert(key.fixed() == type_); auto value = input(iter_->value()); auto id = value.fixed(); assert(value.empty()); @@ -278,7 +277,7 @@ struct SeekIterator final : rts::FactIterator { if (demand == KeyOnly) { return Fact::Ref{id, type_, Fact::Clause::fromKey(key.bytes())}; } else { - auto found = db_->lookupById(id, slice_); + [[maybe_unused]] auto found = db_->lookupById(id, slice_); assert(found); return decomposeFact(id, slice_); } diff --git a/glean/rts/stacked.h b/glean/rts/stacked.h index 0c36f512c..13aa95a7f 100644 --- a/glean/rts/stacked.h +++ b/glean/rts/stacked.h @@ -160,12 +160,11 @@ struct Stacked final : StackedBase { // similar). This means that there is no need to check against the // value stored in the database as that must be empty, too. if (clause.value_size != 0) { - bool found = base->factById(id, [&](auto, auto found) { + assert(base->factById(id, [&](auto, auto found) { if (clause.value() != found.value()) { id = Id::invalid(); } - }); - assert(found); + })); } return id; }