fix new clang-tidy warnings

This commit is contained in:
BlackMATov
2023-12-10 05:23:15 +07:00
parent 1b7a3358de
commit b155f5cd98
10 changed files with 56 additions and 47 deletions

View File

@@ -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

View File

@@ -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<T>{}(x) + 0x9e3779b9 + (seed << 6) + ( seed >> 2));
}
};

View File

@@ -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<T>) {
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<T, Size>& l, mat<T, Size>& r) noexcept(noexcept(l.swap(r))) {
l.swap(r);
}

View File

@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const mat<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const mat<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const mat<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
const mat<B, Size>& b,
std::index_sequence<Is...>)

View File

@@ -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<T>) {
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<T>& l, qua<T>& r) noexcept(noexcept(l.swap(r))) {
l.swap(r);
}

View File

@@ -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<T>) {
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<T, Size>& l, vec<T, Size>& r) noexcept(noexcept(l.swap(r))) {
l.swap(r);
}

View File

@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const vec<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
const vec<B, Size>& b,
const vec<C, Size>& 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, Size>& a,
const vec<B, Size>& b,
const vec<C, Size>& 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, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
std::index_sequence<I, Is...>)
{
@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const vec<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
std::index_sequence<Is...>)
{
@@ -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, Size>& a,
const vec<B, Size>& b,
std::index_sequence<Is...>)
@@ -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, Size>& a,
const vec<B, Size>& b,
std::index_sequence<Is...>)