Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 fix Clang-Tidy warnings #3739

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/nlohmann/detail/macro_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@

#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }

/*!
@brief macro
Expand All @@ -409,7 +409,7 @@

#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }


// inspired from https://stackoverflow.com/a/26745591
Expand Down
4 changes: 2 additions & 2 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2748,7 +2748,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP

#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }

/*!
@brief macro
Expand All @@ -2761,7 +2761,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP

#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }


// inspired from https://stackoverflow.com/a/26745591
Expand Down
2 changes: 1 addition & 1 deletion tests/src/unit-assert_macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEST_CASE("JSON_ASSERT(x)")
assert_counter = 0;
CHECK(assert_counter == 0);

const json::iterator it;
const json::iterator it{};
json j;

// in case assertions do not abort execution, an exception is thrown
Expand Down
167 changes: 82 additions & 85 deletions tests/src/unit-bjdata.cpp

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions tests/src/unit-capacity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ TEST_CASE("capacity")
{
SECTION("boolean")
{
json j = true;
const json j_const(j);
json j = true; // NOLINT(misc-const-correctness)
const json j_const = true;

SECTION("result of empty")
{
Expand All @@ -36,8 +36,8 @@ TEST_CASE("capacity")

SECTION("string")
{
json j = "hello world";
const json j_const(j);
json j = "hello world"; // NOLINT(misc-const-correctness)
const json j_const = "hello world";

SECTION("result of empty")
{
Expand All @@ -56,8 +56,8 @@ TEST_CASE("capacity")
{
SECTION("empty array")
{
json j = json::array();
const json j_const(j);
json j = json::array(); // NOLINT(misc-const-correctness)
const json j_const = json::array();

SECTION("result of empty")
{
Expand All @@ -74,8 +74,8 @@ TEST_CASE("capacity")

SECTION("filled array")
{
json j = {1, 2, 3};
const json j_const(j);
json j = {1, 2, 3}; // NOLINT(misc-const-correctness)
const json j_const = {1, 2, 3};

SECTION("result of empty")
{
Expand All @@ -95,8 +95,8 @@ TEST_CASE("capacity")
{
SECTION("empty object")
{
json j = json::object();
const json j_const(j);
json j = json::object(); // NOLINT(misc-const-correctness)
const json j_const = json::object();

SECTION("result of empty")
{
Expand All @@ -113,8 +113,8 @@ TEST_CASE("capacity")

SECTION("filled object")
{
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
const json j_const(j);
json j = {{"one", 1}, {"two", 2}, {"three", 3}}; // NOLINT(misc-const-correctness)
const json j_const = {{"one", 1}, {"two", 2}, {"three", 3}};

SECTION("result of empty")
{
Expand All @@ -132,8 +132,8 @@ TEST_CASE("capacity")

SECTION("number (integer)")
{
json j = -23;
const json j_const(j);
json j = -23; // NOLINT(misc-const-correctness)
const json j_const = -23;

SECTION("result of empty")
{
Expand All @@ -150,8 +150,8 @@ TEST_CASE("capacity")

SECTION("number (unsigned)")
{
json j = 23u;
const json j_const(j);
json j = 23u; // NOLINT(misc-const-correctness)
const json j_const = 23u;

SECTION("result of empty")
{
Expand All @@ -168,8 +168,8 @@ TEST_CASE("capacity")

SECTION("number (float)")
{
json j = 23.42;
const json j_const(j);
json j = 23.42; // NOLINT(misc-const-correctness)
const json j_const = 23.42;

SECTION("result of empty")
{
Expand All @@ -186,8 +186,8 @@ TEST_CASE("capacity")

SECTION("null")
{
json j = nullptr;
const json j_const(j);
json j = nullptr; // NOLINT(misc-const-correctness)
const json j_const = nullptr;

SECTION("result of empty")
{
Expand All @@ -207,8 +207,8 @@ TEST_CASE("capacity")
{
SECTION("boolean")
{
json j = true;
const json j_const(j);
json j = true; // NOLINT(misc-const-correctness)
const json j_const = true;

SECTION("result of size")
{
Expand All @@ -227,8 +227,8 @@ TEST_CASE("capacity")

SECTION("string")
{
json j = "hello world";
const json j_const(j);
json j = "hello world"; // NOLINT(misc-const-correctness)
const json j_const = "hello world";

SECTION("result of size")
{
Expand All @@ -249,8 +249,8 @@ TEST_CASE("capacity")
{
SECTION("empty array")
{
json j = json::array();
const json j_const(j);
json j = json::array(); // NOLINT(misc-const-correctness)
const json j_const = json::array();

SECTION("result of size")
{
Expand All @@ -269,8 +269,8 @@ TEST_CASE("capacity")

SECTION("filled array")
{
json j = {1, 2, 3};
const json j_const(j);
json j = {1, 2, 3}; // NOLINT(misc-const-correctness)
const json j_const = {1, 2, 3};

SECTION("result of size")
{
Expand All @@ -292,8 +292,8 @@ TEST_CASE("capacity")
{
SECTION("empty object")
{
json j = json::object();
const json j_const(j);
json j = json::object(); // NOLINT(misc-const-correctness)
const json j_const = json::object();

SECTION("result of size")
{
Expand All @@ -312,8 +312,8 @@ TEST_CASE("capacity")

SECTION("filled object")
{
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
const json j_const(j);
json j = {{"one", 1}, {"two", 2}, {"three", 3}}; // NOLINT(misc-const-correctness)
const json j_const = {{"one", 1}, {"two", 2}, {"three", 3}};

SECTION("result of size")
{
Expand All @@ -333,8 +333,8 @@ TEST_CASE("capacity")

SECTION("number (integer)")
{
json j = -23;
const json j_const(j);
json j = -23; // NOLINT(misc-const-correctness)
const json j_const = -23;

SECTION("result of size")
{
Expand All @@ -353,8 +353,8 @@ TEST_CASE("capacity")

SECTION("number (unsigned)")
{
json j = 23u;
const json j_const(j);
json j = 23u; // NOLINT(misc-const-correctness)
const json j_const = 23u;

SECTION("result of size")
{
Expand All @@ -373,8 +373,8 @@ TEST_CASE("capacity")

SECTION("number (float)")
{
json j = 23.42;
const json j_const(j);
json j = 23.42; // NOLINT(misc-const-correctness)
const json j_const = 23.42;

SECTION("result of size")
{
Expand All @@ -393,8 +393,8 @@ TEST_CASE("capacity")

SECTION("null")
{
json j = nullptr;
const json j_const(j);
json j = nullptr; // NOLINT(misc-const-correctness)
const json j_const = nullptr;

SECTION("result of size")
{
Expand All @@ -416,8 +416,8 @@ TEST_CASE("capacity")
{
SECTION("boolean")
{
json j = true;
const json j_const(j);
json j = true; // NOLINT(misc-const-correctness)
const json j_const = true;

SECTION("result of max_size")
{
Expand All @@ -428,8 +428,8 @@ TEST_CASE("capacity")

SECTION("string")
{
json j = "hello world";
const json j_const(j);
json j = "hello world"; // NOLINT(misc-const-correctness)
const json j_const = "hello world";

SECTION("result of max_size")
{
Expand All @@ -442,8 +442,8 @@ TEST_CASE("capacity")
{
SECTION("empty array")
{
json j = json::array();
const json j_const(j);
json j = json::array(); // NOLINT(misc-const-correctness)
const json j_const = json::array();

SECTION("result of max_size")
{
Expand All @@ -454,8 +454,8 @@ TEST_CASE("capacity")

SECTION("filled array")
{
json j = {1, 2, 3};
const json j_const(j);
json j = {1, 2, 3}; // NOLINT(misc-const-correctness)
const json j_const = {1, 2, 3};

SECTION("result of max_size")
{
Expand All @@ -469,8 +469,8 @@ TEST_CASE("capacity")
{
SECTION("empty object")
{
json j = json::object();
const json j_const(j);
json j = json::object(); // NOLINT(misc-const-correctness)
const json j_const = json::object();

SECTION("result of max_size")
{
Expand All @@ -481,8 +481,8 @@ TEST_CASE("capacity")

SECTION("filled object")
{
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
const json j_const(j);
json j = {{"one", 1}, {"two", 2}, {"three", 3}}; // NOLINT(misc-const-correctness)
const json j_const = {{"one", 1}, {"two", 2}, {"three", 3}};

SECTION("result of max_size")
{
Expand All @@ -494,8 +494,8 @@ TEST_CASE("capacity")

SECTION("number (integer)")
{
json j = -23;
const json j_const(j);
json j = -23; // NOLINT(misc-const-correctness)
const json j_const = -23;

SECTION("result of max_size")
{
Expand All @@ -506,8 +506,8 @@ TEST_CASE("capacity")

SECTION("number (unsigned)")
{
json j = 23u;
const json j_const(j);
json j = 23u; // NOLINT(misc-const-correctness)
const json j_const = 23u;

SECTION("result of max_size")
{
Expand All @@ -518,8 +518,8 @@ TEST_CASE("capacity")

SECTION("number (float)")
{
json j = 23.42;
const json j_const(j);
json j = 23.42; // NOLINT(misc-const-correctness)
const json j_const = 23.42;

SECTION("result of max_size")
{
Expand All @@ -530,8 +530,8 @@ TEST_CASE("capacity")

SECTION("null")
{
json j = nullptr;
const json j_const(j);
json j = nullptr; // NOLINT(misc-const-correctness)
const json j_const = nullptr;

SECTION("result of max_size")
{
Expand Down
Loading