From 555cbaae5ae322f0579d548d1b971101d07729da Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 27 May 2016 09:48:20 -0700 Subject: [PATCH] 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 --- folly/Function.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/folly/Function.h b/folly/Function.h index a1b230e0..aab8391c 100644 --- a/folly/Function.h +++ b/folly/Function.h @@ -224,6 +224,7 @@ #include #include +#include namespace folly { @@ -392,6 +393,9 @@ bool execBig(Op o, Data* src, Data* dst) { } // namespace function } // namespace detail +FOLLY_PUSH_WARNING +FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors +FOLLY_MSVC_DISABLE_WARNING(4522) // Multiple assignment operators template class Function final : private detail::function::FunctionTraits { // These utility types are defined outside of the template to reduce @@ -627,6 +631,7 @@ class Function final : private detail::function::FunctionTraits { return Impl{std::make_shared(std::move(*this))}; } }; +FOLLY_POP_WARNING template void swap(Function& lhs, Function& rhs) noexcept { -- 2.34.1