Skip to content

Commit a68f401

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Remove unused-but-set variables in fboss/lib/config/PlatformConfigUtils.cpp +5
Summary: This diff removes a variable that was set, but which was not used. 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 but set variables often indicate a programming mistake, but can also just be unnecessary cruft that harms readability and performance. This set of diffs is divided into _simple_ and _complicated_ changes. This is a simple change, so I've verified by hand that it should be low-impact and safe to auto-land. For the complex changes. Removing this variable will not change how your code works, but the unused variable may indicate your code isn't working the way you thought it was. I've gone through each of these by hand, but mistakes may have slipped through. If you feel the diff needs changes before landing, **please commandeer** and make appropriate changes: there are hundreds of these and responding to them individually is challenging. For questions/comments, contact r-barnes. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: palmje, dmm-fb Differential Revision: D56946825 fbshipit-source-id: 2bcd089cd19630822928ba43b3d04d4163958f5c
1 parent 55a957c commit a68f401

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

folly/container/test/ForeachBenchmark.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ BENCHMARK(ForLoopFetch, iters) {
275275
}
276276

277277
BENCHMARK(ForEachKVNoMacroAssign, iters) {
278-
int sumKeys = 0;
278+
[[maybe_unused]] int sumKeys = 0;
279279
std::string sumValues;
280280

281281
BENCHMARK_SUSPEND {
@@ -291,7 +291,7 @@ BENCHMARK(ForEachKVNoMacroAssign, iters) {
291291
}
292292

293293
BENCHMARK(ForEachKVNoMacroNoAssign, iters) {
294-
int sumKeys = 0;
294+
[[maybe_unused]] int sumKeys = 0;
295295
std::string sumValues;
296296

297297
BENCHMARK_SUSPEND {

folly/experimental/symbolizer/test/DwarfBenchmark.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using namespace folly::symbolizer;
3030
using namespace folly::symbolizer::test;
3131

3232
FOLLY_NOINLINE void lexicalBlockBar() try {
33-
size_t unused = 0;
33+
[[maybe_unused]] size_t unused = 0;
3434
unused++;
3535
inlineB_inlineA_lfind();
3636
} catch (...) {

0 commit comments

Comments
 (0)