From a92271a205c08bdb003af9fceb7aff2227a913da Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 12 Nov 2024 14:57:36 -0800 Subject: [PATCH] Build with -Wunused-variable --- CMakeLists.txt | 7 ++++++- ConflictSet.cpp | 8 ++++---- SkipList.cpp | 1 - 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 217901f..7397195 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,12 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() add_compile_options( - -Werror=switch-enum -Wswitch-enum -fPIC -fdata-sections -ffunction-sections + -Werror=switch-enum + -Wswitch-enum + -Wunused-variable + -fPIC + -fdata-sections + -ffunction-sections -fno-jump-tables # https://github.com/llvm/llvm-project/issues/54247 ) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index cec8f48..c4b1a47 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -5862,13 +5862,13 @@ void checkVersionsGeqOldestExtant(Node *n, case Type_Node0: { } break; case Type_Node3: { - auto *self = static_cast(n); + [[maybe_unused]] auto *self = static_cast(n); for (int i = 0; i < 3; ++i) { assert(self->childMaxVersion[i] >= oldestExtantVersion); } } break; case Type_Node16: { - auto *self = static_cast(n); + [[maybe_unused]] auto *self = static_cast(n); for (int i = 0; i < 16; ++i) { assert(self->childMaxVersion[i] >= oldestExtantVersion); } @@ -5878,7 +5878,7 @@ void checkVersionsGeqOldestExtant(Node *n, for (int i = 0; i < 48; ++i) { assert(self->childMaxVersion[i] >= oldestExtantVersion); } - for (auto m : self->maxOfMax) { + for ([[maybe_unused]] auto m : self->maxOfMax) { assert(m >= oldestExtantVersion); } } break; @@ -5887,7 +5887,7 @@ void checkVersionsGeqOldestExtant(Node *n, for (int i = 0; i < 256; ++i) { assert(self->childMaxVersion[i] >= oldestExtantVersion); } - for (auto m : self->maxOfMax) { + for ([[maybe_unused]] auto m : self->maxOfMax) { assert(m >= oldestExtantVersion); } } break; diff --git a/SkipList.cpp b/SkipList.cpp index b3708c2..fe09147 100644 --- a/SkipList.cpp +++ b/SkipList.cpp @@ -796,7 +796,6 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl { int temp[stripeSize]; int stripes = (stringCount + stripeSize - 1) / stripeSize; StringRef values[stripeSize]; - int64_t writeVersions[stripeSize / 2]; int ss = stringCount - (stripes - 1) * stripeSize; int64_t entryDelta = 0; for (int s = stripes - 1; s >= 0; s--) {