mirror of
https://github.com/nlohmann/json.git
synced 2025-04-19 13:02:16 +03:00
Fix compilation failure and warnings with NVHPC (#4744)
* 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * ⚗️ enable ranges support Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🔥 remove ci_nvhpc job Signed-off-by: Niels Lohmann <mail@nlohmann.me> * ⚗️ enable ranges support Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🔥 remove ci_nvhpc job Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
parent
96c1b52f1c
commit
88c92e605c
@ -76,6 +76,7 @@ violations will result in a failed build.
|
|||||||
| GNU 13.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
| GNU 13.3.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||||
| GNU 14.2.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
| GNU 14.2.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||||
| GNU 14.2.0 | arm64 | Linux 6.1.100 | Cirrus CI |
|
| GNU 14.2.0 | arm64 | Linux 6.1.100 | Cirrus CI |
|
||||||
|
| icpc (ICC) 2021.5.0 20211109 | x86_64 | Ubuntu 20.04.3 LTS | GitHub |
|
||||||
| MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor |
|
| MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor |
|
||||||
| MSVC 19.16.27035.0 | x86 | Windows-10 (Build 14393) | AppVeyor |
|
| MSVC 19.16.27035.0 | x86 | Windows-10 (Build 14393) | AppVeyor |
|
||||||
| MSVC 19.29.30157.0 | x86 | Windows 10 (Build 17763) | GitHub |
|
| MSVC 19.29.30157.0 | x86 | Windows 10 (Build 17763) | GitHub |
|
||||||
|
@ -973,9 +973,9 @@ class binary_writer
|
|||||||
if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
|
if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
|
||||||
{
|
{
|
||||||
JSON_THROW(out_of_range::create(409, concat("BSON key cannot contain code point U+0000 (at byte ", std::to_string(it), ")"), &j));
|
JSON_THROW(out_of_range::create(409, concat("BSON key cannot contain code point U+0000 (at byte ", std::to_string(it), ")"), &j));
|
||||||
static_cast<void>(j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static_cast<void>(j);
|
||||||
return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
|
return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16712,9 +16712,9 @@ class binary_writer
|
|||||||
if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
|
if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
|
||||||
{
|
{
|
||||||
JSON_THROW(out_of_range::create(409, concat("BSON key cannot contain code point U+0000 (at byte ", std::to_string(it), ")"), &j));
|
JSON_THROW(out_of_range::create(409, concat("BSON key cannot contain code point U+0000 (at byte ", std::to_string(it), ")"), &j));
|
||||||
static_cast<void>(j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static_cast<void>(j);
|
||||||
return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
|
return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +955,8 @@ TEST_CASE("iterators 2")
|
|||||||
};
|
};
|
||||||
json j_expected{"a_key", "b_key", "c_key"};
|
json j_expected{"a_key", "b_key", "c_key"};
|
||||||
|
|
||||||
auto transformed = j.items() | std::views::transform([](const auto & item)
|
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||||
|
auto transformed = j.items() | std::views::transform([](const auto & item) -> std::string_view
|
||||||
{
|
{
|
||||||
return item.key();
|
return item.key();
|
||||||
});
|
});
|
||||||
|
@ -566,7 +566,7 @@ TEST_CASE("regression tests 2")
|
|||||||
const auto length = 300;
|
const auto length = 300;
|
||||||
|
|
||||||
json dump_test;
|
json dump_test;
|
||||||
dump_test["1"] = std::string(length, -1);
|
dump_test["1"] = std::string(length, static_cast<std::string::value_type>(-1));
|
||||||
|
|
||||||
std::string expected = R"({"1":")";
|
std::string expected = R"({"1":")";
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
@ -583,7 +583,7 @@ TEST_CASE("regression tests 2")
|
|||||||
const auto length = 500;
|
const auto length = 500;
|
||||||
|
|
||||||
json dump_test;
|
json dump_test;
|
||||||
dump_test["1"] = std::string(length, -2);
|
dump_test["1"] = std::string(length, static_cast<std::string::value_type>(-2));
|
||||||
|
|
||||||
std::string expected = R"({"1":")";
|
std::string expected = R"({"1":")";
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
|
@ -841,7 +841,7 @@ class Evil
|
|||||||
public:
|
public:
|
||||||
Evil() = default;
|
Evil() = default;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Evil(T t) : m_i(sizeof(t))
|
Evil(const T& t) : m_i(sizeof(t))
|
||||||
{
|
{
|
||||||
static_cast<void>(t); // fix MSVC's C4100 warning
|
static_cast<void>(t); // fix MSVC's C4100 warning
|
||||||
}
|
}
|
||||||
@ -863,6 +863,10 @@ TEST_CASE("Issue #924")
|
|||||||
// silence Wunused-template warnings
|
// silence Wunused-template warnings
|
||||||
Evil e(1);
|
Evil e(1);
|
||||||
CHECK(e.m_i >= 0);
|
CHECK(e.m_i >= 0);
|
||||||
|
|
||||||
|
// suppress warning: function "<unnamed>::Evil::Evil(T) [with T=std::string]" was declared but never referenced [declared_but_not_referenced]
|
||||||
|
Evil e2(std::string("foo"));
|
||||||
|
CHECK(e2.m_i >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Issue #1237")
|
TEST_CASE("Issue #1237")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user