diff --git a/.clang-tidy b/.clang-tidy index b4cdaef..80ca7c8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,6 +2,7 @@ Checks: '-*, bugprone-*, + -bugprone-easily-swappable-parameters, clang-analyzer-*, diff --git a/.vscode/settings.json b/.vscode/settings.json index bc3c697..53d3e94 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" diff --git a/manuals/.clang-tidy b/manuals/.clang-tidy index 7f0ca8e..d67cfbf 100644 --- a/manuals/.clang-tidy +++ b/manuals/.clang-tidy @@ -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, diff --git a/untests/.clang-tidy b/untests/.clang-tidy index 7f0ca8e..d67cfbf 100644 --- a/untests/.clang-tidy +++ b/untests/.clang-tidy @@ -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, diff --git a/untests/meta_features/diamond_tests.cpp b/untests/meta_features/diamond_tests.cpp index d512120..20af1f2 100644 --- a/untests/meta_features/diamond_tests.cpp +++ b/untests/meta_features/diamond_tests.cpp @@ -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; diff --git a/untests/meta_states/metadata_tests.cpp b/untests/meta_states/metadata_tests.cpp index 34c55d8..ec13c0c 100644 --- a/untests/meta_states/metadata_tests.cpp +++ b/untests/meta_states/metadata_tests.cpp @@ -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; diff --git a/untests/meta_types/any_type_tests.cpp b/untests/meta_types/any_type_tests.cpp index 564c890..a5ce3cf 100644 --- a/untests/meta_types/any_type_tests.cpp +++ b/untests/meta_types/any_type_tests.cpp @@ -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() {} diff --git a/untests/meta_types/class_type_tests.cpp b/untests/meta_types/class_type_tests.cpp index c9a9408..aadaa5d 100644 --- a/untests/meta_types/class_type_tests.cpp +++ b/untests/meta_types/class_type_tests.cpp @@ -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} {} diff --git a/untests/meta_utilities/arg2_tests.cpp b/untests/meta_utilities/arg2_tests.cpp index cc1436f..6195a51 100644 --- a/untests/meta_utilities/arg2_tests.cpp +++ b/untests/meta_utilities/arg2_tests.cpp @@ -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; diff --git a/untests/meta_utilities/hash_tests.cpp b/untests/meta_utilities/hash_tests.cpp index c3c2dcd..085f2a9 100644 --- a/untests/meta_utilities/hash_tests.cpp +++ b/untests/meta_utilities/hash_tests.cpp @@ -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; diff --git a/untests/meta_utilities/value2_tests.cpp b/untests/meta_utilities/value2_tests.cpp index cac770a..b91c240 100644 --- a/untests/meta_utilities/value2_tests.cpp +++ b/untests/meta_utilities/value2_tests.cpp @@ -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; diff --git a/untests/meta_utilities/value_tests.cpp b/untests/meta_utilities/value_tests.cpp index febc5a7..0fb4f7d 100644 --- a/untests/meta_utilities/value_tests.cpp +++ b/untests/meta_utilities/value_tests.cpp @@ -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};