Merge pull request #3570 from sfc-gh-anoyes/anoyes/enable-Wall-Wextra

Re-enable -Wall -Wextra for clang
This commit is contained in:
Meng Xu 2020-07-28 14:35:38 -07:00 committed by GitHub
commit 6b28687c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 15 deletions

View File

@ -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

View File

@ -233,7 +233,7 @@ struct MutationFilesReadProgress : public ReferenceCounted<MutationFilesReadProg
void dumpProgress(std::string msg) {
std::cout << msg << "\n ";
for (const auto fp : fileProgress) {
for (const auto& fp : fileProgress) {
std::cout << fp->fd->getFilename() << " " << fp->mutations.size() << " mutations";
if (fp->mutations.size() > 0) {
std::cout << ", range " << fp->mutations[0].version.toString() << " "

View File

@ -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<std::pair<Version, Version>, int> rangeTags;

View File

@ -339,7 +339,7 @@ namespace ThrottleApi {
loop {
try {
Optional<Value> 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 {
}
}
}
}
}

View File

@ -184,7 +184,7 @@ TEST_CASE("/BackupProgress/Unfinished") {
std::map<std::tuple<LogEpoch, Version, int>, std::map<Tag, Version>> 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();
}
}

View File

@ -45,8 +45,8 @@ struct VersionedMessage {
VersionedMessage(LogMessageVersion v, StringRef m, const VectorRef<Tag>& 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<Version>::max();
for (const auto [uid, version] : uidVersions) {
for (const auto& [uid, version] : uidVersions) {
auto it = backups.find(uid);
if (it == backups.end()) {
modified = true;

View File

@ -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()) {

View File

@ -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

View File

@ -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
#endif // FLOW_TREEBENCHMARK_H