Merge pull request #10370 from amosbird/clang-10

clang-10 fix
This commit is contained in:
alexey-milovidov 2020-04-20 22:47:12 +03:00 committed by GitHub
commit faeab5f649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 19 deletions

View File

@ -1,15 +1,9 @@
#pragma once
#include <boost/operators.hpp>
#include <type_traits>
/** https://svn.boost.org/trac/boost/ticket/5182
*/
template <class T, class Tag>
struct StrongTypedef
: boost::totally_ordered1< StrongTypedef<T, Tag>
, boost::totally_ordered2< StrongTypedef<T, Tag>, T> >
{
private:
using Self = StrongTypedef;

2
contrib/llvm vendored

@ -1 +1 @@
Subproject commit 5dab18f4861677548b8f7f6815f49384480ecead
Subproject commit 4bb9d5c58d92baf4f043ee5258bcdfa8ac567545

2
contrib/rapidjson vendored

@ -1 +1 @@
Subproject commit 01950eb7acec78818d68b762efc869bba2420d82
Subproject commit 8f4c021fa2f1e001d2376095928fc0532adf2ae6

View File

@ -1,5 +1,6 @@
#include <thread>
#include <iostream>
#include <atomic>
#include <common/sleep.h>
@ -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<size_t> counter1 = 0;
std::atomic<size_t> 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();

View File

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

View File

@ -173,19 +173,19 @@ bool SettingsCollection<Derived>::tryGet(const StringRef & name, String & value)
template <class Derived>
bool SettingsCollection<Derived>::operator ==(const Derived & rhs) const
bool SettingsCollection<Derived>::operator ==(const SettingsCollection<Derived> & 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;
}
}