From 6c4a55d047861f08753fc2a938abe9da75369add Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 14 Apr 2017 09:00:08 -0700 Subject: [PATCH] Revert D4805628: [folly] Suppress more warnings for MSVC Summary: This reverts commit 9574ea984e1e3daca01101259687f46effcf3a9f Differential Revision: D4805628 fbshipit-source-id: 3285317a4c3f2012da1f13e9c91b6c623726c9b7 --- folly/Conv.h | 10 +++------- folly/Expected.h | 12 ------------ folly/Hash.h | 3 +-- folly/portability/Windows.h | 5 +++++ 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/folly/Conv.h b/folly/Conv.h index 17b2fc67..20cf3d51 100644 --- a/folly/Conv.h +++ b/folly/Conv.h @@ -557,11 +557,8 @@ toAppend(Src value, Tgt * result) { char buffer[20]; if (value < 0) { result->push_back('-'); - using u = std::make_signed::type; result->append( - buffer, - uint64ToBufferUnsafe( - static_cast(-static_cast(value)), buffer)); + buffer, uint64ToBufferUnsafe(uint64_t(-uint64_t(value)), buffer)); } else { result->append(buffer, uint64ToBufferUnsafe(uint64_t(value), buffer)); } @@ -1182,14 +1179,13 @@ parseTo(StringPiece src, Tgt& out) { namespace detail { /** - * Bool to integral/float doesn't need any special checks, and this + * Bool to integral doesn't need any special checks, and this * overload means we aren't trying to see if a bool is less than * an integer. */ template typename std::enable_if< - !std::is_same::value && - (std::is_integral::value || std::is_floating_point::value), + !std::is_same::value && std::is_integral::value, Expected>::type convertTo(const bool& value) noexcept { return static_cast(value ? 1 : 0); diff --git a/folly/Expected.h b/folly/Expected.h index 2b791c11..ee765cc9 100644 --- a/folly/Expected.h +++ b/folly/Expected.h @@ -233,11 +233,6 @@ struct ExpectedStorage { Value&& value() && { return std::move(value_); } - // TODO (t17322426): remove when VS2015 support is deprecated - // VS2015 static analyzer incorrectly flags these as unreachable in certain - // circumstances. VS2017 does not have this problem on the same code. - FOLLY_PUSH_WARNING - FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code Error& error() & { return error_; } @@ -247,7 +242,6 @@ struct ExpectedStorage { Error&& error() && { return std::move(error_); } - FOLLY_POP_WARNING }; template @@ -533,11 +527,6 @@ struct ExpectedStorage { Value&& value() && { return std::move(value_); } - // TODO (t17322426): remove when VS2015 support is deprecated - // VS2015 static analyzer incorrectly flags these as unreachable in certain - // circumstances. VS2017 does not have this problem on the same code. - FOLLY_PUSH_WARNING - FOLLY_MSVC_DISABLE_WARNING(4702) // unreachable code Error& error() & { return error_; } @@ -547,7 +536,6 @@ struct ExpectedStorage { Error&& error() && { return std::move(error_); } - FOLLY_POP_WARNING }; namespace expected_detail_ExpectedHelper { diff --git a/folly/Hash.h b/folly/Hash.h index 314a98d0..0f0afc5b 100644 --- a/folly/Hash.h +++ b/folly/Hash.h @@ -365,8 +365,7 @@ template <> struct hasher { size_t operator()(bool key) const { // Make sure that all the output bits depend on the input. - using u = std::make_signed::type; - return static_cast(-static_cast(key)); + return -static_cast(key); } }; diff --git a/folly/portability/Windows.h b/folly/portability/Windows.h index 2cb0bda8..f10c428a 100755 --- a/folly/portability/Windows.h +++ b/folly/portability/Windows.h @@ -44,6 +44,11 @@ #undef CAL_GREGORIAN #endif +// Defined in winnt.h +#ifdef DELETE +#undef DELETE +#endif + // Defined in the GDI interface. #ifdef ERROR #undef ERROR -- 2.34.1