🚨 fix warning

This commit is contained in:
Niels Lohmann 2021-10-20 20:23:54 +02:00
parent 7543e179ef
commit 7e87863a6d
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
4 changed files with 68 additions and 47 deletions

View File

@ -24,6 +24,13 @@ The diagnostics messages can also be controlled with the CMake option `JSON_Diag
The library targets C++11, but also supports some features introduced in later C++ versions (e.g., `std::string_view` support for C++17). For these new features, the library implements some preprocessor checks to determine the C++ standard. By defining any of these symbols, the internal check is overridden and the provided C++ version is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be detected incorrectly. The library targets C++11, but also supports some features introduced in later C++ versions (e.g., `std::string_view` support for C++17). For these new features, the library implements some preprocessor checks to determine the C++ standard. By defining any of these symbols, the internal check is overridden and the provided C++ version is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be detected incorrectly.
## `JSON_HAS_FILESYSTEM`, `JSON_HAS_EXPERIMENTAL_FILESYSTEM`
When compiling with C++17, the library provides conversions from and to `std::filesystem::path`. As compiler support
for filesystem is limited, the library tries to detect whether `<filesystem>`/`std::filesystem` (`JSON_HAS_FILESYSTEM`)
or `<experimental/filesystem>`/`std::experimental::filesystem` (`JSON_HAS_EXPERIMENTAL_FILESYSTEM`) should be used.
To override the built-in check, define `JSON_HAS_FILESYSTEM` or `JSON_HAS_EXPERIMENTAL_FILESYSTEM` to `1`.
## `JSON_NOEXCEPTION` ## `JSON_NOEXCEPTION`
Exceptions can be switched off by defining the symbol `JSON_NOEXCEPTION`. Exceptions can be switched off by defining the symbol `JSON_NOEXCEPTION`.

View File

@ -37,7 +37,8 @@
#define JSON_HAS_CPP_11 #define JSON_HAS_CPP_11
#endif #endif
#ifdef JSON_HAS_CPP_17 #if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)
#ifdef JSON_HAS_CPP_17
#if defined(__cpp_lib_filesystem) #if defined(__cpp_lib_filesystem)
#define JSON_HAS_FILESYSTEM 1 #define JSON_HAS_FILESYSTEM 1
#elif defined(__cpp_lib_experimental_filesystem) #elif defined(__cpp_lib_experimental_filesystem)
@ -55,6 +56,7 @@
#undef JSON_HAS_FILESYSTEM #undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif #endif
#endif
#endif #endif
#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM #ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM

View File

@ -2325,7 +2325,8 @@ using is_detected_convertible =
#define JSON_HAS_CPP_11 #define JSON_HAS_CPP_11
#endif #endif
#ifdef JSON_HAS_CPP_17 #if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)
#ifdef JSON_HAS_CPP_17
#if defined(__cpp_lib_filesystem) #if defined(__cpp_lib_filesystem)
#define JSON_HAS_FILESYSTEM 1 #define JSON_HAS_FILESYSTEM 1
#elif defined(__cpp_lib_experimental_filesystem) #elif defined(__cpp_lib_experimental_filesystem)
@ -2343,6 +2344,7 @@ using is_detected_convertible =
#undef JSON_HAS_FILESYSTEM #undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif #endif
#endif
#endif #endif
#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM #ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM

View File

@ -49,6 +49,7 @@ using ordered_json = nlohmann::ordered_json;
#ifdef JSON_HAS_CPP_17 #ifdef JSON_HAS_CPP_17
#include <variant> #include <variant>
#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)
#if defined(__cpp_lib_filesystem) #if defined(__cpp_lib_filesystem)
#define JSON_HAS_FILESYSTEM 1 #define JSON_HAS_FILESYSTEM 1
#elif defined(__cpp_lib_experimental_filesystem) #elif defined(__cpp_lib_experimental_filesystem)
@ -66,6 +67,15 @@ using ordered_json = nlohmann::ordered_json;
#undef JSON_HAS_FILESYSTEM #undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif #endif
#endif
#endif
#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0
#endif
#ifndef JSON_HAS_FILESYSTEM
#define JSON_HAS_FILESYSTEM 0
#endif #endif
#if JSON_HAS_EXPERIMENTAL_FILESYSTEM #if JSON_HAS_EXPERIMENTAL_FILESYSTEM