Fixed error C2766 with flag /Zc:__cplusplus on VS2017+ (fixes #1250)

This commit is contained in:
Benoit Blanchon
2020-04-28 09:11:46 +02:00
parent daa279d57b
commit 959b1d9e4c
3 changed files with 13 additions and 6 deletions

View File

@ -6,6 +6,7 @@ HEAD
* CMake: don't build tests when imported in another project * CMake: don't build tests when imported in another project
* CMake: made project arch-independent * CMake: made project arch-independent
* Visual Studio: fixed error C2766 with flag `/Zc:__cplusplus` (issue #1250)
v6.15.1 (2020-04-08) v6.15.1 (2020-04-08)
------- -------

View File

@ -70,6 +70,12 @@ if(MSVC)
/W4 # Set warning level /W4 # Set warning level
/WX # Treats all compiler warnings as errors. /WX # Treats all compiler warnings as errors.
) )
if (NOT MSVC_VERSION LESS 1910) # >= Visual Studio 2017
add_compile_options(
/Zc:__cplusplus # Enable updated __cplusplus macro
)
endif()
endif() endif()
include_directories(Helpers) include_directories(Helpers)

View File

@ -4,12 +4,6 @@
#pragma once #pragma once
#if defined(_MSC_VER)
#define ARDUINOJSON_HAS_INT64 1
#else
#define ARDUINOJSON_HAS_INT64 0
#endif
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#define ARDUINOJSON_HAS_LONG_LONG 1 #define ARDUINOJSON_HAS_LONG_LONG 1
#define ARDUINOJSON_HAS_NULLPTR 1 #define ARDUINOJSON_HAS_NULLPTR 1
@ -20,6 +14,12 @@
#define ARDUINOJSON_HAS_RVALUE_REFERENCES 0 #define ARDUINOJSON_HAS_RVALUE_REFERENCES 0
#endif #endif
#if defined(_MSC_VER) && !ARDUINOJSON_HAS_LONG_LONG
#define ARDUINOJSON_HAS_INT64 1
#else
#define ARDUINOJSON_HAS_INT64 0
#endif
// Small or big machine? // Small or big machine?
#ifndef ARDUINOJSON_EMBEDDED_MODE #ifndef ARDUINOJSON_EMBEDDED_MODE
#if defined(ARDUINO) /* Arduino*/ \ #if defined(ARDUINO) /* Arduino*/ \