Commit 4c227db0 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook GitHub Bot

fix the definition of FOLLY_HAS_STRING_VIEW on Windows

Summary:
Update the check in `folly/Portability.h` to handle more recent versions of
MSVC that do support `__has_include`.  The code on the `__has_include` code
path was checking the value of `__cplusplus` rather than `_MSVC_LANG`.
Microsoft only defines `__cplusplus` correctly when the compiler is invoked
with the `/Zc:__cplusplus` flag.

This updates the code to use the `FOLLY_CPLUSPLUS` macro instead.

Reviewed By: yfeldblum

Differential Revision: D26769080

fbshipit-source-id: e40cfaef967b13d2fe1be2b40a109cb0ed39515a
parent 618db6a4
......@@ -597,13 +597,13 @@ constexpr auto kCpplibVer = 0;
// too heavy to include here. MSVC __has_include support arrived later
// than string_view, so we need an alternate case for it.
#ifdef __has_include
#if __has_include(<string_view>) && __cplusplus >= 201703L
#if __has_include(<string_view>) && FOLLY_CPLUSPLUS >= 201703L
#define FOLLY_HAS_STRING_VIEW 1
#else
#define FOLLY_HAS_STRING_VIEW 0
#endif
#else // __has_include
#if _MSC_VER >= 1910 && (_MSVC_LANG > 201402 || __cplusplus > 201402)
#if _MSC_VER >= 1910 && FOLLY_CPLUSPLUS > 201402
#define FOLLY_HAS_STRING_VIEW 1
#else
#define FOLLY_HAS_STRING_VIEW 0
......
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