Skip to content

Commit

Permalink
Remove unused-but-set variables in velox/common/caching/tests/SsdFile…
Browse files Browse the repository at this point in the history
…Test.cpp +3 (facebookincubator#9907)

Summary:
Pull Request resolved: facebookincubator#9907

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.

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. 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, mbasmanova

Differential Revision: D57685875

fbshipit-source-id: 4d54d842f4e98bb878cfb8f381e58cc2da6a4e58
  • Loading branch information
r-barnes authored and facebook-github-bot committed May 23, 2024
1 parent 63b9751 commit e790c80
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions velox/common/caching/tests/SsdFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ TEST_F(SsdFileTest, writeAndRead) {

// We check howmany entries are found. The earliest writes will have been
// evicted. We read back the found entries and check their contents.
int32_t numFound = 0;
for (auto& entry : allEntries) {
std::vector<CachePin> pins;

Expand All @@ -325,7 +324,6 @@ TEST_F(SsdFileTest, writeAndRead) {
ssdPins.push_back(
ssdFile_->find(RawFileCacheKey{fileName_.id(), entry.key.offset}));
if (!ssdPins.back().empty()) {
++numFound;
ssdFile_->load(ssdPins, pins);
checkContents(pins[0].entry()->data(), pins[0].entry()->size());
}
Expand Down
2 changes: 1 addition & 1 deletion velox/common/memory/MallocAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool MallocAllocator::allocateContiguousImpl(
} else {
VELOX_CHECK_LE(numPages, maxPages);
}
MachinePageCount numCollateralPages = 0;
[[maybe_unused]] MachinePageCount numCollateralPages = 0;
if (collateral != nullptr) {
numCollateralPages =
freeNonContiguous(*collateral) / AllocationTraits::kPageSize;
Expand Down
2 changes: 1 addition & 1 deletion velox/common/memory/tests/ByteStreamTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TEST_F(ByteStreamTest, inputStream) {
uint8_t* const kFakeBuffer = reinterpret_cast<uint8_t*>(this);
std::vector<ByteRange> byteRanges;
size_t totalBytes{0};
size_t lastRangeEnd;
[[maybe_unused]] size_t lastRangeEnd;
for (int32_t i = 0; i < 32; ++i) {
byteRanges.push_back(ByteRange{kFakeBuffer, 4096 + i, 0});
totalBytes += 4096 + i;
Expand Down

0 comments on commit e790c80

Please sign in to comment.