fix some tidy test warnings

This commit is contained in:
BlackMATov
2022-04-11 02:34:29 +07:00
parent 14b6391490
commit 04dae2799f
12 changed files with 35 additions and 41 deletions

View File

@@ -2,6 +2,7 @@
Checks: '-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
clang-analyzer-*,

View File

@@ -5,7 +5,6 @@
"--clang-tidy",
"--compile-commands-dir=${workspaceFolder}/.clangd",
"--completion-style=detailed",
"--cross-file-rename",
"--header-insertion=never"
],
"cmake.copyCompileCommands": "${workspaceFolder}/.clangd/compile_commands.json"

View File

@@ -1,18 +1,13 @@
---
Checks: '-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
clang-analyzer-*,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-special-member-functions,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,

View File

@@ -1,18 +1,13 @@
---
Checks: '-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
clang-analyzer-*,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-special-member-functions,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,

View File

@@ -11,8 +11,8 @@ namespace
struct A {
A() = default;
A(A&&) = default;
A(const A&) = default;
[[maybe_unused]] A(A&&) = default;
[[maybe_unused]]A(const A&) = default;
A& operator=(A&&) = delete;
A& operator=(const A&) = delete;

View File

@@ -18,8 +18,8 @@ namespace
int x{};
int y{};
explicit ivec2(int v) : x{v}, y{v} {}
ivec2(int x, int y) : x{x}, y{y} {}
[[maybe_unused]] explicit ivec2(int v) : x{v}, y{v} {}
[[maybe_unused]] ivec2(int x, int y) : x{x}, y{y} {}
ivec2& add(const ivec2& other) noexcept {
x += other.x;

View File

@@ -10,7 +10,7 @@ namespace
{
struct class_t {
class_t() = default;
class_t(int i): member_v{i} {}
[[maybe_unused]] class_t(int i): member_v{i} {}
int member_v{};
void method_v() {}

View File

@@ -39,7 +39,7 @@ namespace
float base_clazz_2::base_variable_2 = 2.0f;
struct derived_clazz : base_clazz_1, base_clazz_2 {
derived_clazz(int i, float f)
[[maybe_unused]] derived_clazz(int i, float f)
: base_clazz_1{i}
, base_clazz_2{f} {}

View File

@@ -12,8 +12,8 @@ namespace
A() = default;
virtual ~A() = default;
A(A&&) noexcept { ++move_ctors_; }
A(const A&) { ++copy_ctors_; }
[[maybe_unused]] A(A&&) noexcept { ++move_ctors_; }
[[maybe_unused]] A(const A&) { ++copy_ctors_; }
A& operator=(A&&) = delete;
A& operator=(const A&) = delete;

View File

@@ -20,8 +20,8 @@ namespace
int x{};
int y{};
explicit ivec2(int v) : x{v}, y{v} {}
ivec2(int x, int y) : x{x}, y{y} {}
[[maybe_unused]] explicit ivec2(int v) : x{v}, y{v} {}
[[maybe_unused]] ivec2(int x, int y) : x{x}, y{y} {}
ivec2& add(const ivec2& other) noexcept {
x += other.x;

View File

@@ -13,10 +13,11 @@ namespace
int y{};
ivec2() = delete;
explicit ivec2(int v): x{v}, y{v} {}
ivec2(int x, int y): x{x}, y{y} {}
ivec2(ivec2&& other) noexcept
[[maybe_unused]] explicit ivec2(int v): x{v}, y{v} {}
[[maybe_unused]] ivec2(int x, int y): x{x}, y{y} {}
[[maybe_unused]] ivec2(ivec2&& other) noexcept
: x{other.x}
, y{other.y} {
other.x = 0;
@@ -24,7 +25,7 @@ namespace
++move_constructor_counter;
}
ivec2(const ivec2& other) noexcept
[[maybe_unused]] ivec2(const ivec2& other) noexcept
: x{other.x}
, y{other.y} {
++copy_constructor_counter;
@@ -49,10 +50,11 @@ namespace
int dummy[42]{};
ivec2_big() = delete;
explicit ivec2_big(int v): x{v}, y{v} {}
ivec2_big(int x, int y): x{x}, y{y} {}
ivec2_big(ivec2_big&& other) noexcept
[[maybe_unused]] explicit ivec2_big(int v): x{v}, y{v} {}
[[maybe_unused]] ivec2_big(int x, int y): x{x}, y{y} {}
[[maybe_unused]] ivec2_big(ivec2_big&& other) noexcept
: x{other.x}
, y{other.y} {
other.x = 0;
@@ -60,7 +62,7 @@ namespace
++move_constructor_counter;
}
ivec2_big(const ivec2_big& other) noexcept
[[maybe_unused]] ivec2_big(const ivec2_big& other) noexcept
: x{other.x}
, y{other.y} {
++copy_constructor_counter;

View File

@@ -13,10 +13,11 @@ namespace
int y{};
ivec2() = delete;
explicit ivec2(int v): x{v}, y{v} {}
ivec2(int x, int y): x{x}, y{y} {}
ivec2(ivec2&& other) noexcept
[[maybe_unused]] explicit ivec2(int v): x{v}, y{v} {}
[[maybe_unused]] ivec2(int x, int y): x{x}, y{y} {}
[[maybe_unused]] ivec2(ivec2&& other) noexcept
: x{other.x}
, y{other.y} {
other.x = 0;
@@ -24,7 +25,7 @@ namespace
++move_constructor_counter;
}
ivec2(const ivec2& other) noexcept
[[maybe_unused]] ivec2(const ivec2& other) noexcept
: x{other.x}
, y{other.y} {
++copy_constructor_counter;
@@ -49,8 +50,9 @@ namespace
int z{};
ivec3() = delete;
explicit ivec3(int v): x{v}, y{v}, z{v} {}
ivec3(int x, int y, int z): x{x}, y{y}, z{z} {}
[[maybe_unused]] explicit ivec3(int v): x{v}, y{v}, z{v} {}
[[maybe_unused]] ivec3(int x, int y, int z): x{x}, y{y}, z{z} {}
};
int ivec2::move_constructor_counter{0};