Commit 96c62e34 authored by James Donald's avatar James Donald Committed by Facebook Github Bot

Make defined(_MSC_VER) checks consistent for -Wundef

Summary: Note: also making the `__GNUC__ || __clang__` nearby part in Pretty.h the same so that the header doesn't appear inconsistent, likewise for Hardware.h

Reviewed By: yfeldblum

Differential Revision: D19237732

fbshipit-source-id: bf3270ddf2102ea722be1eb1a557234d264f9af7
parent f9956e1c
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
#endif #endif
// attribute hidden // attribute hidden
#if _MSC_VER #if defined(_MSC_VER)
#define FOLLY_ATTR_VISIBILITY_HIDDEN #define FOLLY_ATTR_VISIBILITY_HIDDEN
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define FOLLY_ATTR_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden"))) #define FOLLY_ATTR_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden")))
......
...@@ -306,7 +306,7 @@ template < ...@@ -306,7 +306,7 @@ template <
!std::is_reference<To>::value || std::is_reference<From>::value>::type> !std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); using SafeResultOf = decltype(static_cast<To>(std::declval<From>()));
#if _MSC_VER #if defined(_MSC_VER)
// Need a workaround for MSVC to avoid the inscrutable error: // Need a workaround for MSVC to avoid the inscrutable error:
// //
// folly\function.h(...) : fatal error C1001: An internal error has // folly\function.h(...) : fatal error C1001: An internal error has
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
#if _MSC_VER #if defined(_MSC_VER)
extern "C" std::uint64_t __rdtsc(); extern "C" std::uint64_t __rdtsc();
#pragma intrinsic(__rdtsc) #pragma intrinsic(__rdtsc)
#endif #endif
...@@ -29,9 +29,9 @@ extern "C" std::uint64_t __rdtsc(); ...@@ -29,9 +29,9 @@ extern "C" std::uint64_t __rdtsc();
namespace folly { namespace folly {
inline std::uint64_t hardware_timestamp() { inline std::uint64_t hardware_timestamp() {
#if _MSC_VER #if defined(_MSC_VER)
return __rdtsc(); return __rdtsc();
#elif __GNUC__ && (__i386__ || FOLLY_X64) #elif defined(__GNUC__) && (defined(__i386__) || FOLLY_X64)
return __builtin_ia32_rdtsc(); return __builtin_ia32_rdtsc();
#else #else
// use steady_clock::now() as an approximation for the timestamp counter on // use steady_clock::now() as an approximation for the timestamp counter on
......
...@@ -83,14 +83,14 @@ using pretty_default_tag = std::conditional_t< // ...@@ -83,14 +83,14 @@ using pretty_default_tag = std::conditional_t< //
template <typename T> template <typename T>
static constexpr auto pretty_raw(pretty_tag_msc) { static constexpr auto pretty_raw(pretty_tag_msc) {
#if _MSC_VER #if defined(_MSC_VER)
return pretty_carray_from(__FUNCSIG__); return pretty_carray_from(__FUNCSIG__);
#endif #endif
} }
template <typename T> template <typename T>
static constexpr auto pretty_raw(pretty_tag_gcc) { static constexpr auto pretty_raw(pretty_tag_gcc) {
#if __GNUC__ || __clang__ #if defined(__GNUC__) || defined(__clang__)
return pretty_carray_from(__PRETTY_FUNCTION__); return pretty_carray_from(__PRETTY_FUNCTION__);
#endif #endif
} }
......
...@@ -126,7 +126,7 @@ constexpr auto is_atomic<std::atomic<Integer>> = true; ...@@ -126,7 +126,7 @@ constexpr auto is_atomic<std::atomic<Integer>> = true;
#if FOLLY_X64 #if FOLLY_X64
#if _MSC_VER #if defined(_MSC_VER)
template <typename Integer> template <typename Integer>
inline bool atomic_fetch_set_x86( inline bool atomic_fetch_set_x86(
......
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