Skip to content

Commit

Permalink
Merge pull request #635 from elbeno/clang-tidy-stuff
Browse files Browse the repository at this point in the history
🚨 Fix clang-tidy issues
  • Loading branch information
elbeno authored Oct 23, 2024
2 parents 3173ed7 + 81ce72b commit 416710f
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/asciidoctor-ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- name: Checkout source
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
performance_test:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install compiler
run: sudo apt update && sudo apt install -y clang-${{env.LLVM_VERSION}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
release:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/single_header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
build_single_header:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
stdlib: libc++

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
stdlib: libstdc++

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- name: Checkout target branch
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{github.base_ref}}

Expand All @@ -224,7 +224,7 @@ jobs:
id: target_branch

- name: Checkout PR branch
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down Expand Up @@ -291,7 +291,7 @@ jobs:
toolchain_root: "/usr"

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down Expand Up @@ -338,7 +338,7 @@ jobs:
valgrind:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build tools
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/usage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
usage_test:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install compiler
run: sudo apt update && sudo apt-get install -y clang-${{env.USER_LLVM_VERSION}}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
CMakePresets.json
/toolchains
mull.yml
requirements.txt
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ include(cmake/string_catalog.cmake)

add_versioned_package("gh:boostorg/mp11#boost-1.83.0")
fmt_recipe(10.2.1)
add_versioned_package("gh:intel/cpp-std-extensions#67120f7")
add_versioned_package("gh:intel/cpp-baremetal-concurrency#630d8bc")
add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#9ea96f9")
add_versioned_package("gh:intel/cpp-baremetal-concurrency#7c5b26c")
add_versioned_package("gh:intel/cpp-std-extensions#5530b5d")
add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#73d95bc")

add_library(cib INTERFACE)
target_compile_features(cib INTERFACE cxx_std_20)
Expand Down
4 changes: 2 additions & 2 deletions include/cib/detail/config_item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace cib::detail {
struct config_item {
[[nodiscard]] constexpr auto extends_tuple() const -> stdx::tuple<> {
[[nodiscard]] constexpr static auto extends_tuple() -> stdx::tuple<> {
return {};
}

[[nodiscard]] constexpr auto exports_tuple() const -> stdx::tuple<> {
[[nodiscard]] constexpr static auto exports_tuple() -> stdx::tuple<> {
return {};
}
};
Expand Down
3 changes: 2 additions & 1 deletion include/flow/graph_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ struct graph_builder {
constexpr static auto run() { built()(); }

public:
constexpr operator FunctionPtr() const { return run; }
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr explicit(false) operator FunctionPtr() const { return run; }
constexpr auto operator()() const -> void { run(); }
constexpr static bool active = decltype(built())::active;
};
Expand Down
5 changes: 4 additions & 1 deletion include/flow/graphviz_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ struct graphviz_builder {
static auto run() -> std::string { return built(); }

public:
constexpr operator VizFunctionPtr() const { return run; }
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr explicit(false) operator VizFunctionPtr() const {
return run;
}
auto operator()() const -> std::string { return run(); }
constexpr static bool active = true;
};
Expand Down
3 changes: 2 additions & 1 deletion include/interrupt/dynamic_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
#include <boost/mp11/algorithm.hpp>
#include <boost/mp11/list.hpp>

#include <cstdint>
#include <limits>
#include <type_traits>

namespace interrupt {
enum class resource_status { OFF = 0, ON = 1 };
enum class resource_status : std::uint8_t { OFF, ON };

template <typename Irq>
concept has_enable_field = requires { Irq::enable_field; };
Expand Down
12 changes: 5 additions & 7 deletions include/log/catalog/mipi_encoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
#include <cstdint>
#include <utility>

template <auto...> struct undef;

namespace {
namespace logging::mipi {
namespace detail {
template <logging::level L, typename S, typename T>
constexpr auto to_message() {
constexpr auto s = S::value;
Expand Down Expand Up @@ -46,9 +45,8 @@ template <typename S> constexpr auto to_module() {
return sc::module_string<sc::undefined<void, char_t, s[Is]...>>{};
}(std::make_integer_sequence<std::size_t, std::size(s)>{});
}
} // namespace
} // namespace detail

namespace logging::mipi {
namespace defn {
using msg::at;
using msg::dword_index_t;
Expand Down Expand Up @@ -125,8 +123,8 @@ template <typename TDestinations> struct log_handler {
template <logging::level Level, typename ModuleId, typename Msg>
ALWAYS_INLINE auto log_msg(Msg msg) -> void {
msg.apply([&]<typename StringType>(StringType, auto... args) {
using Message = decltype(to_message<Level>(msg));
using Module = decltype(to_module<ModuleId>());
using Message = decltype(detail::to_message<Level>(msg));
using Module = decltype(detail::to_module<ModuleId>());
dispatch_message<Level>(catalog<Message>(), module<Module>(),
static_cast<std::uint32_t>(args)...);
});
Expand Down
4 changes: 4 additions & 0 deletions include/log/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ template <stdx::ct_string S> struct module_id_t {

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

// NOLINTBEGIN(cppcoreguidelines-macro-usage)

#define CIB_DO_PRAGMA(X) _Pragma(#X)
#ifdef __clang__
#define CIB_PRAGMA(X) CIB_DO_PRAGMA(clang X)
Expand Down Expand Up @@ -118,3 +120,5 @@ template <typename Flavor, typename... Ts> static auto log_version() -> void {

#define CIB_LOG_V(FLAVOR) logging::log_version<FLAVOR>()
#define CIB_LOG_VERSION() CIB_LOG_V(logging::default_flavor_t)

// NOLINTEND(cppcoreguidelines-macro-usage)
9 changes: 4 additions & 5 deletions include/match/predicate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ template <stdx::ct_string Name, stdx::callable P> struct predicate_t {

constexpr static P pred{};

constexpr predicate_t(P) {}

constexpr predicate_t() {}
constexpr predicate_t() = default;
constexpr explicit(true) predicate_t(P) {}

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

template <stdx::ct_string Name = "<predicate>", stdx::callable P>
constexpr auto predicate(P &&p) -> predicate_t<Name, std::remove_cvref_t<P>> {
return {std::forward<P>(p)};
constexpr auto predicate(P &&p) {
return predicate_t<Name, std::remove_cvref_t<P>>{std::forward<P>(p)};
}
} // namespace match
5 changes: 4 additions & 1 deletion include/msg/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ template <typename Name, typename T> struct field_value {
template <typename Name> struct field_name {
using name_t = Name;

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

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

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

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

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

Expand Down
3 changes: 2 additions & 1 deletion include/seq/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

#include <array>
#include <cstddef>
#include <cstdint>
#include <iterator>

namespace seq {
enum struct direction { FORWARD = 0, BACKWARD = 1 };
enum struct direction : std::uint8_t { FORWARD, BACKWARD };

template <stdx::ct_string, std::size_t NumSteps> struct impl {
stdx::cx_vector<func_ptr, NumSteps> _forward_steps{};
Expand Down
4 changes: 3 additions & 1 deletion include/seq/step.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

#include <stdx/ct_string.hpp>

#include <cstdint>

namespace seq {
enum struct status { NOT_DONE = 0, DONE = 1 };
enum struct status : std::uint8_t { NOT_DONE, DONE };

using func_ptr = auto (*)() -> status;
using log_func_ptr = auto (*)() -> void;
Expand Down

0 comments on commit 416710f

Please sign in to comment.