🚨 suppress warnings

This commit is contained in:
Niels Lohmann 2021-08-22 17:56:28 +02:00
parent a78764d44a
commit 200015cb0e
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
4 changed files with 17 additions and 3 deletions

View File

@ -451,7 +451,7 @@ struct is_ordered_map
template <typename C> static one test( decltype(&C::capacity) ) ;
template <typename C> static two test(...);
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) };
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
};
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)

View File

@ -1338,11 +1338,18 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// ordered_json uses a vector internally, so pointers could have
// been invalidated; see https://github.com/nlohmann/json/issues/2962
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning(push )
#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr
#endif
if (detail::is_ordered_map<object_t>::value)
{
set_parents();
return j;
}
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning( pop )
#endif
j.m_parent = this;
#else

View File

@ -3860,7 +3860,7 @@ struct is_ordered_map
template <typename C> static one test( decltype(&C::capacity) ) ;
template <typename C> static two test(...);
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) };
enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
};
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
@ -18739,11 +18739,18 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// ordered_json uses a vector internally, so pointers could have
// been invalidated; see https://github.com/nlohmann/json/issues/2962
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning(push )
#pragma warning(disable : 4127) // ignore warning to replace if with if constexpr
#endif
if (detail::is_ordered_map<object_t>::value)
{
set_parents();
return j;
}
#ifdef JSON_HEDLEY_MSVC_VERSION
#pragma warning( pop )
#endif
j.m_parent = this;
#else

View File

@ -179,7 +179,7 @@ TEST_CASE("Better diagnostics")
{
nlohmann::ordered_json j;
nlohmann::ordered_json j2;
const std::string value = "";
const std::string value;
j["first"] = value;
j["second"] = value;
j2["something"] = j;