diff --git a/cmake/ConfigureCompiler.cmake b/cmake/ConfigureCompiler.cmake index 65f214fb17..270fbc9f9c 100644 --- a/cmake/ConfigureCompiler.cmake +++ b/cmake/ConfigureCompiler.cmake @@ -237,6 +237,7 @@ else() -Wno-unknown-attributes) endif() add_compile_options( + -Wall -Wextra # Here's the current set of warnings we need to explicitly disable to compile warning-free with clang 10 -Wno-comment -Wno-dangling-else diff --git a/fdbbackup/FileConverter.actor.cpp b/fdbbackup/FileConverter.actor.cpp index 67f0e3493d..3556b3ae98 100644 --- a/fdbbackup/FileConverter.actor.cpp +++ b/fdbbackup/FileConverter.actor.cpp @@ -233,7 +233,7 @@ struct MutationFilesReadProgress : public ReferenceCountedfd->getFilename() << " " << fp->mutations.size() << " mutations"; if (fp->mutations.size() > 0) { std::cout << ", range " << fp->mutations[0].version.toString() << " " diff --git a/fdbclient/BackupContainer.actor.cpp b/fdbclient/BackupContainer.actor.cpp index 17ffa79db2..f24a0d3bc3 100644 --- a/fdbclient/BackupContainer.actor.cpp +++ b/fdbclient/BackupContainer.actor.cpp @@ -1214,7 +1214,7 @@ public: } // for each range in tags, check all tags from 1 are continouous - for (const auto [beginEnd, count] : tags) { + for (const auto& [beginEnd, count] : tags) { for (int i = 1; i < count; i++) { if (!isContinuous(files, tagIndices[i], beginEnd.first, std::min(beginEnd.second - 1, end), nullptr)) { TraceEvent(SevWarn, "BackupFileNotContinuous") @@ -1317,7 +1317,7 @@ public: // for each range in tags, check all partitions from 1 are continouous Version lastEnd = begin; - for (const auto [beginEnd, count] : tags) { + for (const auto& [beginEnd, count] : tags) { Version tagEnd = beginEnd.second; // This range's minimum continous partition version for (int i = 1; i < count; i++) { std::map, int> rangeTags; diff --git a/fdbclient/TagThrottle.actor.cpp b/fdbclient/TagThrottle.actor.cpp index 1bffce0e6a..c3f67ec91f 100644 --- a/fdbclient/TagThrottle.actor.cpp +++ b/fdbclient/TagThrottle.actor.cpp @@ -339,7 +339,7 @@ namespace ThrottleApi { loop { try { Optional value = wait(tr.get(tagThrottleAutoEnabledKey)); - if(!value.present() || (enabled && value.get() != LiteralStringRef("1") || (!enabled && value.get() != LiteralStringRef("0")))) { + if (!value.present() || (enabled && value.get() != LiteralStringRef("1")) || (!enabled && value.get() != LiteralStringRef("0"))) { tr.set(tagThrottleAutoEnabledKey, LiteralStringRef(enabled ? "1" : "0")); signalThrottleChange(tr); @@ -352,4 +352,4 @@ namespace ThrottleApi { } } } -} \ No newline at end of file +} diff --git a/fdbserver/BackupProgress.actor.cpp b/fdbserver/BackupProgress.actor.cpp index 8e15158a96..3f1d564c16 100644 --- a/fdbserver/BackupProgress.actor.cpp +++ b/fdbserver/BackupProgress.actor.cpp @@ -184,7 +184,7 @@ TEST_CASE("/BackupProgress/Unfinished") { std::map, std::map> unfinished = progress.getUnfinishedBackup(); ASSERT(unfinished.size() == 1); - for (const auto [epochVersionCount, tagVersion] : unfinished) { + for (const auto& [epochVersionCount, tagVersion] : unfinished) { ASSERT(std::get<0>(epochVersionCount) == epoch1 && std::get<1>(epochVersionCount) == end1 && std::get<2>(epochVersionCount) == 1); ASSERT(tagVersion.size() == 1 && tagVersion.begin()->first == tag1 && tagVersion.begin()->second == begin1); @@ -195,11 +195,11 @@ TEST_CASE("/BackupProgress/Unfinished") { progress.addBackupStatus(status1); unfinished = progress.getUnfinishedBackup(); ASSERT(unfinished.size() == 1); - for (const auto [epochVersionCount, tagVersion] : unfinished) { + for (const auto& [epochVersionCount, tagVersion] : unfinished) { ASSERT(std::get<0>(epochVersionCount) == epoch1 && std::get<1>(epochVersionCount) == end1 && std::get<2>(epochVersionCount) == 1); ASSERT(tagVersion.size() == 1 && tagVersion.begin()->first == tag1 && tagVersion.begin()->second == saved1 + 1); } return Void(); -} \ No newline at end of file +} diff --git a/fdbserver/BackupWorker.actor.cpp b/fdbserver/BackupWorker.actor.cpp index 2554ca9619..c0113e0aaa 100644 --- a/fdbserver/BackupWorker.actor.cpp +++ b/fdbserver/BackupWorker.actor.cpp @@ -45,8 +45,8 @@ struct VersionedMessage { VersionedMessage(LogMessageVersion v, StringRef m, const VectorRef& t, const Arena& a) : version(v), message(m), tags(t), arena(a), bytes(a.getSize()) {} - const Version getVersion() const { return version.version; } - const uint32_t getSubVersion() const { return version.sub; } + Version getVersion() const { return version.version; } + uint32_t getSubVersion() const { return version.sub; } // Returns true if the message is a mutation that should be backuped, i.e., // either key is not in system key space or is not a metadataVersionKey. @@ -367,7 +367,7 @@ struct BackupData { bool modified = false; bool minVersionChanged = false; Version minVersion = std::numeric_limits::max(); - for (const auto [uid, version] : uidVersions) { + for (const auto& [uid, version] : uidVersions) { auto it = backups.find(uid); if (it == backups.end()) { modified = true; diff --git a/fdbserver/MasterProxyServer.actor.cpp b/fdbserver/MasterProxyServer.actor.cpp index 9858c78a38..175269ff3a 100644 --- a/fdbserver/MasterProxyServer.actor.cpp +++ b/fdbserver/MasterProxyServer.actor.cpp @@ -454,7 +454,7 @@ struct ProxyCommitData { return tags; } - const bool needsCacheTag(KeyRangeRef range) { + bool needsCacheTag(KeyRangeRef range) { auto ranges = cacheInfo.intersectingRanges(range); for(auto r : ranges) { if(r.value()) { diff --git a/fdbserver/StorageCache.actor.cpp b/fdbserver/StorageCache.actor.cpp index c94cbb32ae..278a7d9d9b 100644 --- a/fdbserver/StorageCache.actor.cpp +++ b/fdbserver/StorageCache.actor.cpp @@ -764,7 +764,6 @@ public: Version currentVersion; private: KeyRef cacheStartKey; - bool nowAssigned; bool processedCacheStartKey; // Applies private mutations, as the name suggests. It's basically establishes the key-ranges diff --git a/flow/TreeBenchmark.h b/flow/TreeBenchmark.h index 746e45d718..30e1dfb841 100644 --- a/flow/TreeBenchmark.h +++ b/flow/TreeBenchmark.h @@ -100,7 +100,7 @@ void treeBenchmark(T& tree, F generateKey) { keys.resize(std::unique(keys.begin(), keys.end()) - keys.begin()); auto iter = tree.lower_bound(*keys.begin()); - timedRun("scan", keys, [&tree, &iter](key const& k) { + timedRun("scan", keys, [&iter](key const& k) { ASSERT(k == *iter); ++iter; }); @@ -123,4 +123,4 @@ static inline int randomInt() { return deterministicRandom()->randomInt(0, INT32_MAX); } -#endif // FLOW_TREEBENCHMARK_H \ No newline at end of file +#endif // FLOW_TREEBENCHMARK_H