From 2d08c8e4ab71fe121dd8cedc13ca24559f7de083 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Mon, 20 Apr 2020 15:45:19 +0800 Subject: [PATCH] clang-10 fix --- base/common/strong_typedef.h | 6 ------ contrib/llvm | 2 +- contrib/rapidjson | 2 +- src/Common/tests/chaos_sanitizer.cpp | 13 +++++++------ src/Core/SettingsCollection.h | 4 ++-- src/Core/SettingsCollectionImpl.h | 6 +++--- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/base/common/strong_typedef.h b/base/common/strong_typedef.h index ae502b4ef97..a46eb415e15 100644 --- a/base/common/strong_typedef.h +++ b/base/common/strong_typedef.h @@ -1,15 +1,9 @@ #pragma once -#include #include -/** https://svn.boost.org/trac/boost/ticket/5182 - */ - template struct StrongTypedef - : boost::totally_ordered1< StrongTypedef - , boost::totally_ordered2< StrongTypedef, T> > { private: using Self = StrongTypedef; diff --git a/contrib/llvm b/contrib/llvm index 5dab18f4861..4bb9d5c58d9 160000 --- a/contrib/llvm +++ b/contrib/llvm @@ -1 +1 @@ -Subproject commit 5dab18f4861677548b8f7f6815f49384480ecead +Subproject commit 4bb9d5c58d92baf4f043ee5258bcdfa8ac567545 diff --git a/contrib/rapidjson b/contrib/rapidjson index 01950eb7ace..8f4c021fa2f 160000 --- a/contrib/rapidjson +++ b/contrib/rapidjson @@ -1 +1 @@ -Subproject commit 01950eb7acec78818d68b762efc869bba2420d82 +Subproject commit 8f4c021fa2f1e001d2376095928fc0532adf2ae6 diff --git a/src/Common/tests/chaos_sanitizer.cpp b/src/Common/tests/chaos_sanitizer.cpp index 130d660f7ab..98f28f95b78 100644 --- a/src/Common/tests/chaos_sanitizer.cpp +++ b/src/Common/tests/chaos_sanitizer.cpp @@ -1,5 +1,6 @@ #include #include +#include #include @@ -20,31 +21,31 @@ int main(int argc, char ** argv) std::cerr << (DB::ThreadFuzzer::instance().isEffective() ? "ThreadFuzzer is enabled.\n" : "ThreadFuzzer is not enabled.\n"); - volatile size_t counter1 = 0; - volatile size_t counter2 = 0; + std::atomic counter1 = 0; + std::atomic counter2 = 0; /// These threads are synchronized by sleep (that's intentionally incorrect). std::thread t1([&] { for (size_t i = 0; i < num_iterations; ++i) - ++counter1; + counter1.store(counter1.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed); sleepForNanoseconds(100000000); for (size_t i = 0; i < num_iterations; ++i) - ++counter2; + counter2.store(counter2.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed); }); std::thread t2([&] { for (size_t i = 0; i < num_iterations; ++i) - ++counter2; + counter2.store(counter2.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed); sleepForNanoseconds(100000000); for (size_t i = 0; i < num_iterations; ++i) - ++counter1; + counter1.store(counter1.load(std::memory_order_relaxed) + 1, std::memory_order_relaxed); }); t1.join(); diff --git a/src/Core/SettingsCollection.h b/src/Core/SettingsCollection.h index d93772e86ed..9b1813cdb86 100644 --- a/src/Core/SettingsCollection.h +++ b/src/Core/SettingsCollection.h @@ -524,8 +524,8 @@ public: bool tryGet(const StringRef & name, String & value) const; /// Compares two collections of settings. - bool operator ==(const Derived & rhs) const; - bool operator!=(const Derived & rhs) const { return !(*this == rhs); } + bool operator ==(const SettingsCollection & rhs) const; + bool operator!=(const SettingsCollection & rhs) const { return !(*this == rhs); } /// Gathers all changed values (e.g. for applying them later to another collection of settings). SettingsChanges changes() const; diff --git a/src/Core/SettingsCollectionImpl.h b/src/Core/SettingsCollectionImpl.h index d5716c2a80d..8210b04e2da 100644 --- a/src/Core/SettingsCollectionImpl.h +++ b/src/Core/SettingsCollectionImpl.h @@ -173,19 +173,19 @@ bool SettingsCollection::tryGet(const StringRef & name, String & value) template -bool SettingsCollection::operator ==(const Derived & rhs) const +bool SettingsCollection::operator ==(const SettingsCollection & rhs) const { const auto & the_members = members(); for (size_t i = 0; i != the_members.size(); ++i) { const auto & member = the_members[i]; bool left_changed = member.is_changed(castToDerived()); - bool right_changed = member.is_changed(rhs); + bool right_changed = member.is_changed(rhs.castToDerived()); if (left_changed || right_changed) { if (left_changed != right_changed) return false; - if (member.get_field(castToDerived()) != member.get_field(rhs)) + if (member.get_field(castToDerived()) != member.get_field(rhs.castToDerived())) return false; } }