Commit 146c24b7 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Switch unguarded #pragmas to use portability macros

Summary: Otherwise downstream Windows users have to explicitly disable MSVC's warnings about unknown pragmas.

Reviewed By: yfeldblum

Differential Revision: D5211415

fbshipit-source-id: 42871e03895010818c7e1cb6e57c1885970e98c2
parent 55af3d19
......@@ -22,13 +22,14 @@
#include <stdint.h>
#include <boost/noncopyable.hpp>
#include <folly/AtomicStruct.h>
#include <folly/Portability.h>
#include <folly/detail/CacheLocality.h>
#include <folly/portability/SysMman.h>
#include <folly/portability/Unistd.h>
// 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 {
......@@ -530,4 +531,4 @@ struct IndexedMemPoolRecycler {
} // namespace folly
# pragma GCC diagnostic pop
FOLLY_POP_WARNING
......@@ -55,13 +55,13 @@ struct BitsTraits<Unaligned<T>, typename std::enable_if<
static T load(const Unaligned<T>& x) { return x.value; }
static void store(Unaligned<T>& x, T v) { x.value = v; }
static T loadRMW(const Unaligned<T>& x) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x.value;
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
}
};
......@@ -76,13 +76,13 @@ struct BitsTraits<UnalignedNoASan<T>, typename std::enable_if<
store(UnalignedNoASan<T>& x, T v) { x.value = v; }
static T FOLLY_DISABLE_ADDRESS_SANITIZER
loadRMW(const UnalignedNoASan<T>& x) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x.value;
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
}
};
......@@ -94,13 +94,13 @@ struct BitsTraits<T, typename std::enable_if<
static T load(const T& x) { return x; }
static void store(T& x, T v) { x = v; }
static T loadRMW(const T& x) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
return x;
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
}
};
......@@ -203,11 +203,10 @@ struct Bits {
// gcc 4.8 needs more -Wmaybe-uninitialized tickling, as it propagates the
// taint upstream from loadRMW
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wuninitialized")
#if !__clang__ // for gcc version [4.8, ?)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
FOLLY_GCC_DISABLE_WARNING("-Wmaybe-uninitialized")
#endif
template <class T, class Traits>
......@@ -262,7 +261,7 @@ inline void Bits<T, Traits>::innerSet(T* p, size_t offset, size_t count,
Traits::store(*p, v);
}
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
template <class T, class Traits>
inline bool Bits<T, Traits>::test(const T* p, size_t bit) {
......
......@@ -18,9 +18,11 @@
#error This file may only be included from folly/gen/Base.h
#endif
#include <folly/Portability.h>
// 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 {
namespace gen {
......@@ -2340,4 +2342,4 @@ inline detail::Batch batch(size_t batchSize) {
} // gen
} // folly
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
......@@ -21,9 +21,11 @@
#include <type_traits>
#include <utility>
#include <folly/Portability.h>
// 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 {
namespace gen {
......@@ -376,4 +378,4 @@ public:
} // gen
} // folly
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
......@@ -19,6 +19,7 @@
#endif
#include <folly/Conv.h>
#include <folly/Portability.h>
#include <folly/String.h>
namespace folly {
......@@ -369,7 +370,7 @@ class UnsplitBuffer : public Operator<UnsplitBuffer<Delimiter, OutputBuffer>> {
template<class Target, class=void>
inline Target passthrough(Target target) { return target; }
#pragma GCC diagnostic push
FOLLY_PUSH_WARNING
#ifdef __clang__
// Clang isn't happy with eatField() hack below.
#pragma GCC diagnostic ignored "-Wreturn-stack-address"
......@@ -410,7 +411,7 @@ class SplitTo {
}
};
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
} // namespace detail
......
......@@ -29,13 +29,14 @@
#include <boost/iterator/iterator_facade.hpp>
#include <folly/FBString.h>
#include <folly/Range.h>
#include <folly/FBVector.h>
#include <folly/Portability.h>
#include <folly/Range.h>
#include <folly/portability/SysUio.h>
// 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 {
......@@ -1544,4 +1545,4 @@ inline IOBuf::Iterator IOBuf::end() const { return cend(); }
} // folly
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
......@@ -55,8 +55,8 @@
#include <folly/portability/TypeTraits.h>
// 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 {
......@@ -1146,4 +1146,4 @@ struct IndexableTraits<small_vector<T, M, A, B, C>>
} // namespace folly
#pragma GCC diagnostic pop
FOLLY_POP_WARNING
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