Skip to content

Commit 69b8bd0

Browse files
committed
🚨 Fix clang-tidy issues
1 parent 3173ed7 commit 69b8bd0

File tree

10 files changed

+32
-20
lines changed

10 files changed

+32
-20
lines changed

include/cib/detail/config_item.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace cib::detail {
66
struct config_item {
7-
[[nodiscard]] constexpr auto extends_tuple() const -> stdx::tuple<> {
7+
[[nodiscard]] constexpr static auto extends_tuple() -> stdx::tuple<> {
88
return {};
99
}
1010

11-
[[nodiscard]] constexpr auto exports_tuple() const -> stdx::tuple<> {
11+
[[nodiscard]] constexpr static auto exports_tuple() -> stdx::tuple<> {
1212
return {};
1313
}
1414
};

include/flow/graph_builder.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ struct graph_builder {
297297
constexpr static auto run() { built()(); }
298298

299299
public:
300-
constexpr operator FunctionPtr() const { return run; }
300+
// NOLINTNEXTLINE(google-explicit-constructor)
301+
constexpr explicit(false) operator FunctionPtr() const { return run; }
301302
constexpr auto operator()() const -> void { run(); }
302303
constexpr static bool active = decltype(built())::active;
303304
};

include/flow/graphviz_builder.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ struct graphviz_builder {
6161
static auto run() -> std::string { return built(); }
6262

6363
public:
64-
constexpr operator VizFunctionPtr() const { return run; }
64+
// NOLINTNEXTLINE(google-explicit-constructor)
65+
constexpr explicit(false) operator VizFunctionPtr() const {
66+
return run;
67+
}
6568
auto operator()() const -> std::string { return run(); }
6669
constexpr static bool active = true;
6770
};

include/interrupt/dynamic_controller.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
#include <boost/mp11/algorithm.hpp>
1111
#include <boost/mp11/list.hpp>
1212

13+
#include <cstdint>
1314
#include <limits>
1415
#include <type_traits>
1516

1617
namespace interrupt {
17-
enum class resource_status { OFF = 0, ON = 1 };
18+
enum class resource_status : std::uint8_t { OFF, ON };
1819

1920
template <typename Irq>
2021
concept has_enable_field = requires { Irq::enable_field; };

include/log/catalog/mipi_encoder.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
#include <cstdint>
1717
#include <utility>
1818

19-
template <auto...> struct undef;
20-
21-
namespace {
19+
namespace logging::mipi {
20+
namespace detail {
2221
template <logging::level L, typename S, typename T>
2322
constexpr auto to_message() {
2423
constexpr auto s = S::value;
@@ -46,9 +45,8 @@ template <typename S> constexpr auto to_module() {
4645
return sc::module_string<sc::undefined<void, char_t, s[Is]...>>{};
4746
}(std::make_integer_sequence<std::size_t, std::size(s)>{});
4847
}
49-
} // namespace
48+
} // namespace detail
5049

51-
namespace logging::mipi {
5250
namespace defn {
5351
using msg::at;
5452
using msg::dword_index_t;
@@ -125,8 +123,8 @@ template <typename TDestinations> struct log_handler {
125123
template <logging::level Level, typename ModuleId, typename Msg>
126124
ALWAYS_INLINE auto log_msg(Msg msg) -> void {
127125
msg.apply([&]<typename StringType>(StringType, auto... args) {
128-
using Message = decltype(to_message<Level>(msg));
129-
using Module = decltype(to_module<ModuleId>());
126+
using Message = decltype(detail::to_message<Level>(msg));
127+
using Module = decltype(detail::to_module<ModuleId>());
130128
dispatch_message<Level>(catalog<Message>(), module<Module>(),
131129
static_cast<std::uint32_t>(args)...);
132130
});

include/log/log.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ template <stdx::ct_string S> struct module_id_t {
6262

6363
using cib_log_module_id_t = typename logging::module_id_t<"default">::type;
6464

65+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
66+
6567
#define CIB_DO_PRAGMA(X) _Pragma(#X)
6668
#ifdef __clang__
6769
#define CIB_PRAGMA(X) CIB_DO_PRAGMA(clang X)
@@ -118,3 +120,5 @@ template <typename Flavor, typename... Ts> static auto log_version() -> void {
118120

119121
#define CIB_LOG_V(FLAVOR) logging::log_version<FLAVOR>()
120122
#define CIB_LOG_VERSION() CIB_LOG_V(logging::default_flavor_t)
123+
124+
// NOLINTEND(cppcoreguidelines-macro-usage)

include/match/predicate.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ template <stdx::ct_string Name, stdx::callable P> struct predicate_t {
1515

1616
constexpr static P pred{};
1717

18-
constexpr predicate_t(P) {}
19-
20-
constexpr predicate_t() {}
18+
constexpr predicate_t() = default;
19+
constexpr explicit(true) predicate_t(P) {}
2120

2221
[[nodiscard]] constexpr auto
2322
operator()(auto const &event) const -> decltype(pred(event)) {
@@ -34,7 +33,7 @@ template <stdx::ct_string Name, stdx::callable P> struct predicate_t {
3433
};
3534

3635
template <stdx::ct_string Name = "<predicate>", stdx::callable P>
37-
constexpr auto predicate(P &&p) -> predicate_t<Name, std::remove_cvref_t<P>> {
38-
return {std::forward<P>(p)};
36+
constexpr auto predicate(P &&p) {
37+
return predicate_t<Name, std::remove_cvref_t<P>>{std::forward<P>(p)};
3938
}
4039
} // namespace match

include/msg/message.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ template <typename Name, typename T> struct field_value {
127127
template <typename Name> struct field_name {
128128
using name_t = Name;
129129

130-
// NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature)
130+
// NOLINTNEXTLINE(misc-unconventional-assign-operator)
131131
template <typename T> constexpr auto operator=(T value) {
132132
return field_value<Name, T>{value};
133133
}
@@ -369,6 +369,7 @@ template <stdx::ct_string Name, typename... Fields> struct message {
369369
using span_t = Span;
370370

371371
template <detail::storage_like S>
372+
// NOLINTNEXTLINE(google-explicit-constructor)
372373
explicit(false) view_t(S const &s) : storage{s} {}
373374

374375
template <detail::storage_like S, some_field_value... Vs>
@@ -377,6 +378,7 @@ template <stdx::ct_string Name, typename... Fields> struct message {
377378
}
378379

379380
template <typename S>
381+
// NOLINTNEXTLINE(google-explicit-constructor)
380382
constexpr explicit(false) view_t(owner_t<S> const &s LIFETIMEBOUND)
381383
: storage{s.data()} {}
382384

@@ -391,6 +393,7 @@ template <stdx::ct_string Name, typename... Fields> struct message {
391393
std::same_as<std::add_const_t<typename S::element_type>,
392394
typename span_t::element_type> and
393395
span_t::extent <= S::extent)
396+
// NOLINTNEXTLINE(google-explicit-constructor)
394397
constexpr explicit(false) view_t(view_t<S> const &s)
395398
: storage{s.data()} {}
396399

include/seq/impl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
#include <array>
1010
#include <cstddef>
11+
#include <cstdint>
1112
#include <iterator>
1213

1314
namespace seq {
14-
enum struct direction { FORWARD = 0, BACKWARD = 1 };
15+
enum struct direction : std::uint8_t { FORWARD, BACKWARD };
1516

1617
template <stdx::ct_string, std::size_t NumSteps> struct impl {
1718
stdx::cx_vector<func_ptr, NumSteps> _forward_steps{};

include/seq/step.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
#include <stdx/ct_string.hpp>
99

10+
#include <cstdint>
11+
1012
namespace seq {
11-
enum struct status { NOT_DONE = 0, DONE = 1 };
13+
enum struct status : std::uint8_t { NOT_DONE, DONE };
1214

1315
using func_ptr = auto (*)() -> status;
1416
using log_func_ptr = auto (*)() -> void;

0 commit comments

Comments
 (0)