From 5e4e99c87f359bfedc80319e285ebafdc276d3cb Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Tue, 17 Dec 2024 15:09:36 -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 works; test errors are spurious.** #build_targets_regex[fbcode//glean/.*] #buildmore - Be thorough ig-no-test - No need to run instagram tests; build phase is sufficient. #buildsonlynotests - **This diff has no runtime effects.** - If you approve of this diff, please use the "Accept & Ship" button :-) (1 file modified.) Reviewed By: palmje Differential Revision: D67329001 fbshipit-source-id: 7ca569e2f330b195597cb0191b9266f01d41779a --- glean/rocksdb/database-impl.cpp | 4 ++-- glean/rts/stacked.h | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/glean/rocksdb/database-impl.cpp b/glean/rocksdb/database-impl.cpp index fb91b604e..04dbd2be4 100644 --- a/glean/rocksdb/database-impl.cpp +++ b/glean/rocksdb/database-impl.cpp @@ -269,7 +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(); + [[maybe_unused]] auto ty = key.fixed(); assert(ty == type_); auto value = input(iter_->value()); auto id = value.fixed(); @@ -278,7 +278,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..f87a3d688 100644 --- a/glean/rts/stacked.h +++ b/glean/rts/stacked.h @@ -160,11 +160,12 @@ 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) { - if (clause.value() != found.value()) { - id = Id::invalid(); - } - }); + [[maybe_unused]] bool found = + base->factById(id, [&](auto, auto found) { + if (clause.value() != found.value()) { + id = Id::invalid(); + } + }); assert(found); } return id;