Commit 6a47d8fb authored by Aaron Dierking's avatar Aaron Dierking Committed by Facebook Github Bot

Rename LockTraits.h invokers to work around Clang 7 issue

Summary:
Clang 7 seems to have trouble with `FOLLY_CREATE_MEMBER_INVOKER()` on Windows targets if the invoker's name is the same as the invocable name. It's spewing `-Wmicrosoft-explicit-constructor-call` warnings and the `static_assert`s in LockTraits.h are failing. As a workaround, we can rename the LockTraits.h invokers to use an `_invoker` suffix.

See https://gcc.godbolt.org/z/j4qRd9 for a demonstration of the issue.

Reviewed By: vitaut

Differential Revision: D18626335

fbshipit-source-id: c9147daaa10b02b0692c32963f9ede8cc645e329
parent 8f815149
...@@ -41,10 +41,10 @@ namespace folly { ...@@ -41,10 +41,10 @@ namespace folly {
namespace detail { namespace detail {
namespace member { namespace member {
FOLLY_CREATE_MEMBER_INVOKER(lock, lock); FOLLY_CREATE_MEMBER_INVOKER(lock_invoker, lock);
FOLLY_CREATE_MEMBER_INVOKER(try_lock_for, try_lock_for); FOLLY_CREATE_MEMBER_INVOKER(try_lock_for_invoker, try_lock_for);
FOLLY_CREATE_MEMBER_INVOKER(lock_shared, lock_shared); FOLLY_CREATE_MEMBER_INVOKER(lock_shared_invoker, lock_shared);
FOLLY_CREATE_MEMBER_INVOKER(lock_upgrade, lock_upgrade); FOLLY_CREATE_MEMBER_INVOKER(lock_upgrade_invoker, lock_upgrade);
} // namespace member } // namespace member
/** /**
...@@ -86,7 +86,7 @@ class LockInterfaceDispatcher { ...@@ -86,7 +86,7 @@ class LockInterfaceDispatcher {
private: private:
// assert that the mutex type has basic lock and unlock functions // assert that the mutex type has basic lock and unlock functions
static_assert( static_assert(
folly::is_invocable<member::lock, Mutex>::value, folly::is_invocable<member::lock_invoker, Mutex>::value,
"The mutex type must support lock and unlock functions"); "The mutex type must support lock and unlock functions");
using duration = std::chrono::milliseconds; using duration = std::chrono::milliseconds;
...@@ -94,11 +94,11 @@ class LockInterfaceDispatcher { ...@@ -94,11 +94,11 @@ class LockInterfaceDispatcher {
public: public:
static constexpr bool has_lock_unique = true; static constexpr bool has_lock_unique = true;
static constexpr bool has_lock_timed = static constexpr bool has_lock_timed =
folly::is_invocable<member::try_lock_for, Mutex, duration>::value; folly::is_invocable<member::try_lock_for_invoker, Mutex, duration>::value;
static constexpr bool has_lock_shared = static constexpr bool has_lock_shared =
folly::is_invocable<member::lock_shared, Mutex>::value; folly::is_invocable<member::lock_shared_invoker, Mutex>::value;
static constexpr bool has_lock_upgrade = static constexpr bool has_lock_upgrade =
folly::is_invocable<member::lock_upgrade, Mutex>::value; folly::is_invocable<member::lock_upgrade_invoker, Mutex>::value;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment