🚨 fix warnings

This commit is contained in:
Niels Lohmann 2021-10-20 14:19:45 +02:00
parent d90b6bc721
commit 03a75d58fc
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
6 changed files with 34 additions and 22 deletions

View File

@ -25,13 +25,13 @@
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
}
} // namespace nlohmann::detail
#else
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
}
} // namespace nlohmann::detail
#endif
#endif

View File

@ -21,13 +21,13 @@
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
}
} // namespace nlohmann::detail
#else
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
}
} // namespace nlohmann::detail
#endif
#endif

View File

@ -147,8 +147,6 @@ struct static_const
static constexpr T value{};
};
template<typename T>
constexpr T static_const<T>::value;
} // namespace detail
} // namespace nlohmann

View File

@ -3314,8 +3314,6 @@ struct static_const
static constexpr T value{};
};
template<typename T>
constexpr T static_const<T>::value;
} // namespace detail
} // namespace nlohmann
@ -3973,13 +3971,13 @@ T conditional_static_cast(U value)
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
}
} // namespace nlohmann::detail
#else
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
}
} // namespace nlohmann::detail
#endif
#endif
@ -4661,13 +4659,13 @@ class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
}
} // namespace nlohmann::detail
#else
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
}
} // namespace nlohmann::detail
#endif
#endif

View File

@ -205,7 +205,7 @@ TEST_CASE("regression tests 1")
// check if the actual value was stored
CHECK(j2 == 102);
static_assert(std::is_same<decltype(anon_enum_value), decltype(u)>::value, "");
static_assert(std::is_same<decltype(anon_enum_value), decltype(u)>::value, "types must be the same");
j.push_back(json::object(
{

View File

@ -48,18 +48,34 @@ using ordered_json = nlohmann::ordered_json;
#ifdef JSON_HAS_CPP_17
#include <variant>
// set JSON_STD_FILESYSTEM_EXPERIMENTAL to 1 if <experimental/filesystem> should be taken instead of <filesystem>
#if defined(__cpp_lib_filesystem)
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
#elif defined(__cpp_lib_experimental_filesystem)
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 1
#elif !defined(__has_include)
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 1
#elif __has_include(<filesystem>)
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
#elif __has_include(<experimental/filesystem>)
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 1
#else
#define JSON_STD_FILESYSTEM_EXPERIMENTAL 0
#endif
#if JSON_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::experimental::filesystem;
}
} // namespace nlohmann::detail
#else
#include <filesystem>
namespace nlohmann::detail
{
namespace std_fs = std::filesystem;
}
} // namespace nlohmann::detail
#endif
#endif
@ -504,15 +520,15 @@ TEST_CASE("regression tests 2")
SECTION("issue #1805 - A pair<T1, T2> is json constructible only if T1 and T2 are json constructible")
{
static_assert(!std::is_constructible<json, std::pair<std::string, NotSerializableData>>::value, "");
static_assert(!std::is_constructible<json, std::pair<NotSerializableData, std::string>>::value, "");
static_assert(std::is_constructible<json, std::pair<int, std::string>>::value, "");
static_assert(!std::is_constructible<json, std::pair<std::string, NotSerializableData>>::value, "unexpected result");
static_assert(!std::is_constructible<json, std::pair<NotSerializableData, std::string>>::value, "unexpected result");
static_assert(std::is_constructible<json, std::pair<int, std::string>>::value, "unexpected result");
}
SECTION("issue #1825 - A tuple<Args..> is json constructible only if all T in Args are json constructible")
{
static_assert(!std::is_constructible<json, std::tuple<std::string, NotSerializableData>>::value, "");
static_assert(!std::is_constructible<json, std::tuple<NotSerializableData, std::string>>::value, "");
static_assert(std::is_constructible<json, std::tuple<int, std::string>>::value, "");
static_assert(!std::is_constructible<json, std::tuple<std::string, NotSerializableData>>::value, "unexpected result");
static_assert(!std::is_constructible<json, std::tuple<NotSerializableData, std::string>>::value, "unexpected result");
static_assert(std::is_constructible<json, std::tuple<int, std::string>>::value, "unexpected result");
}
SECTION("issue #1983 - JSON patch diff for op=add formation is not as per standard (RFC 6902)")
@ -709,7 +725,7 @@ TEST_CASE("regression tests 2")
SECTION("issue #2825 - Properly constrain the basic_json conversion operator")
{
static_assert(std::is_copy_assignable<nlohmann::ordered_json>::value, "");
static_assert(std::is_copy_assignable<nlohmann::ordered_json>::value, "ordered_json must be copy assignable");
}
SECTION("issue #2958 - Inserting in unordered json using a pointer retains the leading slash")