Skip to content

Commit

Permalink
feat: Update clang tidy/format to version 14 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzenker authored Dec 5, 2022
1 parent b7e295f commit 09d66e4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '2'

- name: Install Dependencies
run: |
sudo apt install clang-format-10
clang-format-10 --version
sudo apt install clang-format-14
clang-format-14 --version
- name: Clang format
run: |
git clang-format-10 HEAD~1
git clang-format-14 HEAD~1
git diff --exit-code
10 changes: 5 additions & 5 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: |
sudo apt install clang-tidy-10 libboost-all-dev
clang-tidy-10 --version
sudo apt install clang-tidy-14 libboost-all-dev
clang-tidy-14 --version
- name: Clang tidy
run: >-
CHECKS=-\*,clang-analyzer-\*,boost-\*,cppcoreguidelines-\*,modernize-\*,performance-\*
clang-tidy-10 --warnings-as-errors=${CHECKS} -checks=${CHECKS}
clang-tidy-14 --warnings-as-errors=${CHECKS} -checks=${CHECKS}
-header-filter=include/hsm/\* benchmark/simple/hsm.cpp
-- -Iinclude/ -Ibenchmark/ -std=c++17
-- -Iinclude/ -Ibenchmark/ -std=c++20
2 changes: 1 addition & 1 deletion include/hsm/details/fill_dispatch_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ template <class State> constexpr auto nEvents(State rootState)
return bh::length(collect_event_typeids_recursive(rootState));
}

template <class State> constexpr decltype(auto) hasParallelRegions(State rootState)
template <class State> constexpr auto hasParallelRegions(State rootState) -> decltype(auto)
{
return bh::greater(maxInitialStates(rootState), bh::size_c<1>);
}
Expand Down
2 changes: 1 addition & 1 deletion include/hsm/details/idx.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ constexpr auto calcParentStateIdx
constexpr auto calcStateIdx
= [](std::size_t nStates, Idx combinedState) -> Idx { return combinedState % nStates; };

template <class Event> constexpr decltype(auto) resolveEvent(Event event)
template <class Event> constexpr auto resolveEvent(Event event) -> decltype(auto)
{
if constexpr (is_event(event)) {
return event.typeid_;
Expand Down
4 changes: 2 additions & 2 deletions include/hsm/details/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ constexpr auto is_initial_state = [](auto typeid_) {
constexpr auto is_no_action
= [](auto action) { return bh::equal(bh::typeid_(action), bh::typeid_(noAction {})); };

template <class Action> constexpr decltype(auto) is_action()
template <class Action> constexpr auto is_action() -> decltype(auto)
{
return bh::not_equal(bh::type_c<Action>, bh::typeid_(noAction {}));
}

constexpr auto is_no_guard
= [](auto guard) { return bh::equal(bh::typeid_(guard), bh::typeid_(noGuard {})); };

template <class Guard> constexpr decltype(auto) is_guard()
template <class Guard> constexpr auto is_guard() -> decltype(auto)
{
return bh::not_equal(bh::type_c<Guard>, bh::typeid_(noGuard {}));
}
Expand Down
4 changes: 1 addition & 3 deletions include/hsm/details/transition.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include <boost/hana/bool.hpp>

namespace hsm {
namespace details {
namespace hsm::details {

namespace bh {
using namespace boost::hana;
Expand Down Expand Up @@ -168,5 +167,4 @@ constexpr auto internal_extended_transition = [](auto parent, auto transition) {
transition.action(),
transition.target() };
};
}
}

0 comments on commit 09d66e4

Please sign in to comment.