From e8d259542762e9611ce98724b14510c88dfa91dd Mon Sep 17 00:00:00 2001 From: Arkadiy Shapkin Date: Tue, 9 May 2017 15:38:27 -0700 Subject: [PATCH] Fix FBString with MSVC Summary: Closes https://github.com/facebook/folly/pull/588 Reviewed By: ericniebler Differential Revision: D5029876 Pulled By: yfeldblum fbshipit-source-id: 6a8f16373dcfb1c7b2741eb808da0f6dbc4207b6 --- folly/FBString.h | 9 +++++---- folly/Format-inl.h | 6 +++--- folly/Format.h | 6 +++--- folly/Range.h | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/folly/FBString.h b/folly/FBString.h index f5b577a7..0ff4ba9e 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -56,6 +56,7 @@ #include #include #include +#include #if FOLLY_HAVE_DEPRECATED_ASSOC #ifdef _GLIBCXX_SYMVER @@ -79,13 +80,13 @@ #define FBSTRING_UNLIKELY(x) (x) #endif -#pragma GCC diagnostic push +FOLLY_PUSH_WARNING // Ignore shadowing warnings within this file, so includers can use -Wshadow. -#pragma GCC diagnostic ignored "-Wshadow" +FOLLY_GCC_DISABLE_WARNING("-Wshadow") // GCC 4.9 has a false positive in setSmallSize (probably // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124), disable // compile-time array bound checking. -#pragma GCC diagnostic ignored "-Warray-bounds" +FOLLY_GCC_DISABLE_WARNING("-Warray-bounds") // FBString cannot use throw when replacing std::string, though it may still // use std::__throw_* @@ -2888,7 +2889,7 @@ FOLLY_FBSTRING_HASH #endif // _LIBSTDCXX_FBSTRING -#pragma GCC diagnostic pop +FOLLY_POP_WARNING #undef FBSTRING_DISABLE_SSO #undef FBSTRING_SANITIZE_ADDRESS diff --git a/folly/Format-inl.h b/folly/Format-inl.h index 3bce2525..828de961 100644 --- a/folly/Format-inl.h +++ b/folly/Format-inl.h @@ -31,8 +31,8 @@ #include // Ignore -Wformat-nonliteral warnings within this file -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-nonliteral" +FOLLY_PUSH_WARNING +FOLLY_GCC_DISABLE_WARNING("-Wformat-nonliteral") namespace folly { @@ -1127,4 +1127,4 @@ typename std::enable_if::value>::type toAppend( } // namespace folly -#pragma GCC diagnostic pop +FOLLY_POP_WARNING diff --git a/folly/Format.h b/folly/Format.h index 8986c4ca..7c9929a9 100644 --- a/folly/Format.h +++ b/folly/Format.h @@ -28,8 +28,8 @@ #include // Ignore shadowing warnings within this file, so includers can use -Wshadow. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" +FOLLY_PUSH_WARNING +FOLLY_GCC_DISABLE_WARNING("-Wshadow") namespace folly { @@ -460,4 +460,4 @@ vformatChecked(Str* out, StringPiece fmt, Container&& container) { #include -#pragma GCC diagnostic pop +FOLLY_POP_WARNING diff --git a/folly/Range.h b/folly/Range.h index 9e392cf4..0076b079 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -56,8 +56,8 @@ #include // Ignore shadowing warnings within this file, so includers can use -Wshadow. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" +FOLLY_PUSH_WARNING +FOLLY_GCC_DISABLE_WARNING("-Wshadow") namespace folly { @@ -1268,6 +1268,6 @@ template struct IsSomeString { } // !namespace folly -#pragma GCC diagnostic pop +FOLLY_POP_WARNING FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(folly::Range); -- 2.34.1