add clang support in JSON_HAS_CPP_17 macro

This commit is contained in:
chenguoping 2020-06-04 20:18:41 +08:00
parent 9212590764
commit 0e93f81ba4
5 changed files with 32 additions and 12 deletions

View File

@ -20,10 +20,15 @@
#endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
// fix for issue #464
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \
(defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0)
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
(defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \
(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4)
#define JSON_HAS_CPP_14
#endif

View File

@ -2048,10 +2048,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP
#endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
// fix for issue #464
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \
(defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0)
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
(defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \
(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4)
#define JSON_HAS_CPP_14
#endif

View File

@ -41,11 +41,15 @@ using nlohmann::json;
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
// fix for issue #464
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \
(defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0)
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
(defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \
(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4)
#define JSON_HAS_CPP_14
#endif

View File

@ -31,11 +31,15 @@ SOFTWARE.
#include <nlohmann/json.hpp>
using nlohmann::json;
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
// fix for issue #464
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \
(defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0)
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
(defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \
(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4)
#define JSON_HAS_CPP_14
#endif

View File

@ -43,8 +43,10 @@ using nlohmann::json;
#include <list>
#include <cstdio>
#include <test_data.hpp>
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
// fix for issue #464
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \
(defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0)
#define JSON_HAS_CPP_17
#endif