mirror of
https://github.com/nlohmann/json.git
synced 2025-04-18 01:57:37 +03:00
Suppress clang-analyzer-webkit.NoUncountedMemberChecker (#4701)
* 🚨 suppress clang-analyzer-webkit.NoUncountedMemberChecker Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 📝 add Clang 20/21 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 suppress invalid misc-const-correctness warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
parent
11a835df85
commit
b477d2b95e
@ -13,6 +13,7 @@ Checks: '*,
|
||||
-boost-use-ranges,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-cert-err58-cpp,
|
||||
-clang-analyzer-webkit.NoUncountedMemberChecker,
|
||||
-concurrency-mt-unsafe,
|
||||
-cppcoreguidelines-avoid-const-or-ref-data-members,
|
||||
-cppcoreguidelines-avoid-do-while,
|
||||
|
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -158,7 +158,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', 'latest']
|
||||
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest']
|
||||
container: silkeh/clang:${{ matrix.compiler }}
|
||||
steps:
|
||||
- name: Install unzip and git
|
||||
|
@ -54,8 +54,9 @@ violations will result in a failed build.
|
||||
| Clang 16.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 17.0.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 18.1.8 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 19.1.6 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 20.0.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 19.1.7 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 20.1.1 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| Clang 21.0.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| GNU 4.8.5 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| GNU 4.9.3 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
| GNU 5.5.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub |
|
||||
|
@ -1247,7 +1247,7 @@ scan_number_done:
|
||||
// we are done scanning a number)
|
||||
unget();
|
||||
|
||||
char* endptr = nullptr; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
char* endptr = nullptr; // NOLINT(misc-const-correctness,cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
errno = 0;
|
||||
|
||||
// try to parse integers first and fall back to floats
|
||||
|
@ -228,7 +228,7 @@ class json_pointer
|
||||
}
|
||||
|
||||
const char* p = s.c_str();
|
||||
char* p_end = nullptr;
|
||||
char* p_end = nullptr; // NOLINT(misc-const-correctness)
|
||||
errno = 0; // strtoull doesn't reset errno
|
||||
const unsigned long long res = std::strtoull(p, &p_end, 10); // NOLINT(runtime/int)
|
||||
if (p == p_end // invalid input or empty string
|
||||
|
@ -8254,7 +8254,7 @@ scan_number_done:
|
||||
// we are done scanning a number)
|
||||
unget();
|
||||
|
||||
char* endptr = nullptr; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
char* endptr = nullptr; // NOLINT(misc-const-correctness,cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
errno = 0;
|
||||
|
||||
// try to parse integers first and fall back to floats
|
||||
@ -14717,7 +14717,7 @@ class json_pointer
|
||||
}
|
||||
|
||||
const char* p = s.c_str();
|
||||
char* p_end = nullptr;
|
||||
char* p_end = nullptr; // NOLINT(misc-const-correctness)
|
||||
errno = 0; // strtoull doesn't reset errno
|
||||
const unsigned long long res = std::strtoull(p, &p_end, 10); // NOLINT(runtime/int)
|
||||
if (p == p_end // invalid input or empty string
|
||||
|
@ -412,7 +412,7 @@ TEST_CASE("constructors")
|
||||
|
||||
SECTION("char[]")
|
||||
{
|
||||
char const s[] {"Hello world"}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const char s[] {"Hello world"}; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
json const j(s);
|
||||
CHECK(j.type() == json::value_t::string);
|
||||
CHECK(j == j_reference);
|
||||
|
@ -270,8 +270,8 @@ TEST_CASE("value conversion")
|
||||
|
||||
SECTION("built-in arrays")
|
||||
{
|
||||
const char str[] = "a string"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[] = {0, 1, 2}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const char str[] = "a string"; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[] = {0, 1, 2}; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
|
||||
const json j2 = nbs;
|
||||
const json j3 = str;
|
||||
@ -360,7 +360,7 @@ TEST_CASE("value conversion")
|
||||
|
||||
SECTION("built-in arrays")
|
||||
{
|
||||
const int nbs[] = {0, 1, 2}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[] = {0, 1, 2}; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
int nbs2[] = {0, 0, 0}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
|
||||
const json j2 = nbs;
|
||||
@ -370,7 +370,7 @@ TEST_CASE("value conversion")
|
||||
|
||||
SECTION("built-in arrays: 2D")
|
||||
{
|
||||
const int nbs[][3] = {{0, 1, 2}, {3, 4, 5}}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[][3] = {{0, 1, 2}, {3, 4, 5}}; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
int nbs2[][3] = {{0, 0, 0}, {0, 0, 0}}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
|
||||
const json j2 = nbs;
|
||||
@ -380,7 +380,7 @@ TEST_CASE("value conversion")
|
||||
|
||||
SECTION("built-in arrays: 3D")
|
||||
{
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
// NOLINTBEGIN(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[][2][3] = {\
|
||||
{{0, 1, 2}, {3, 4, 5}}, \
|
||||
{{10, 11, 12}, {13, 14, 15}}\
|
||||
@ -389,7 +389,7 @@ TEST_CASE("value conversion")
|
||||
{{0, 0, 0}, {0, 0, 0}}, \
|
||||
{{0, 0, 0}, {0, 0, 0}}\
|
||||
};
|
||||
// NOLINTEND(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
// NOLINTEND(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
|
||||
const json j2 = nbs;
|
||||
j2.get_to(nbs2);
|
||||
@ -398,7 +398,7 @@ TEST_CASE("value conversion")
|
||||
|
||||
SECTION("built-in arrays: 4D")
|
||||
{
|
||||
// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
// NOLINTBEGIN(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const int nbs[][2][2][3] = {\
|
||||
{
|
||||
\
|
||||
@ -423,7 +423,7 @@ TEST_CASE("value conversion")
|
||||
{{0, 0, 0}, {0, 0, 0}}\
|
||||
}\
|
||||
};
|
||||
// NOLINTEND(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
// NOLINTEND(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
|
||||
const json j2 = nbs;
|
||||
j2.get_to(nbs2);
|
||||
@ -1591,7 +1591,7 @@ TEST_CASE("value conversion")
|
||||
|
||||
enum class cards {kreuz, pik, herz, karo};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) - false positive
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage,misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) - false positive
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(cards,
|
||||
{
|
||||
{cards::kreuz, "kreuz"},
|
||||
@ -1609,7 +1609,7 @@ enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value)
|
||||
TS_INVALID = -1,
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) - false positive
|
||||
// NOLINTNEXTLINE(misc-const-correctness,misc-use-internal-linkage,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) - false positive
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(TaskState,
|
||||
{
|
||||
{TS_INVALID, nullptr},
|
||||
|
@ -1565,9 +1565,9 @@ TEST_CASE_TEMPLATE("element access 2 (additional value() tests)", Json, nlohmann
|
||||
|
||||
SECTION("const char(&)[] key")
|
||||
{
|
||||
const char key[] = "foo"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key2[] = "baz"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key_notfound[] = "bar"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key[] = "foo"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key2[] = "baz"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key_notfound[] = "bar"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
|
||||
CHECK(j.value(key, "default") == "bar");
|
||||
CHECK(j.value(key, cpstr) == "bar");
|
||||
@ -1699,9 +1699,9 @@ TEST_CASE_TEMPLATE("element access 2 (additional value() tests)", Json, nlohmann
|
||||
|
||||
SECTION("const char(&)[] key")
|
||||
{
|
||||
const char key[] = "foo"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key2[] = "baz"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key_notfound[] = "bar"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key[] = "foo"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key2[] = "baz"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char key_notfound[] = "bar"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
|
||||
CHECK(j.template value<string_t>(key, "default") == "bar");
|
||||
CHECK(j.template value<string_t>(key, cpstr) == "bar");
|
||||
|
@ -656,7 +656,7 @@ TEST_CASE("JSON pointers")
|
||||
SECTION("equality comparison")
|
||||
{
|
||||
const char* ptr_cpstring = "/foo/bar";
|
||||
const char ptr_castring[] = "/foo/bar"; // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
const char ptr_castring[] = "/foo/bar"; // NOLINT(misc-const-correctness,hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
|
||||
std::string ptr_string{"/foo/bar"};
|
||||
auto ptr1 = json::json_pointer(ptr_string);
|
||||
auto ptr2 = json::json_pointer(ptr_string);
|
||||
|
@ -71,7 +71,7 @@ enum class for_1647
|
||||
two
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays): this is a false positive
|
||||
// NOLINTNEXTLINE(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays): this is a false positive
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(for_1647,
|
||||
{
|
||||
{for_1647::one, "one"},
|
||||
@ -388,7 +388,7 @@ struct Example_3810
|
||||
Example_3810() = default;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Example_3810, bla);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Example_3810, bla); // NOLINT(misc-use-internal-linkage)
|
||||
|
||||
TEST_CASE("regression tests 2")
|
||||
{
|
||||
@ -749,7 +749,7 @@ TEST_CASE("regression tests 2")
|
||||
#if __has_include(<span>)
|
||||
SECTION("issue #2546 - parsing containers of std::byte")
|
||||
{
|
||||
const char DATA[] = R"("Hello, world!")"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const char DATA[] = R"("Hello, world!")"; // NOLINT(misc-const-correctness,cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
const auto s = std::as_bytes(std::span(DATA));
|
||||
const json j = json::parse(s);
|
||||
CHECK(j.dump() == "\"Hello, world!\"");
|
||||
|
@ -181,6 +181,7 @@ class person_without_private_data_2
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_without_private_data_2, age, name, metadata)
|
||||
|
||||
class derived_person_without_private_data_2 : public person_without_private_data_2
|
||||
@ -201,6 +202,7 @@ class derived_person_without_private_data_2 : public person_without_private_data
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(derived_person_without_private_data_2, person_without_private_data_2, hair_color)
|
||||
|
||||
class person_without_private_data_3
|
||||
@ -236,6 +238,7 @@ class person_without_private_data_3
|
||||
}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(person_without_private_data_3, age, name, metadata)
|
||||
|
||||
class derived_person_without_private_data_3 : public person_without_private_data_3
|
||||
@ -261,6 +264,7 @@ class derived_person_without_private_data_3 : public person_without_private_data
|
||||
}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(derived_person_without_private_data_3, person_without_private_data_3, hair_color)
|
||||
|
||||
class person_with_private_alphabet
|
||||
@ -387,6 +391,7 @@ class person_with_public_alphabet
|
||||
int z = 0;
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_with_public_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
|
||||
|
||||
class person_without_default_constructor_1
|
||||
@ -425,6 +430,7 @@ class person_without_default_constructor_2
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(person_without_default_constructor_2, name, age)
|
||||
|
||||
class derived_person_only_serialize_public : public person_without_default_constructor_1
|
||||
@ -438,6 +444,7 @@ class derived_person_only_serialize_public : public person_without_default_const
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(derived_person_only_serialize_public, person_without_default_constructor_1, hair_color)
|
||||
|
||||
class derived_person_only_serialize_private : person_without_default_constructor_1
|
||||
|
Loading…
x
Reference in New Issue
Block a user