From 1b846c9d8191a50c30d63f88a4ae597419ae5735 Mon Sep 17 00:00:00 2001 From: Markus Palonen Date: Tue, 17 Dec 2019 16:25:35 +0200 Subject: [PATCH] Use JSON_HAS_CPP_17 only after it has been defined --- .../nlohmann/detail/conversions/from_json.hpp | 8 ------- .../nlohmann/detail/conversions/to_json.hpp | 8 ------- include/nlohmann/detail/macro_scope.hpp | 8 +++++++ single_include/nlohmann/json.hpp | 24 +++++++------------ 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index ca16c71122..28b10486ae 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -13,14 +13,6 @@ #include // pair, declval #include // valarray -#ifdef JSON_HAS_CPP_17 - #if __has_include() - #include - #elif __has_include() - #include - #endif -#endif - #include #include #include diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index e9a0f6471c..4666833635 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -10,14 +10,6 @@ #include // valarray #include // vector -#ifdef JSON_HAS_CPP_17 - #if __has_include() - #include - #elif __has_include() - #include - #endif -#endif - #include #include #include diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index 27dddc6be7..16200502bf 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -27,6 +27,14 @@ #define JSON_HAS_CPP_14 #endif +#ifdef JSON_HAS_CPP_17 + #if __has_include() + #include + #elif __has_include() + #include + #endif +#endif + // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ba2575b621..4cd8ed9fcb 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -69,14 +69,6 @@ SOFTWARE. #include // pair, declval #include // valarray -#ifdef JSON_HAS_CPP_17 - #if __has_include() - #include - #elif __has_include() - #include - #endif -#endif - // #include @@ -1739,6 +1731,14 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HAS_CPP_14 #endif +#ifdef JSON_HAS_CPP_17 + #if __has_include() + #include + #elif __has_include() + #include + #endif +#endif + // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push @@ -3295,14 +3295,6 @@ constexpr const auto& from_json = detail::static_const::va #include // valarray #include // vector -#ifdef JSON_HAS_CPP_17 - #if __has_include() - #include - #elif __has_include() - #include - #endif -#endif - // #include