Commit 555cbaae authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 1

Disable a couple of warnings for MSVC in folly::Function

Summary:
MSVC generates warnings if you define multiple assignment operators or multiple copy constructors on the same type. This is deliberate in `folly::Function`, so just disable the warnings for the struct instead.
Note that the warnings have to be disabled for the entire struct for them to actually be disabled. Disabling them just around the declarations of the constructors and operators in question does not actually disable the warnings.

Reviewed By: yfeldblum

Differential Revision: D3347746

fbshipit-source-id: abb53a1e62bcfb7ce02759a7ce8637d824a82081
parent 1fa49a2e
...@@ -224,6 +224,7 @@ ...@@ -224,6 +224,7 @@
#include <utility> #include <utility>
#include <folly/CppAttributes.h> #include <folly/CppAttributes.h>
#include <folly/Portability.h>
namespace folly { namespace folly {
...@@ -392,6 +393,9 @@ bool execBig(Op o, Data* src, Data* dst) { ...@@ -392,6 +393,9 @@ bool execBig(Op o, Data* src, Data* dst) {
} // namespace function } // namespace function
} // namespace detail } // namespace detail
FOLLY_PUSH_WARNING
FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors
FOLLY_MSVC_DISABLE_WARNING(4522) // Multiple assignment operators
template <typename FunctionType> template <typename FunctionType>
class Function final : private detail::function::FunctionTraits<FunctionType> { class Function final : private detail::function::FunctionTraits<FunctionType> {
// These utility types are defined outside of the template to reduce // These utility types are defined outside of the template to reduce
...@@ -627,6 +631,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> { ...@@ -627,6 +631,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> {
return Impl{std::make_shared<Function>(std::move(*this))}; return Impl{std::make_shared<Function>(std::move(*this))};
} }
}; };
FOLLY_POP_WARNING
template <typename FunctionType> template <typename FunctionType>
void swap(Function<FunctionType>& lhs, Function<FunctionType>& rhs) noexcept { void swap(Function<FunctionType>& lhs, Function<FunctionType>& rhs) noexcept {
......
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