Conversation
|
For some reason, the test with Clang9 on Ubuntu is currently failing with a segmentation fault. It would be great if anyone had an idea. |
|
I wonder if we should bother supporting non-conforming C++17 compilers? Or at least we could rely on |
That's what this PR is doing, after the feature test macros, which are supposed to be better indicators. |
|
@nlohmann Looks like it still chooses the |
|
You can run that configuration in Docker with Running it individually, I get: Program received signal SIGSEGV, Segmentation fault. |
#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)
#ifdef JSON_HAS_CPP_17
#if defined(__cpp_lib_filesystem)
#define JSON_HAS_FILESYSTEM 1
#elif defined(__cpp_lib_experimental_filesystem)
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
#elif !defined(__has_include)
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
#elif __has_include(<filesystem>)
#define JSON_HAS_FILESYSTEM 1
#elif __has_include(<experimental/filesystem>)
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
#endif
// std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/
#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
// no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
// no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support
#if defined(__clang_major__) && __clang_major__ < 7
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
// no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support
#if defined(_MSC_VER) && _MSC_VER < 1940
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
// no filesystem support before iOS 13
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
// no filesystem support before macOS Catalina
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
#undef JSON_HAS_FILESYSTEM
#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#endif
#endif
#endif
#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM
#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0
#endif
#ifndef JSON_HAS_FILESYSTEM
#define JSON_HAS_FILESYSTEM 0
#endifWhy do you combine has_include checks with version range checks? As a result, for example on GCC7, there is a more or less working experimental filesystem and has_include should detect this, but in the version range check you just erase results for all has_include checks just because some outdated table from the internet says so. Looks strange. It doesn't bother my projects, I don't pass filesystem path via json and I have defines to override the behaviour, so for me it is still fine. Also duplicating block worth its own header in details. #if JSON_HAS_EXPERIMENTAL_FILESYSTEM
#include <experimental/filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
} // namespace nlohmann::detail
#elif JSON_HAS_FILESYSTEM
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
} // namespace nlohmann::detail
#endif |
|
@YarikTH Thanks for the hints. The current state was a lot of fiddling, and I am currently happy with the way it is. That said, if you have any proposals how to improve, feel free to open a PR. |
The patch is no longer needed as it was similarly patched upstream in nlohmann/json#3101. That patch was then shipped in v3.10.5, which is the version used in Envoy now. Signed-off-by: JP Simard <jp@jpsim.com>
The patch is no longer needed as it was similarly patched upstream in nlohmann/json#3101. That patch was then shipped in v3.10.5, which is the version used in Envoy now. Signed-off-by: JP Simard <jp@jpsim.com>
The patch is no longer needed as it was similarly patched upstream in nlohmann/json#3101. That patch was then shipped in v3.10.5, which is the version used in Envoy now. Signed-off-by: JP Simard <jp@jpsim.com>
The patch is no longer needed as it was similarly patched upstream in nlohmann/json#3101. That patch was then shipped in v3.10.5, which is the version used in Envoy now. Signed-off-by: JP Simard <jp@jpsim.com>
This PR makes sure C++17 is used additionally where the test suite is using C++17 features.
Fixes #3090.