From 1aea60c686b833fc4001146f1524eba8562dc5db Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 10 Dec 2023 06:23:10 +0700 Subject: [PATCH] fix new clang-tidy warnings --- develop/singles/headers/meta.hpp/meta_all.hpp | 18 +++++++++++++++--- develop/vendors/vmath.hpp | 2 +- headers/.clang-format | 1 - headers/.clangd | 4 +++- .../meta.hpp/meta_detail/state_registry.hpp | 1 + headers/meta.hpp/meta_detail/type_registry.hpp | 1 + .../meta_detail/value_utilities/uarg.hpp | 8 +++++--- .../meta_detail/value_utilities/uinst.hpp | 2 ++ headers/meta.hpp/meta_registry.hpp | 3 +++ headers/meta.hpp/meta_ucast/ucast.hpp | 1 + headers/meta.hpp/meta_uvalue.hpp | 1 + headers/meta.hpp/meta_uvalue/uvalue.hpp | 1 + 12 files changed, 34 insertions(+), 9 deletions(-) diff --git a/develop/singles/headers/meta.hpp/meta_all.hpp b/develop/singles/headers/meta.hpp/meta_all.hpp index 35e7fd1..120be76 100644 --- a/develop/singles/headers/meta.hpp/meta_all.hpp +++ b/develop/singles/headers/meta.hpp/meta_all.hpp @@ -1839,6 +1839,7 @@ namespace meta_hpp external, }; + // NOLINTNEXTLINE(*-union-access) struct storage_u final { union { internal_storage_t internal; @@ -4166,6 +4167,7 @@ namespace meta_hpp::detail public: template < typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_type(F&& f) const { const locker lock; @@ -4355,6 +4357,7 @@ namespace meta_hpp::detail public: template < typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_scope(F&& f) const { const locker lock; @@ -4400,6 +4403,7 @@ namespace meta_hpp::detail namespace meta_hpp { template < type_family Type = any_type, typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_type(F&& f) { using namespace detail; type_registry& registry = type_registry::instance(); @@ -4418,6 +4422,7 @@ namespace meta_hpp } template < typename T > + // NOLINTNEXTLINE(*-missing-std-forward) [[nodiscard]] auto resolve_type(T&&) { using namespace detail; type_registry& registry = type_registry::instance(); @@ -4442,6 +4447,7 @@ namespace meta_hpp namespace meta_hpp { template < typename T > + // NOLINTNEXTLINE(*-missing-std-forward) [[nodiscard]] auto resolve_poly_type(T&& from) { using namespace detail; @@ -5984,6 +5990,7 @@ namespace meta_hpp::detail template < typename T, typename Tp = std::decay_t > requires(!uvalue_family) + // NOLINTNEXTLINE(*-missing-std-forward) explicit uarg_base(type_registry& registry, T&&) : uarg_base{registry, type_list{}} {} @@ -6005,6 +6012,7 @@ namespace meta_hpp::detail : ref_type_{ref_types::const_lvalue} , raw_type_{v.get_type()} {} + // NOLINTNEXTLINE(*-param-not-moved) explicit uarg_base(type_registry&, uvalue&& v) : ref_type_{ref_types::rvalue} , raw_type_{v.get_type()} {} @@ -6326,9 +6334,9 @@ namespace meta_hpp::detail template < typename ArgTypeList, typename F > auto unchecked_call_with_uargs(type_registry& registry, std::span args, F&& f) { META_HPP_DEV_ASSERT(args.size() == type_list_arity_v); - return [args, ®istry, &f](std::index_sequence) { - return f(args[Is].cast>(registry)...); - }(std::make_index_sequence>()); + return [args, ®istry](auto&& captured_f, std::index_sequence) { + return std::invoke(META_HPP_FWD(captured_f), args[Is].cast>(registry)...); + }(META_HPP_FWD(f), std::make_index_sequence>()); } } @@ -6584,6 +6592,7 @@ namespace meta_hpp::detail template < typename T, typename Tp = std::decay_t > requires(!uvalue_family) + // NOLINTNEXTLINE(*-missing-std-forward) explicit uinst_base(type_registry& registry, T&&) : uinst_base{registry, type_list{}} {} @@ -6605,6 +6614,7 @@ namespace meta_hpp::detail : ref_type_{ref_types::const_lvalue} , raw_type_{v.get_type()} {} + // NOLINTNEXTLINE(*-param-not-moved) explicit uinst_base(type_registry&, uvalue&& v) : ref_type_{ref_types::rvalue} , raw_type_{v.get_type()} {} @@ -9392,6 +9402,7 @@ namespace meta_hpp template < typename To, typename From > requires detail::lvalue_reference_ucast_kind + // NOLINTNEXTLINE(*-missing-std-forward) To ucast(From&& from) { using from_data_type = std::remove_reference_t; using to_data_type = std::remove_reference_t; @@ -9715,6 +9726,7 @@ namespace meta_hpp static vtable_t table{ .type = resolve_type(), + // NOLINTNEXTLINE(*-param-not-moved) .move{[](uvalue&& self, uvalue& to) noexcept { META_HPP_DEV_ASSERT(!to); META_HPP_DEV_ASSERT(self); diff --git a/develop/vendors/vmath.hpp b/develop/vendors/vmath.hpp index fd8dfef..ed47c53 160000 --- a/develop/vendors/vmath.hpp +++ b/develop/vendors/vmath.hpp @@ -1 +1 @@ -Subproject commit fd8dfef29bbafa82d958c5b122bbd4fd12a05fc6 +Subproject commit ed47c535f70c6a05a3bd5a65a90400c3843dfefc diff --git a/headers/.clang-format b/headers/.clang-format index 6c67fc1..949177c 100644 --- a/headers/.clang-format +++ b/headers/.clang-format @@ -21,7 +21,6 @@ ConstructorInitializerIndentWidth: 0 FixNamespaceComments: false IndentPPDirectives: AfterHash IndentWidth: 4 -LambdaBodyIndentation: OuterScope NamespaceIndentation: All PackConstructorInitializers: Never PenaltyBreakAssignment: 100 diff --git a/headers/.clangd b/headers/.clangd index 6f8c17b..ee7fbc7 100644 --- a/headers/.clangd +++ b/headers/.clangd @@ -1,4 +1,6 @@ Diagnostics: + UnusedIncludes: None + MissingIncludes: None ClangTidy: Add: - bugprone-* @@ -20,7 +22,7 @@ Diagnostics: - misc-unused-using-decls - modernize-use-trailing-return-type - readability-identifier-length - - readability-named-parameter`` + - readability-named-parameter - readability-redundant-access-specifiers - readability-simplify-boolean-expr - readability-use-anyofallof diff --git a/headers/meta.hpp/meta_detail/state_registry.hpp b/headers/meta.hpp/meta_detail/state_registry.hpp index be41fcc..09066e9 100644 --- a/headers/meta.hpp/meta_detail/state_registry.hpp +++ b/headers/meta.hpp/meta_detail/state_registry.hpp @@ -37,6 +37,7 @@ namespace meta_hpp::detail public: template < typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_scope(F&& f) const { const locker lock; diff --git a/headers/meta.hpp/meta_detail/type_registry.hpp b/headers/meta.hpp/meta_detail/type_registry.hpp index 17fd94f..3cfc756 100644 --- a/headers/meta.hpp/meta_detail/type_registry.hpp +++ b/headers/meta.hpp/meta_detail/type_registry.hpp @@ -37,6 +37,7 @@ namespace meta_hpp::detail public: template < typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_type(F&& f) const { const locker lock; diff --git a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp index dcf0aa9..ffcf7e7 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uarg.hpp @@ -36,6 +36,7 @@ namespace meta_hpp::detail template < typename T, typename Tp = std::decay_t > requires(!uvalue_family) + // NOLINTNEXTLINE(*-missing-std-forward) explicit uarg_base(type_registry& registry, T&&) : uarg_base{registry, type_list{}} {} @@ -57,6 +58,7 @@ namespace meta_hpp::detail : ref_type_{ref_types::const_lvalue} , raw_type_{v.get_type()} {} + // NOLINTNEXTLINE(*-param-not-moved) explicit uarg_base(type_registry&, uvalue&& v) : ref_type_{ref_types::rvalue} , raw_type_{v.get_type()} {} @@ -378,8 +380,8 @@ namespace meta_hpp::detail template < typename ArgTypeList, typename F > auto unchecked_call_with_uargs(type_registry& registry, std::span args, F&& f) { META_HPP_DEV_ASSERT(args.size() == type_list_arity_v); - return [args, ®istry, &f](std::index_sequence) { - return f(args[Is].cast>(registry)...); - }(std::make_index_sequence>()); + return [args, ®istry](auto&& captured_f, std::index_sequence) { + return std::invoke(META_HPP_FWD(captured_f), args[Is].cast>(registry)...); + }(META_HPP_FWD(f), std::make_index_sequence>()); } } diff --git a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp index 99b559f..ec3087d 100644 --- a/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp +++ b/headers/meta.hpp/meta_detail/value_utilities/uinst.hpp @@ -36,6 +36,7 @@ namespace meta_hpp::detail template < typename T, typename Tp = std::decay_t > requires(!uvalue_family) + // NOLINTNEXTLINE(*-missing-std-forward) explicit uinst_base(type_registry& registry, T&&) : uinst_base{registry, type_list{}} {} @@ -57,6 +58,7 @@ namespace meta_hpp::detail : ref_type_{ref_types::const_lvalue} , raw_type_{v.get_type()} {} + // NOLINTNEXTLINE(*-param-not-moved) explicit uinst_base(type_registry&, uvalue&& v) : ref_type_{ref_types::rvalue} , raw_type_{v.get_type()} {} diff --git a/headers/meta.hpp/meta_registry.hpp b/headers/meta.hpp/meta_registry.hpp index a44ecd5..d96803a 100644 --- a/headers/meta.hpp/meta_registry.hpp +++ b/headers/meta.hpp/meta_registry.hpp @@ -17,6 +17,7 @@ namespace meta_hpp { template < type_family Type = any_type, typename F > + // NOLINTNEXTLINE(*-missing-std-forward) void for_each_type(F&& f) { using namespace detail; type_registry& registry = type_registry::instance(); @@ -35,6 +36,7 @@ namespace meta_hpp } template < typename T > + // NOLINTNEXTLINE(*-missing-std-forward) [[nodiscard]] auto resolve_type(T&&) { using namespace detail; type_registry& registry = type_registry::instance(); @@ -59,6 +61,7 @@ namespace meta_hpp namespace meta_hpp { template < typename T > + // NOLINTNEXTLINE(*-missing-std-forward) [[nodiscard]] auto resolve_poly_type(T&& from) { using namespace detail; diff --git a/headers/meta.hpp/meta_ucast/ucast.hpp b/headers/meta.hpp/meta_ucast/ucast.hpp index 79fc77a..a28e713 100644 --- a/headers/meta.hpp/meta_ucast/ucast.hpp +++ b/headers/meta.hpp/meta_ucast/ucast.hpp @@ -50,6 +50,7 @@ namespace meta_hpp template < typename To, typename From > requires detail::lvalue_reference_ucast_kind + // NOLINTNEXTLINE(*-missing-std-forward) To ucast(From&& from) { using from_data_type = std::remove_reference_t; using to_data_type = std::remove_reference_t; diff --git a/headers/meta.hpp/meta_uvalue.hpp b/headers/meta.hpp/meta_uvalue.hpp index 589d575..7323d4c 100644 --- a/headers/meta.hpp/meta_uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue.hpp @@ -129,6 +129,7 @@ namespace meta_hpp external, }; + // NOLINTNEXTLINE(*-union-access) struct storage_u final { union { internal_storage_t internal; diff --git a/headers/meta.hpp/meta_uvalue/uvalue.hpp b/headers/meta.hpp/meta_uvalue/uvalue.hpp index bf11cd1..5118004 100644 --- a/headers/meta.hpp/meta_uvalue/uvalue.hpp +++ b/headers/meta.hpp/meta_uvalue/uvalue.hpp @@ -162,6 +162,7 @@ namespace meta_hpp static vtable_t table{ .type = resolve_type(), + // NOLINTNEXTLINE(*-param-not-moved) .move{[](uvalue&& self, uvalue& to) noexcept { META_HPP_DEV_ASSERT(!to); META_HPP_DEV_ASSERT(self);