Commit ca7bdc77 authored by Andrew Gallagher's avatar Andrew Gallagher Committed by Facebook GitHub Bot

Fix `-Wundef` warnings

Reviewed By: ot

Differential Revision: D31763384

fbshipit-source-id: ef666193f83a16d4eedf65a499361d967809163f
parent c2ba33fd
...@@ -104,12 +104,12 @@ ...@@ -104,12 +104,12 @@
/* Define a convenience macro to test when thread sanitizer is being used /* Define a convenience macro to test when thread sanitizer is being used
* across the different compilers (e.g. clang, gcc) */ * across the different compilers (e.g. clang, gcc) */
#ifndef FOLLY_SANITIZE_THREAD #ifndef FOLLY_SANITIZE_THREAD
#if FOLLY_HAS_FEATURE(thread_sanitizer) || __SANITIZE_THREAD__ #if FOLLY_HAS_FEATURE(thread_sanitizer) || defined(__SANITIZE_THREAD__)
#define FOLLY_SANITIZE_THREAD 1 #define FOLLY_SANITIZE_THREAD 1
#endif #endif
#endif #endif
#if FOLLY_SANITIZE_THREAD #ifdef FOLLY_SANITIZE_THREAD
#define FOLLY_DISABLE_THREAD_SANITIZER \ #define FOLLY_DISABLE_THREAD_SANITIZER \
__attribute__((no_sanitize_thread, noinline)) __attribute__((no_sanitize_thread, noinline))
#else #else
...@@ -121,12 +121,12 @@ ...@@ -121,12 +121,12 @@
* across the different compilers (e.g. clang, gcc) * across the different compilers (e.g. clang, gcc)
*/ */
#ifndef FOLLY_SANITIZE_MEMORY #ifndef FOLLY_SANITIZE_MEMORY
#if FOLLY_HAS_FEATURE(memory_sanitizer) || __SANITIZE_MEMORY__ #if FOLLY_HAS_FEATURE(memory_sanitizer) || defined(__SANITIZE_MEMORY__)
#define FOLLY_SANITIZE_MEMORY 1 #define FOLLY_SANITIZE_MEMORY 1
#endif #endif
#endif #endif
#if FOLLY_SANITIZE_MEMORY #ifdef FOLLY_SANITIZE_MEMORY
#define FOLLY_DISABLE_MEMORY_SANITIZER \ #define FOLLY_DISABLE_MEMORY_SANITIZER \
__attribute__((no_sanitize_memory, noinline)) __attribute__((no_sanitize_memory, noinline))
#else #else
......
...@@ -2545,7 +2545,7 @@ operator<<( ...@@ -2545,7 +2545,7 @@ operator<<(
typename basic_fbstring<E, T, A, S>::value_type, typename basic_fbstring<E, T, A, S>::value_type,
typename basic_fbstring<E, T, A, S>::traits_type>& os, typename basic_fbstring<E, T, A, S>::traits_type>& os,
const basic_fbstring<E, T, A, S>& str) { const basic_fbstring<E, T, A, S>& str) {
#if _LIBCPP_VERSION #ifdef _LIBCPP_VERSION
typedef std::basic_ostream< typedef std::basic_ostream<
typename basic_fbstring<E, T, A, S>::value_type, typename basic_fbstring<E, T, A, S>::value_type,
typename basic_fbstring<E, T, A, S>::traits_type> typename basic_fbstring<E, T, A, S>::traits_type>
......
...@@ -678,7 +678,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> { ...@@ -678,7 +678,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> {
// not copyable // not copyable
Function(const Function&) = delete; Function(const Function&) = delete;
#if __OBJC__ #ifdef __OBJC__
// Make sure Objective C blocks are copied // Make sure Objective C blocks are copied
template <class ReturnType, class... Args> template <class ReturnType, class... Args>
/*implicit*/ Function(ReturnType (^objCBlock)(Args... args)) /*implicit*/ Function(ReturnType (^objCBlock)(Args... args))
...@@ -766,7 +766,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> { ...@@ -766,7 +766,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> {
Function& operator=(const Function&) = delete; Function& operator=(const Function&) = delete;
#if __OBJC__ #ifdef __OBJC__
// Make sure Objective C blocks are copied // Make sure Objective C blocks are copied
template <class ReturnType, class... Args> template <class ReturnType, class... Args>
/* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) { /* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) {
......
...@@ -46,7 +46,7 @@ constexpr bool kHasUnalignedAccess = false; ...@@ -46,7 +46,7 @@ constexpr bool kHasUnalignedAccess = false;
// msvc should come first, so if clang is in msvc mode it gets the right defines // msvc should come first, so if clang is in msvc mode it gets the right defines
// NOTE: this will only do checking in msvc with versions that support /analyze // NOTE: this will only do checking in msvc with versions that support /analyze
#if _MSC_VER #ifdef _MSC_VER
#ifdef _USE_ATTRIBUTES_FOR_SAL #ifdef _USE_ATTRIBUTES_FOR_SAL
#undef _USE_ATTRIBUTES_FOR_SAL #undef _USE_ATTRIBUTES_FOR_SAL
#endif #endif
...@@ -143,7 +143,7 @@ constexpr bool kIsSanitizeAddress = true; ...@@ -143,7 +143,7 @@ constexpr bool kIsSanitizeAddress = true;
constexpr bool kIsSanitizeAddress = false; constexpr bool kIsSanitizeAddress = false;
#endif #endif
#if FOLLY_SANITIZE_THREAD #ifdef FOLLY_SANITIZE_THREAD
constexpr bool kIsSanitizeThread = true; constexpr bool kIsSanitizeThread = true;
#else #else
constexpr bool kIsSanitizeThread = false; constexpr bool kIsSanitizeThread = false;
...@@ -220,7 +220,7 @@ constexpr bool kIsSanitize = false; ...@@ -220,7 +220,7 @@ constexpr bool kIsSanitize = false;
// It turns out that GNU libstdc++ and LLVM libc++ differ on how they implement // It turns out that GNU libstdc++ and LLVM libc++ differ on how they implement
// the 'std' namespace; the latter uses inline namespaces. Wrap this decision // the 'std' namespace; the latter uses inline namespaces. Wrap this decision
// up in a macro to make forward-declarations easier. // up in a macro to make forward-declarations easier.
#if FOLLY_USE_LIBCPP #ifdef FOLLY_USE_LIBCPP
#include <__config> // @manual #include <__config> // @manual
#define FOLLY_NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD #define FOLLY_NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
#define FOLLY_NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD #define FOLLY_NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD
...@@ -366,6 +366,8 @@ constexpr auto kHasWeakSymbols = false; ...@@ -366,6 +366,8 @@ constexpr auto kHasWeakSymbols = false;
#ifndef FOLLY_NEON #ifndef FOLLY_NEON
#if defined(__ARM_NEON) || defined(__ARM_NEON__) #if defined(__ARM_NEON) || defined(__ARM_NEON__)
#define FOLLY_NEON 1 #define FOLLY_NEON 1
#else
#define FOLLY_NEON 0
#endif #endif
#endif #endif
...@@ -423,7 +425,7 @@ constexpr bool const kHasRtti = FOLLY_HAS_RTTI; ...@@ -423,7 +425,7 @@ constexpr bool const kHasRtti = FOLLY_HAS_RTTI;
namespace folly { namespace folly {
#if __OBJC__ #ifdef __OBJC__
constexpr auto kIsObjC = true; constexpr auto kIsObjC = true;
#else #else
constexpr auto kIsObjC = false; constexpr auto kIsObjC = false;
...@@ -476,7 +478,7 @@ constexpr auto kGlibcxxAssertions = true; ...@@ -476,7 +478,7 @@ constexpr auto kGlibcxxAssertions = true;
constexpr auto kGlibcxxAssertions = false; constexpr auto kGlibcxxAssertions = false;
#endif #endif
#if _LIBCPP_VERSION #ifdef _LIBCPP_VERSION
constexpr auto kIsLibcpp = true; constexpr auto kIsLibcpp = true;
#else #else
constexpr auto kIsLibcpp = false; constexpr auto kIsLibcpp = false;
...@@ -488,7 +490,7 @@ constexpr auto kIsLibstdcpp = true; ...@@ -488,7 +490,7 @@ constexpr auto kIsLibstdcpp = true;
constexpr auto kIsLibstdcpp = false; constexpr auto kIsLibstdcpp = false;
#endif #endif
#if _MSC_VER #ifdef _MSC_VER
constexpr auto kMscVer = _MSC_VER; constexpr auto kMscVer = _MSC_VER;
#else #else
constexpr auto kMscVer = 0; constexpr auto kMscVer = 0;
...@@ -508,7 +510,7 @@ constexpr auto kIsClang = false; ...@@ -508,7 +510,7 @@ constexpr auto kIsClang = false;
constexpr auto kClangVerMajor = 0; constexpr auto kClangVerMajor = 0;
#endif #endif
#if FOLLY_MICROSOFT_ABI_VER #ifdef FOLLY_MICROSOFT_ABI_VER
constexpr auto kMicrosoftAbiVer = FOLLY_MICROSOFT_ABI_VER; constexpr auto kMicrosoftAbiVer = FOLLY_MICROSOFT_ABI_VER;
#else #else
constexpr auto kMicrosoftAbiVer = 0; constexpr auto kMicrosoftAbiVer = 0;
...@@ -516,7 +518,7 @@ constexpr auto kMicrosoftAbiVer = 0; ...@@ -516,7 +518,7 @@ constexpr auto kMicrosoftAbiVer = 0;
// cpplib is an implementation of the standard library, and is the one typically // cpplib is an implementation of the standard library, and is the one typically
// used with the msvc compiler // used with the msvc compiler
#if _CPPLIB_VER #ifdef _CPPLIB_VER
constexpr auto kCpplibVer = _CPPLIB_VER; constexpr auto kCpplibVer = _CPPLIB_VER;
#else #else
constexpr auto kCpplibVer = 0; constexpr auto kCpplibVer = 0;
...@@ -534,7 +536,7 @@ constexpr auto kCpplibVer = 0; ...@@ -534,7 +536,7 @@ constexpr auto kCpplibVer = 0;
// FOLLY_STORAGE_CONSTEXPR int const num = 3; // FOLLY_STORAGE_CONSTEXPR int const num = 3;
// //
// True as of MSVC 2017. // True as of MSVC 2017.
#if _MSC_VER #ifdef _MSC_VER
#define FOLLY_STORAGE_CONSTEXPR #define FOLLY_STORAGE_CONSTEXPR
#else #else
#define FOLLY_STORAGE_CONSTEXPR constexpr #define FOLLY_STORAGE_CONSTEXPR constexpr
......
...@@ -1486,7 +1486,7 @@ constexpr Range<char const*> operator"" _sp( ...@@ -1486,7 +1486,7 @@ constexpr Range<char const*> operator"" _sp(
return Range<char const*>(str, len); return Range<char const*>(str, len);
} }
#if __cpp_char8_t >= 201811L #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
constexpr Range<char8_t const*> operator"" _sp( constexpr Range<char8_t const*> operator"" _sp(
char8_t const* str, size_t len) noexcept { char8_t const* str, size_t len) noexcept {
return Range<char8_t const*>(str, len); return Range<char8_t const*>(str, len);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
namespace folly { namespace folly {
#if LIBEVENT_VERSION_NUMBER <= 0x02010101 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER <= 0x02010101
#define FOLLY_LIBEVENT_COMPAT_PLUCK(name) ev_##name #define FOLLY_LIBEVENT_COMPAT_PLUCK(name) ev_##name
#define FOLLY_LIBEVENT_COMPAT_PLUCK2(name) ev_##name #define FOLLY_LIBEVENT_COMPAT_PLUCK2(name) ev_##name
#else #else
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
namespace folly { namespace folly {
#if __cpp_lib_bit_cast #ifdef __cpp_lib_bit_cast
using std::bit_cast; using std::bit_cast;
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
// solve that by pretending we have it here in the header and // solve that by pretending we have it here in the header and
// then enable our implementation on the source side so that // then enable our implementation on the source side so that
// gets linked in instead. // gets linked in instead.
#if __MACH__ && \ #if defined(__MACH__) && \
((!defined(TARGET_OS_OSX) || TARGET_OS_OSX) && \ ((!defined(TARGET_OS_OSX) || TARGET_OS_OSX) && \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)) || \ (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)) || \
(TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)) (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE != 0 && \
(__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0))
#ifdef FOLLY_HAVE_CLOCK_GETTIME #ifdef FOLLY_HAVE_CLOCK_GETTIME
#undef FOLLY_HAVE_CLOCK_GETTIME #undef FOLLY_HAVE_CLOCK_GETTIME
......
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