From baf6241978156bbb0149338d4ab81c6208540b54 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Wed, 26 Feb 2025 10:07:52 -0700 Subject: [PATCH] :arrow_up: Add support for clang-19 --- .github/workflows/performance_test.yml | 2 +- .github/workflows/unit_tests.yml | 19 +++++-- README.md | 2 +- include/cib/detail/exports.hpp | 8 +-- include/flow/graph_builder.hpp | 8 +-- include/log/env.hpp | 2 +- include/lookup/detail/select.hpp | 8 +-- include/lookup/linear_search_lookup.hpp | 4 +- include/lookup/pseudo_pext_lookup.hpp | 18 +++---- include/lookup/strategies.hpp | 4 +- include/match/and.hpp | 9 ++-- include/match/constant.hpp | 12 ++--- include/match/cost.hpp | 4 +- include/match/negate.hpp | 4 +- include/match/not.hpp | 9 ++-- include/match/ops.hpp | 4 +- include/match/or.hpp | 9 ++-- include/match/predicate.hpp | 4 +- include/match/simplify.hpp | 4 +- include/msg/detail/indexed_builder_common.hpp | 4 +- include/msg/detail/indexed_handler_common.hpp | 5 +- include/msg/field.hpp | 26 +++++----- include/msg/field_matchers.hpp | 50 +++++++++++-------- include/msg/handler.hpp | 4 +- include/msg/message.hpp | 17 +++---- include/msg/send.hpp | 5 +- include/seq/step.hpp | 5 +- test/cib/special_members.hpp | 4 +- test/interrupt/common.hpp | 8 +-- test/log/mipi_encoder.cpp | 11 ++-- 30 files changed, 147 insertions(+), 126 deletions(-) diff --git a/.github/workflows/performance_test.yml b/.github/workflows/performance_test.yml index 02d0d051..d1d5cf1e 100644 --- a/.github/workflows/performance_test.yml +++ b/.github/workflows/performance_test.yml @@ -11,7 +11,7 @@ env: DEBIAN_FRONTEND: noninteractive CMAKE_GENERATOR: Ninja BUILD_TYPE: Release - LLVM_VERSION: 18 + LLVM_VERSION: 19 jobs: performance_test: diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 9d0d25c4..68b411c4 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -13,7 +13,7 @@ env: DEBIAN_FRONTEND: noninteractive CMAKE_GENERATOR: Ninja DEFAULT_CXX_STANDARD: 20 - DEFAULT_LLVM_VERSION: 18 + DEFAULT_LLVM_VERSION: 19 DEFAULT_GCC_VERSION: 13 concurrency: @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: compiler: [clang, gcc] - version: [12, 13, 16, 17, 18] + version: [12, 13, 16, 17, 18, 19] cxx_standard: [20] stdlib: [libstdc++, libc++] build_type: [Debug] @@ -36,6 +36,15 @@ jobs: cc: "clang" cxx: "clang++" cxx_flags: "-stdlib=libstdc++" + - version: 19 + compiler: clang + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 19 + toolchain_root: "/usr/lib/llvm-19" + - version: 19 + compiler: clang + stdlib: libc++ + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 19 && sudo apt install -y libc++-19-dev libc++abi-19-dev + cxx_flags: "-stdlib=libc++" - version: 18 compiler: clang install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 @@ -78,6 +87,8 @@ jobs: cxx: "g++-12" cxx_flags: "" exclude: + - compiler: gcc + version: 19 - compiler: gcc version: 18 - compiler: gcc @@ -282,8 +293,8 @@ jobs: - compiler: clang cc: "clang" cxx: "clang++" - install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 - toolchain_root: "/usr/lib/llvm-18" + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 19 + toolchain_root: "/usr/lib/llvm-19" - compiler: gcc cc: "gcc-13" cxx: "g++-13" diff --git a/README.md b/README.md index 72c75377..70a5041a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ to implement *cib* and others extend *cib*. ## Compiler/Standard support The main branch of *cib* currently uses C++20 and is tested with: -- Clang 14 thru 18 +- Clang 14 thru 19 - GCC 12 thru 13 An older version of *cib* that uses C++17 is tagged at v1.7.0. It diff --git a/include/cib/detail/exports.hpp b/include/cib/detail/exports.hpp index 25969c7b..a06c5f4f 100644 --- a/include/cib/detail/exports.hpp +++ b/include/cib/detail/exports.hpp @@ -12,13 +12,13 @@ template struct service_entry { }; template struct exports : public detail::config_item { - [[nodiscard]] constexpr auto - extends_tuple() const -> stdx::tuple...> { + [[nodiscard]] constexpr auto extends_tuple() const + -> stdx::tuple...> { return {extend{}...}; } - [[nodiscard]] constexpr auto - exports_tuple() const -> stdx::tuple { + [[nodiscard]] constexpr auto exports_tuple() const + -> stdx::tuple { return {}; } }; diff --git a/include/flow/graph_builder.hpp b/include/flow/graph_builder.hpp index 1db4c79f..3d53af17 100644 --- a/include/flow/graph_builder.hpp +++ b/include/flow/graph_builder.hpp @@ -35,8 +35,8 @@ concept is_output_compatible = requires(CTNode n) { template using name_for = typename T::name_t; -[[nodiscard]] constexpr auto edge_size(auto const &nodes, - auto const &edges) -> std::size_t { +[[nodiscard]] constexpr auto edge_size(auto const &nodes, auto const &edges) + -> std::size_t { auto const edge_capacities = transform( [&](N const &) { return edges.fold_left( @@ -134,8 +134,8 @@ struct graph_builder { } template - [[nodiscard]] constexpr static auto - topo_sort(Graph &g) -> std::optional { + [[nodiscard]] constexpr static auto topo_sort(Graph &g) + -> std::optional { stdx::cx_vector ordered_list{}; diff --git a/include/log/env.hpp b/include/log/env.hpp index a445ce14..f11b8183 100644 --- a/include/log/env.hpp +++ b/include/log/env.hpp @@ -66,7 +66,7 @@ template struct for_each_pair> { prop...>, 2 * Is>::value.value, stdx::ct...>, - 2 * Is + 1>::value.value>()>...>; + (2 * Is) + 1>::value.value>()>...>; }; } // namespace detail diff --git a/include/lookup/detail/select.hpp b/include/lookup/detail/select.hpp index 7084003e..0f7f079d 100644 --- a/include/lookup/detail/select.hpp +++ b/include/lookup/detail/select.hpp @@ -24,8 +24,8 @@ constexpr inline auto fallback_select_lt(K lhs, K rhs, T first, T second) -> T { #if defined(__arc__) or defined(_ARC) or defined(_ARCOMPACT) template requires(sizeof(T) <= 4) and (sizeof(K) <= 4) -static inline auto optimized_select(K raw_lhs, K raw_rhs, T first, - T second) -> T { +static inline auto optimized_select(K raw_lhs, K raw_rhs, T first, T second) + -> T { T result = second; auto const lhs = static_cast(raw_lhs); auto const rhs = static_cast(raw_rhs); @@ -45,8 +45,8 @@ static inline auto optimized_select(K raw_lhs, K raw_rhs, T first, template requires(sizeof(T) <= 4) and (sizeof(K) <= 4) -static inline auto optimized_select_lt(K raw_lhs, K raw_rhs, T first, - T second) -> T { +static inline auto optimized_select_lt(K raw_lhs, K raw_rhs, T first, T second) + -> T { T result = second; auto const lhs = static_cast(raw_lhs); auto const rhs = static_cast(raw_rhs); diff --git a/include/lookup/linear_search_lookup.hpp b/include/lookup/linear_search_lookup.hpp index 43c5e079..299fac73 100644 --- a/include/lookup/linear_search_lookup.hpp +++ b/include/lookup/linear_search_lookup.hpp @@ -15,8 +15,8 @@ template struct linear_search_lookup { using key_type = typename Input::key_type; using value_type = typename Input::value_type; - [[nodiscard]] constexpr auto - operator[](key_type key) const -> value_type { + [[nodiscard]] constexpr auto operator[](key_type key) const + -> value_type { value_type result = this->default_value; for (auto [k, v] : this->entries) { result = detail::select(key, k, v, result); diff --git a/include/lookup/pseudo_pext_lookup.hpp b/include/lookup/pseudo_pext_lookup.hpp index c0453277..a660eb6f 100644 --- a/include/lookup/pseudo_pext_lookup.hpp +++ b/include/lookup/pseudo_pext_lookup.hpp @@ -159,8 +159,8 @@ constexpr auto keys_are_unique(std::array const &keys) -> bool { } template -constexpr auto with_mask(T const mask, - std::array const &keys) -> std::array { +constexpr auto with_mask(T const mask, std::array const &keys) + -> std::array { std::array new_keys{}; std::transform(keys.begin(), keys.end(), new_keys.begin(), @@ -182,9 +182,9 @@ constexpr auto get_keys(std::array, S> const &entries) { } template -constexpr auto -remove_cheapest_bit(detail::raw_integral_t mask, - std::array keys) -> detail::raw_integral_t { +constexpr auto remove_cheapest_bit(detail::raw_integral_t mask, + std::array keys) + -> detail::raw_integral_t { using raw_t = detail::raw_integral_t; auto const t_digits = std::numeric_limits::digits; @@ -287,8 +287,8 @@ struct pseudo_pext_lookup { constexpr static Value default_value = Default::value; Storage storage; - [[nodiscard]] constexpr auto - operator[](key_type key) const -> value_type { + [[nodiscard]] constexpr auto operator[](key_type key) const + -> value_type { auto const raw_key = detail::as_raw_integral(key); auto const e = storage[pext_func(raw_key)]; @@ -326,8 +326,8 @@ struct pseudo_pext_lookup { LookupTable lookup_table; Storage storage; - [[nodiscard]] constexpr auto - operator[](key_type key) const -> value_type { + [[nodiscard]] constexpr auto operator[](key_type key) const + -> value_type { auto const raw_key = detail::as_raw_integral(key); auto i = lookup_table[pext_func(raw_key)]; diff --git a/include/lookup/strategies.hpp b/include/lookup/strategies.hpp index 6303c03e..b4b42b5c 100644 --- a/include/lookup/strategies.hpp +++ b/include/lookup/strategies.hpp @@ -9,8 +9,8 @@ namespace lookup { template struct strategies; template <> struct strategies<> { - [[nodiscard]] CONSTEVAL static auto - make(compile_time auto) -> strategy_failed_t { + [[nodiscard]] CONSTEVAL static auto make(compile_time auto) + -> strategy_failed_t { return {}; } }; diff --git a/include/match/and.hpp b/include/match/and.hpp index e3667b6e..d30915a7 100644 --- a/include/match/and.hpp +++ b/include/match/and.hpp @@ -36,8 +36,9 @@ template struct and_t : bin_op_t { } } - [[nodiscard]] friend constexpr auto - tag_invoke(cost_t, std::type_identity) -> std::size_t { + [[nodiscard]] friend constexpr auto tag_invoke(cost_t, + std::type_identity) + -> std::size_t { return cost(std::type_identity{}) + cost(std::type_identity{}) + 1u; } @@ -72,8 +73,8 @@ template struct and_t : bin_op_t { template and_t(L, R) -> and_t; template -[[nodiscard]] constexpr auto operator&(L const &lhs, - R const &rhs) -> match::and_t { +[[nodiscard]] constexpr auto operator&(L const &lhs, R const &rhs) + -> match::and_t { return {lhs, rhs}; } diff --git a/include/match/constant.hpp b/include/match/constant.hpp index 1ce27a8b..88018fb0 100644 --- a/include/match/constant.hpp +++ b/include/match/constant.hpp @@ -23,8 +23,8 @@ struct always_t { } private: - [[nodiscard]] friend constexpr auto tag_invoke(implies_t, auto &&, - always_t) -> bool { + [[nodiscard]] friend constexpr auto tag_invoke(implies_t, auto &&, always_t) + -> bool { return true; } }; @@ -41,13 +41,13 @@ struct never_t { } private: - [[nodiscard]] friend constexpr auto tag_invoke(negate_t, - never_t) -> always_t { + [[nodiscard]] friend constexpr auto tag_invoke(negate_t, never_t) + -> always_t { return {}; } - [[nodiscard]] friend constexpr auto tag_invoke(implies_t, never_t, - auto &&) -> bool { + [[nodiscard]] friend constexpr auto tag_invoke(implies_t, never_t, auto &&) + -> bool { return true; } }; diff --git a/include/match/cost.hpp b/include/match/cost.hpp index 4c9e4b79..ccc11f23 100644 --- a/include/match/cost.hpp +++ b/include/match/cost.hpp @@ -7,8 +7,8 @@ namespace match { constexpr inline class cost_t { - [[nodiscard]] friend constexpr auto - tag_invoke(cost_t, auto const &) -> std::size_t { + [[nodiscard]] friend constexpr auto tag_invoke(cost_t, auto const &) + -> std::size_t { return 1u; } diff --git a/include/match/negate.hpp b/include/match/negate.hpp index 90428d5b..a6da7b12 100644 --- a/include/match/negate.hpp +++ b/include/match/negate.hpp @@ -9,8 +9,8 @@ template struct not_t; constexpr inline class negate_t { template - [[nodiscard]] friend constexpr auto tag_invoke(negate_t, - M const &m) -> not_t { + [[nodiscard]] friend constexpr auto tag_invoke(negate_t, M const &m) + -> not_t { return {m}; } diff --git a/include/match/not.hpp b/include/match/not.hpp index 1c75cc4f..25922909 100644 --- a/include/match/not.hpp +++ b/include/match/not.hpp @@ -44,13 +44,14 @@ template struct not_t { } } - [[nodiscard]] friend constexpr auto - tag_invoke(cost_t, std::type_identity) -> std::size_t { + [[nodiscard]] friend constexpr auto tag_invoke(cost_t, + std::type_identity) + -> std::size_t { return cost(std::type_identity{}) + 1u; } - [[nodiscard]] friend constexpr auto tag_invoke(negate_t, - not_t const &n) -> M { + [[nodiscard]] friend constexpr auto tag_invoke(negate_t, not_t const &n) + -> M { return n.m; } diff --git a/include/match/ops.hpp b/include/match/ops.hpp index 04444882..7f7cf047 100644 --- a/include/match/ops.hpp +++ b/include/match/ops.hpp @@ -30,8 +30,8 @@ template } template -[[nodiscard]] constexpr auto -operator<=>(L const &lhs, R const &rhs) -> std::partial_ordering { +[[nodiscard]] constexpr auto operator<=>(L const &lhs, R const &rhs) + -> std::partial_ordering { auto const l = match::simplify(lhs); auto const r = match::simplify(rhs); auto const x = match::implies(l, r); diff --git a/include/match/or.hpp b/include/match/or.hpp index 789f298d..5d49376f 100644 --- a/include/match/or.hpp +++ b/include/match/or.hpp @@ -35,8 +35,9 @@ template struct or_t : bin_op_t { } } - [[nodiscard]] friend constexpr auto - tag_invoke(cost_t, std::type_identity) -> std::size_t { + [[nodiscard]] friend constexpr auto tag_invoke(cost_t, + std::type_identity) + -> std::size_t { return cost(std::type_identity{}) + cost(std::type_identity{}) + 1u; } @@ -59,8 +60,8 @@ template struct or_t : bin_op_t { template or_t(L, R) -> or_t; template -[[nodiscard]] constexpr auto operator|(L const &lhs, - R const &rhs) -> match::or_t { +[[nodiscard]] constexpr auto operator|(L const &lhs, R const &rhs) + -> match::or_t { return {lhs, rhs}; } diff --git a/include/match/predicate.hpp b/include/match/predicate.hpp index 178b0f7d..903e971c 100644 --- a/include/match/predicate.hpp +++ b/include/match/predicate.hpp @@ -18,8 +18,8 @@ template struct predicate_t { constexpr predicate_t() = default; constexpr explicit(true) predicate_t(P) {} - [[nodiscard]] constexpr auto - operator()(auto const &event) const -> decltype(pred(event)) { + [[nodiscard]] constexpr auto operator()(auto const &event) const + -> decltype(pred(event)) { return pred(event); } diff --git a/include/match/simplify.hpp b/include/match/simplify.hpp index 72c60855..bfba8871 100644 --- a/include/match/simplify.hpp +++ b/include/match/simplify.hpp @@ -7,8 +7,8 @@ namespace match { constexpr inline class simplify_t { template - [[nodiscard]] friend constexpr auto tag_invoke(simplify_t, - M const &m) -> M { + [[nodiscard]] friend constexpr auto tag_invoke(simplify_t, M const &m) + -> M { return m; } diff --git a/include/msg/detail/indexed_builder_common.hpp b/include/msg/detail/indexed_builder_common.hpp index 2bc131fb..a7dc0f3d 100644 --- a/include/msg/detail/indexed_builder_common.hpp +++ b/include/msg/detail/indexed_builder_common.hpp @@ -141,8 +141,8 @@ struct indexed_builder_base { ExtraCallbackArgs...>{new_callbacks}; } - using callback_func_t = auto (*)(MsgBase const &, - ExtraCallbackArgs... args) -> bool; + using callback_func_t = auto (*)(MsgBase const &, ExtraCallbackArgs... args) + -> bool; template constexpr static auto invoke_callback(MsgBase const &data, diff --git a/include/msg/detail/indexed_handler_common.hpp b/include/msg/detail/indexed_handler_common.hpp index 29d982c9..334be319 100644 --- a/include/msg/detail/indexed_handler_common.hpp +++ b/include/msg/detail/indexed_handler_common.hpp @@ -46,8 +46,9 @@ struct indexed_handler : handler_interface { return not index(msg).none(); } - __attribute__((flatten)) auto - handle(MsgBase const &msg, ExtraCallbackArgs... args) const -> bool final { + __attribute__((flatten)) auto handle(MsgBase const &msg, + ExtraCallbackArgs... args) const + -> bool final { auto const callback_candidates = index(msg); bool const handled = transform_reduce( diff --git a/include/msg/field.hpp b/include/msg/field.hpp index 49169551..068a9740 100644 --- a/include/msg/field.hpp +++ b/include/msg/field.hpp @@ -106,13 +106,13 @@ struct bits_locator_t { Index * sizeof(std::uint32_t) / sizeof(elem_t); constexpr auto elem_size = stdx::bit_size(); - constexpr auto max_idx = BaseIndex + Msb / elem_size; - constexpr auto min_idx = BaseIndex + Lsb / elem_size; + constexpr auto max_idx = BaseIndex + (Msb / elem_size); + constexpr auto min_idx = BaseIndex + (Lsb / elem_size); constexpr auto f = []([[maybe_unused]] auto recurse, Rng &&rng, T value) -> T { - constexpr auto current_idx = BaseIndex + CurrentMsb / elem_size; + constexpr auto current_idx = BaseIndex + (CurrentMsb / elem_size); if constexpr (current_idx == max_idx and current_idx == min_idx) { constexpr auto mask = stdx::bit_mask(); @@ -126,7 +126,7 @@ struct bits_locator_t { constexpr auto mask = stdx::bit_mask(); constexpr auto NewMsb = - (CurrentMsb / elem_size) * elem_size - 1u; + (CurrentMsb / elem_size * elem_size) - 1u; MUSTTAIL return recurse.template operator()( recurse, std::forward(rng), std::forward(rng)[current_idx] & mask); @@ -152,13 +152,13 @@ struct bits_locator_t { Index * sizeof(std::uint32_t) / sizeof(elem_t); constexpr auto elem_size = stdx::bit_size(); - [[maybe_unused]] constexpr auto min_idx = BaseIndex + Lsb / elem_size; - [[maybe_unused]] constexpr auto max_idx = BaseIndex + Msb / elem_size; + [[maybe_unused]] constexpr auto min_idx = BaseIndex + (Lsb / elem_size); + [[maybe_unused]] constexpr auto max_idx = BaseIndex + (Msb / elem_size); constexpr auto f = []([[maybe_unused]] auto recurse, Rng &&rng, T value) -> void { - constexpr auto current_idx = BaseIndex + CurrentLsb / elem_size; + constexpr auto current_idx = BaseIndex + (CurrentLsb / elem_size); if constexpr (current_idx == max_idx) { constexpr auto lsb = CurrentLsb % elem_size; @@ -242,8 +242,8 @@ template struct field_locator_t { } template - constexpr static auto insert(R &&r, - typename Spec::type const &value) -> void { + constexpr static auto insert(R &&r, typename Spec::type const &value) + -> void { using raw_t = integral_type_for; auto raw = stdx::bit_cast(value); auto const insert_bits = [&]() { @@ -324,8 +324,8 @@ struct at { lsb_{unit_bit_size(stdx::to_underlying(bi)) + stdx::to_underlying(l)} {} - [[nodiscard]] constexpr auto - index() const -> std::underlying_type_t { + [[nodiscard]] constexpr auto index() const + -> std::underlying_type_t { return stdx::to_underlying(lsb_) / 32u; } [[nodiscard]] constexpr auto lsb() const -> std::underlying_type_t { @@ -338,8 +338,8 @@ struct at { return size() <= 64 and stdx::to_underlying(msb_) >= stdx::to_underlying(lsb_); } - [[nodiscard]] constexpr auto - sort_key() const -> std::underlying_type_t { + [[nodiscard]] constexpr auto sort_key() const + -> std::underlying_type_t { return stdx::to_underlying(lsb_); } [[nodiscard]] constexpr auto shifted_by(auto n) const -> at { diff --git a/include/msg/field_matchers.hpp b/include/msg/field_matchers.hpp index 71d77b3f..695a75c7 100644 --- a/include/msg/field_matchers.hpp +++ b/include/msg/field_matchers.hpp @@ -42,9 +42,10 @@ constexpr inline class index_terms_t { constexpr inline class index_not_terms_t { template - friend constexpr auto - tag_invoke(index_not_terms_t, M const &m, stdx::callable auto const &f, - std::size_t idx, bool negated = false) -> void { + friend constexpr auto tag_invoke(index_not_terms_t, M const &m, + stdx::callable auto const &f, + std::size_t idx, bool negated = false) + -> void { if constexpr (stdx::is_specialization_of_v or stdx::is_specialization_of_v) { tag_invoke(index_not_terms_t{}, m.lhs, f, idx, negated); @@ -67,8 +68,8 @@ constexpr inline class index_not_terms_t { constexpr inline class remove_terms_t { template [[nodiscard]] friend constexpr auto - tag_invoke(remove_terms_t, M const &m, - [[maybe_unused]] Fields... fs) -> match::matcher auto { + tag_invoke(remove_terms_t, M const &m, [[maybe_unused]] Fields... fs) + -> match::matcher auto { if constexpr (stdx::is_specialization_of_v) { return tag_invoke(remove_terms_t{}, m.lhs, fs...) or tag_invoke(remove_terms_t{}, m.rhs, fs...); @@ -236,16 +237,17 @@ template constexpr auto equal_to = equal_to_t{}; template -[[nodiscard]] constexpr auto -tag_invoke(match::implies_t, equal_to_t const &, - rel_matcher_t const &) -> bool { +[[nodiscard]] constexpr auto tag_invoke(match::implies_t, + equal_to_t const &, + rel_matcher_t const &) + -> bool { return RelOp{}(X, Y); } template constexpr auto tag_invoke(index_terms_t, equal_to_t const &, - stdx::callable auto const &f, - std::size_t idx) -> void { + stdx::callable auto const &f, std::size_t idx) + -> void { f.template operator()(idx, X); } @@ -262,9 +264,10 @@ constexpr auto tag_invoke(index_not_terms_t, not_equal_to_t const &, } template -[[nodiscard]] constexpr auto -tag_invoke(remove_terms_t, equal_to_t const &m, - std::type_identity...) -> match::matcher auto { +[[nodiscard]] constexpr auto tag_invoke(remove_terms_t, + equal_to_t const &m, + std::type_identity...) + -> match::matcher auto { if constexpr ((std::is_same_v or ...)) { return match::always; } else { @@ -273,9 +276,10 @@ tag_invoke(remove_terms_t, equal_to_t const &m, } template -[[nodiscard]] constexpr auto -tag_invoke(remove_terms_t, not_equal_to_t const &m, - std::type_identity...) -> match::matcher auto { +[[nodiscard]] constexpr auto tag_invoke(remove_terms_t, + not_equal_to_t const &m, + std::type_identity...) + -> match::matcher auto { if constexpr ((std::is_same_v or ...)) { return match::always; } else { @@ -284,16 +288,18 @@ tag_invoke(remove_terms_t, not_equal_to_t const &m, } template -[[nodiscard]] constexpr auto -tag_invoke(match::implies_t, less_than_t const &, - not_equal_to_t const &) -> bool { +[[nodiscard]] constexpr auto tag_invoke(match::implies_t, + less_than_t const &, + not_equal_to_t const &) + -> bool { return X <= Y; } template -[[nodiscard]] constexpr auto -tag_invoke(match::implies_t, greater_than_t const &, - not_equal_to_t const &) -> bool { +[[nodiscard]] constexpr auto tag_invoke(match::implies_t, + greater_than_t const &, + not_equal_to_t const &) + -> bool { return X >= Y; } diff --git a/include/msg/handler.hpp b/include/msg/handler.hpp index bd20d6c3..5e220329 100644 --- a/include/msg/handler.hpp +++ b/include/msg/handler.hpp @@ -19,8 +19,8 @@ struct handler : handler_interface { [&](auto &callback) { return callback.is_match(msg); }, callbacks); } - auto handle(MsgBase const &msg, - ExtraCallbackArgs... args) const -> bool final { + auto handle(MsgBase const &msg, ExtraCallbackArgs... args) const + -> bool final { auto const found_valid_callback = stdx::apply( [&](auto &...cbs) -> bool { return (0u | ... | cbs.handle(msg, args...)); diff --git a/include/msg/message.hpp b/include/msg/message.hpp index 3404632f..e4da17f0 100644 --- a/include/msg/message.hpp +++ b/include/msg/message.hpp @@ -433,13 +433,13 @@ template struct message { using mutable_span_t = stdx::span>; - friend constexpr auto equiv(view_t lhs, - view_t rhs) -> bool { + friend constexpr auto equiv(view_t lhs, view_t rhs) + -> bool { return (... and (lhs.get(Fields{}) == rhs.get(Fields{}))); } - friend constexpr auto equiv(view_t lhs, - view_t rhs) -> bool { + friend constexpr auto equiv(view_t lhs, view_t rhs) + -> bool { return equiv(lhs, rhs.as_const_view()); } }; @@ -522,8 +522,8 @@ template struct message { "Fields overflow message storage!"); storage_t storage{}; - friend constexpr auto operator==(owner_t const &, - owner_t const &) -> bool { + friend constexpr auto operator==(owner_t const &, owner_t const &) + -> bool { static_assert(stdx::always_false_v, "Equality is not defined for messages: " "consider using equivalent() instead."); @@ -571,9 +571,8 @@ template struct message { view_t(stdx::span, auto &&...) -> view_t>; template - view_t(owner_t const &) - -> view_t< - stdx::span>>; + view_t(owner_t const &) -> view_t< + stdx::span>>; template view_t(owner_t &, auto &&...) -> view_t>>; diff --git a/include/msg/send.hpp b/include/msg/send.hpp index 84069aad..e8ce03b7 100644 --- a/include/msg/send.hpp +++ b/include/msg/send.hpp @@ -117,9 +117,8 @@ template -[[nodiscard]] constexpr auto then_receive(S &&s, F &&f, - Args &&...args) -> async::sender - auto { +[[nodiscard]] constexpr auto then_receive(S &&s, F &&f, Args &&...args) + -> async::sender auto { return std::forward(s) | then_receive(std::forward(f), std::forward(args)...); } diff --git a/include/seq/step.hpp b/include/seq/step.hpp index 2cfe6a6b..6e682927 100644 --- a/include/seq/step.hpp +++ b/include/seq/step.hpp @@ -23,8 +23,9 @@ struct rt_step { log_func_ptr log_name{}; private: - [[nodiscard]] constexpr friend auto - operator==(rt_step const &, rt_step const &) -> bool = default; + [[nodiscard]] constexpr friend auto operator==(rt_step const &, + rt_step const &) + -> bool = default; }; template diff --git a/test/cib/special_members.hpp b/test/cib/special_members.hpp index c88484d0..6dcb823e 100644 --- a/test/cib/special_members.hpp +++ b/test/cib/special_members.hpp @@ -6,8 +6,8 @@ struct move_only { constexpr move_only(move_only &&) = default; constexpr auto operator=(move_only &&) noexcept -> move_only & = default; - friend constexpr auto operator==(move_only const &lhs, - move_only const &rhs) -> bool { + friend constexpr auto operator==(move_only const &lhs, move_only const &rhs) + -> bool { return lhs.value == rhs.value; } diff --git a/test/interrupt/common.hpp b/test/interrupt/common.hpp index c4e04967..afe51619 100644 --- a/test/interrupt/common.hpp +++ b/test/interrupt/common.hpp @@ -26,8 +26,8 @@ struct test_hal { } template - static auto run(interrupt::irq_num_t, - stdx::invocable auto const &isr) -> void { + static auto run(interrupt::irq_num_t, stdx::invocable auto const &isr) + -> void { P::run([] {}, [&] { isr(); }); } }; @@ -48,8 +48,8 @@ struct test_nexus { template struct enable_field_t { static inline bool value{}; - constexpr friend auto operator==(enable_field_t, - enable_field_t) -> bool = default; + constexpr friend auto operator==(enable_field_t, enable_field_t) + -> bool = default; }; template struct status_field_t { static inline bool value{}; diff --git a/test/log/mipi_encoder.cpp b/test/log/mipi_encoder.cpp index 68b64823..7ca3f7bd 100644 --- a/test/log/mipi_encoder.cpp +++ b/test/log/mipi_encoder.cpp @@ -49,15 +49,16 @@ struct test_conc_policy { return (static_cast(test_string_id) << 4u) | 0x1u; } -[[maybe_unused]] constexpr auto -expected_catalog32_header(logging::level level, module_id m) -> std::uint32_t { +[[maybe_unused]] constexpr auto expected_catalog32_header(logging::level level, + module_id m) + -> std::uint32_t { return (0x1u << 24u) | (m << 16u) | (static_cast(level) << 4u) | 0x3u; } -[[maybe_unused]] constexpr auto -expected_msg_header(logging::level level, module_id m, - std::size_t sz) -> std::uint32_t { +[[maybe_unused]] constexpr auto expected_msg_header(logging::level level, + module_id m, std::size_t sz) + -> std::uint32_t { return sz > 0 ? expected_catalog32_header(level, m) : expected_short32_header(); }