Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: make unused-variables an error and fix them #381

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else()
endif()

# Top-level CMake config
set(CMAKE_CXX_FLAGS "-Wall -Werror=vla")
set(CMAKE_CXX_FLAGS "-Wall -Werror=vla -Werror=unused-variable")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
3 changes: 2 additions & 1 deletion src/executor/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ void Executor::executeTasks(std::vector<int> msgIdxs,
// one-to-one with thread pool threads. Only once the pool is exhausted
// do we start overloading
for (int msgIdx : msgIdxs) {
const faabric::Message& msg = req->messages().at(msgIdx);
[[maybe_unused]] const faabric::Message& msg =
req->messages().at(msgIdx);

if (availablePoolThreads.empty()) {
SPDLOG_ERROR("No available thread pool threads (size: {})",
Expand Down
3 changes: 2 additions & 1 deletion src/transport/PointToPointBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ void PointToPointBroker::sendMappingsFromSchedulingDecision(
msg.set_appid(decision.appId);
msg.set_groupid(decision.groupId);

std::set<int>& indexes = groupIdIdxsMap[decision.groupId];
[[maybe_unused]] std::set<int>& indexes =
groupIdIdxsMap[decision.groupId];

for (int i = 0; i < decision.nFunctions; i++) {
auto* mapping = msg.add_mappings();
Expand Down
10 changes: 5 additions & 5 deletions src/util/snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void SnapshotData::applyDiff(const SnapshotDiff& diff)
return;
}

uint8_t* copyTarget = validatedOffsetPtr(diff.getOffset());
[[maybe_unused]] uint8_t* copyTarget = validatedOffsetPtr(diff.getOffset());
switch (diff.getDataType()) {
case (faabric::util::SnapshotDataType::Int): {
int32_t finalValue =
Expand Down Expand Up @@ -762,7 +762,7 @@ void SnapshotMergeRegion::addDiffs(std::vector<SnapshotDiff>& diffs,
bool changed = false;
switch (dataType) {
case (SnapshotDataType::Int): {
int preUpdate = unalignedRead<int>(updated);
[[maybe_unused]] int preUpdate = unalignedRead<int>(updated);
changed = calculateDiffValue<int>(original, updated, operation);

SPDLOG_TRACE("Calculated int {} merge: {} {} -> {}",
Expand All @@ -773,7 +773,7 @@ void SnapshotMergeRegion::addDiffs(std::vector<SnapshotDiff>& diffs,
break;
}
case (SnapshotDataType::Long): {
long preUpdate = unalignedRead<long>(updated);
[[maybe_unused]] long preUpdate = unalignedRead<long>(updated);
changed = calculateDiffValue<long>(original, updated, operation);

SPDLOG_TRACE("Calculated long {} merge: {} {} -> {}",
Expand All @@ -784,7 +784,7 @@ void SnapshotMergeRegion::addDiffs(std::vector<SnapshotDiff>& diffs,
break;
}
case (SnapshotDataType::Float): {
float preUpdate = unalignedRead<float>(updated);
[[maybe_unused]] float preUpdate = unalignedRead<float>(updated);
changed = calculateDiffValue<float>(original, updated, operation);

SPDLOG_TRACE("Calculated float {} merge: {} {} -> {}",
Expand All @@ -795,7 +795,7 @@ void SnapshotMergeRegion::addDiffs(std::vector<SnapshotDiff>& diffs,
break;
}
case (SnapshotDataType::Double): {
double preUpdate = unalignedRead<double>(updated);
[[maybe_unused]] double preUpdate = unalignedRead<double>(updated);
changed = calculateDiffValue<double>(original, updated, operation);

SPDLOG_TRACE("Calculated double {} merge: {} {} -> {}",
Expand Down
4 changes: 2 additions & 2 deletions tests/dist/mpi/mpi_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int MPI_Init(int* argc, char*** argv)
}

// Initialise MPI-specific logging
int thisRank = executingContext.getRank();
[[maybe_unused]] int thisRank = executingContext.getRank();
SPDLOG_DEBUG(
"Initialised world (id: {}) for rank: {}", call->mpiworldid(), thisRank);

Expand All @@ -98,7 +98,7 @@ int MPI_Comm_size(MPI_Comm comm, int* size)

int MPI_Finalize()
{
int rank = executingContext.getRank();
[[maybe_unused]] int rank = executingContext.getRank();
SPDLOG_DEBUG("MPI - MPI_Finalize (rank: {})", rank);

return terminateMpi();
Expand Down
3 changes: 2 additions & 1 deletion tests/dist/scheduler/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ int handleSimpleThread(tests::DistTestExecutor* exec,
// Return a distinctive value
int returnValue = msg.id() / 2;

const faabric::util::SystemConfig& conf = faabric::util::getSystemConfig();
[[maybe_unused]] const faabric::util::SystemConfig& conf =
faabric::util::getSystemConfig();
SPDLOG_DEBUG("Thread {} executed on host {}. Returning {}",
msg.id(),
conf.endpointHost,
Expand Down
1 change: 1 addition & 0 deletions tests/test/mpi/test_mpi_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test local barrier", "[mpi]")

world.barrier(rankA1);
assert(sendData == recvData);
UNUSED(recvData);
});

world.recv(rankA1,
Expand Down
2 changes: 1 addition & 1 deletion tests/test/util/test_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ TEST_CASE("Stress test fixed capacity queue", "[util]")
startLatch->wait();

for (int j = 0; j < numMessages; j++) {
int result = queues.at(i)->dequeue();
[[maybe_unused]] int result = queues.at(i)->dequeue();
assert(result == i * j);
}
});
Expand Down
Loading