From b155f5cd987c1fdf5454890ce35f98847c863287 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 10 Dec 2023 05:23:15 +0700 Subject: [PATCH] fix new clang-tidy warnings --- .vscode/settings.json | 3 +- develop/.clangd | 3 -- .../singles/headers/vmath.hpp/vmath_all.hpp | 46 +++++++++++-------- headers/.clangd | 5 +- headers/vmath.hpp/vmath_ext.hpp | 2 +- headers/vmath.hpp/vmath_mat.hpp | 2 + headers/vmath.hpp/vmath_mat_fun.hpp | 16 +++---- headers/vmath.hpp/vmath_qua.hpp | 2 + headers/vmath.hpp/vmath_vec.hpp | 2 + headers/vmath.hpp/vmath_vec_fun.hpp | 22 ++++----- 10 files changed, 56 insertions(+), 47 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b862290..5f7c7a3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,8 @@ "files.trimTrailingWhitespace": true }, "clangd.arguments": [ - "--header-insertion=never" + "--header-insertion=never", + "--compile-commands-dir=${workspaceFolder}/develop/.cdb" ], "cmake.copyCompileCommands": "${workspaceFolder}/develop/.cdb/compile_commands.json" } diff --git a/develop/.clangd b/develop/.clangd index f0c9788..ac96b97 100644 --- a/develop/.clangd +++ b/develop/.clangd @@ -5,6 +5,3 @@ Diagnostics: - modernize-* - performance-* - readability-* - -CompileFlags: - CompilationDatabase: .cdb diff --git a/develop/singles/headers/vmath.hpp/vmath_all.hpp b/develop/singles/headers/vmath.hpp/vmath_all.hpp index 3dd8db2..5348abb 100644 --- a/develop/singles/headers/vmath.hpp/vmath_all.hpp +++ b/develop/singles/headers/vmath.hpp/vmath_all.hpp @@ -738,6 +738,7 @@ namespace vmath_hpp using base_type::vec_base; using base_type::operator[]; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(vec& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < Size; ++i ) { using std::swap; @@ -824,6 +825,7 @@ namespace vmath_hpp // swap template < typename T, std::size_t Size > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(vec& l, vec& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } @@ -834,7 +836,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -844,7 +846,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -855,7 +857,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, typename C, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, const vec& c, @@ -867,7 +869,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, typename C, typename D, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, const vec& c, @@ -880,7 +882,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) A init, const vec& b, std::index_sequence) @@ -891,7 +893,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t I, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -902,7 +904,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -912,7 +914,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -923,7 +925,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -933,7 +935,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -944,7 +946,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_plus_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -2153,6 +2155,7 @@ namespace vmath_hpp using base_type::mat_base; using base_type::rows; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(mat& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < Size; ++i ) { using std::swap; @@ -2247,6 +2250,7 @@ namespace vmath_hpp // swap template < typename T, std::size_t Size > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(mat& l, mat& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } @@ -2257,7 +2261,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -2267,7 +2271,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -2278,7 +2282,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) A init, const mat& b, std::index_sequence) @@ -2289,7 +2293,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -2299,7 +2303,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -2310,7 +2314,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -2320,7 +2324,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -2331,7 +2335,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_plus_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const mat& b, std::index_sequence) @@ -3100,6 +3104,7 @@ namespace vmath_hpp using base_type::qua_base; using base_type::operator[]; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(qua& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < size; ++i ) { using std::swap; @@ -3166,6 +3171,7 @@ namespace vmath_hpp // swap template < typename T > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(qua& l, qua& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } @@ -3571,7 +3577,7 @@ namespace vmath_hpp::detail { struct hash_combiner { template < typename T > - [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) noexcept { + [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) const noexcept { return (seed ^= std::hash{}(x) + 0x9e3779b9 + (seed << 6) + ( seed >> 2)); } }; diff --git a/headers/.clangd b/headers/.clangd index c3b7c74..13e5578 100644 --- a/headers/.clangd +++ b/headers/.clangd @@ -1,4 +1,6 @@ Diagnostics: + UnusedIncludes: None + MissingIncludes: None ClangTidy: Add: - bugprone-* @@ -24,6 +26,3 @@ Diagnostics: - readability-named-parameter - readability-redundant-access-specifiers - readability-uppercase-literal-suffix - -CompileFlags: - CompilationDatabase: ../develop/.cdb diff --git a/headers/vmath.hpp/vmath_ext.hpp b/headers/vmath.hpp/vmath_ext.hpp index 6a41393..18b9c41 100644 --- a/headers/vmath.hpp/vmath_ext.hpp +++ b/headers/vmath.hpp/vmath_ext.hpp @@ -63,7 +63,7 @@ namespace vmath_hpp::detail { struct hash_combiner { template < typename T > - [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) noexcept { + [[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) const noexcept { return (seed ^= std::hash{}(x) + 0x9e3779b9 + (seed << 6) + ( seed >> 2)); } }; diff --git a/headers/vmath.hpp/vmath_mat.hpp b/headers/vmath.hpp/vmath_mat.hpp index 4731a97..a6fe5a6 100644 --- a/headers/vmath.hpp/vmath_mat.hpp +++ b/headers/vmath.hpp/vmath_mat.hpp @@ -262,6 +262,7 @@ namespace vmath_hpp using base_type::mat_base; using base_type::rows; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(mat& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < Size; ++i ) { using std::swap; @@ -356,6 +357,7 @@ namespace vmath_hpp // swap template < typename T, std::size_t Size > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(mat& l, mat& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } diff --git a/headers/vmath.hpp/vmath_mat_fun.hpp b/headers/vmath.hpp/vmath_mat_fun.hpp index 055a510..f10f4de 100644 --- a/headers/vmath.hpp/vmath_mat_fun.hpp +++ b/headers/vmath.hpp/vmath_mat_fun.hpp @@ -19,7 +19,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -29,7 +29,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -40,7 +40,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) A init, const mat& b, std::index_sequence) @@ -51,7 +51,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -61,7 +61,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -72,7 +72,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, std::index_sequence) { @@ -82,7 +82,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const mat& a, const mat& b, std::index_sequence) @@ -93,7 +93,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_plus_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const mat& b, std::index_sequence) diff --git a/headers/vmath.hpp/vmath_qua.hpp b/headers/vmath.hpp/vmath_qua.hpp index 092fac8..67bb7bb 100644 --- a/headers/vmath.hpp/vmath_qua.hpp +++ b/headers/vmath.hpp/vmath_qua.hpp @@ -90,6 +90,7 @@ namespace vmath_hpp using base_type::qua_base; using base_type::operator[]; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(qua& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < size; ++i ) { using std::swap; @@ -156,6 +157,7 @@ namespace vmath_hpp // swap template < typename T > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(qua& l, qua& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } diff --git a/headers/vmath.hpp/vmath_vec.hpp b/headers/vmath.hpp/vmath_vec.hpp index be20a46..493efb8 100644 --- a/headers/vmath.hpp/vmath_vec.hpp +++ b/headers/vmath.hpp/vmath_vec.hpp @@ -182,6 +182,7 @@ namespace vmath_hpp using base_type::vec_base; using base_type::operator[]; + // NOLINTNEXTLINE(*-noexcept-swap) void swap(vec& other) noexcept(std::is_nothrow_swappable_v) { for ( std::size_t i = 0; i < Size; ++i ) { using std::swap; @@ -268,6 +269,7 @@ namespace vmath_hpp // swap template < typename T, std::size_t Size > + // NOLINTNEXTLINE(*-noexcept-swap) void swap(vec& l, vec& r) noexcept(noexcept(l.swap(r))) { l.swap(r); } diff --git a/headers/vmath.hpp/vmath_vec_fun.hpp b/headers/vmath.hpp/vmath_vec_fun.hpp index ec36e60..a1981f8 100644 --- a/headers/vmath.hpp/vmath_vec_fun.hpp +++ b/headers/vmath.hpp/vmath_vec_fun.hpp @@ -16,7 +16,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -26,7 +26,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -37,7 +37,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, typename C, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, const vec& c, @@ -49,7 +49,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, typename C, typename D, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto map_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, const vec& c, @@ -62,7 +62,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) A init, const vec& b, std::index_sequence) @@ -73,7 +73,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t I, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -84,7 +84,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -94,7 +94,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_and_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -105,7 +105,7 @@ namespace vmath_hpp::detail::impl template < typename A, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, std::index_sequence) { @@ -115,7 +115,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_or_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence) @@ -126,7 +126,7 @@ namespace vmath_hpp::detail::impl template < typename A, typename B, std::size_t Size, typename F, std::size_t... Is > [[nodiscard]] constexpr VMATH_HPP_FORCE_INLINE auto fold1_plus_join_impl( - F&& f, + F&& f, // NOLINT(*-missing-std-forward) const vec& a, const vec& b, std::index_sequence)