Skip to content

Commit

Permalink
CI: Use Clang 18 (#132)
Browse files Browse the repository at this point in the history
* clang-tidy

* update fmt

* clang 18

* format using clang-format-18

* ???

without default:
error: 'switch' missing 'default' label [-Werror,-Wswitch-default]
with default:
error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]

* we have to disable one of the switch warnings

see nlohmann/json#3539

* switch to latest docker-cpp-build
  • Loading branch information
pablohoch authored Sep 10, 2024
1 parent 704210f commit ada780c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
find include src test \
-type f -a \( -name "*.cc" -o -name "*.h" -o -name ".cuh" -o -name ".cu" \) \
-print0 | xargs -0 clang-format-17 -i
-print0 | xargs -0 clang-format-18 -i
- name: Check for differences
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[fmt]
url=git@github.com:motis-project/fmt.git
branch=master
commit=09e6cf8fa61ff44509595005631f9da5d917ed3f
commit=dc10f83be70ac2873d5f8d1ce317596f1fd318a2
[date]
url=git@github.com:motis-project/date.git
branch=master
Expand Down
4 changes: 2 additions & 2 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
8129346325798563128
14526600618413782245
cista f52a62c4d83377acd398227ab4fcd6c946bdbd70
PEGTL 1c1aa6e650e4d26f10fa398f148ec0cdc5f0808d
res 7d97784ba785ce8a2677ea77164040fde484fb04
date d84b23ca2432e17f3f04a3e0cc96b096b99c39a2
googletest 7b64fca6ea0833628d6f86255a81424365f7cc0c
fmt 09e6cf8fa61ff44509595005631f9da5d917ed3f
fmt dc10f83be70ac2873d5f8d1ce317596f1fd318a2
utl 77aac494c45d2b070e65fe712abc34ac74a91d0f
oh d21c30f40e52a83d6dc09bcffd0067598b5ec069
zlib fe8e13ffca867612951bc6baf114e5ac8b00f305
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-Wno-reserved-macro-identifier
-Wno-documentation-unknown-command
-Wno-duplicate-enum
-Wno-switch-default
-Werror)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(nigiri-compile-options -Wall -Wextra -Werror)
Expand Down
10 changes: 5 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/sanitizer",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang-17",
"CMAKE_CXX_COMPILER": "clang++-17",
"CMAKE_C_COMPILER": "clang-18",
"CMAKE_CXX_COMPILER": "clang++-18",
"CMAKE_EXE_LINKER_FLAGS": "-lc++abi",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-fsanitize=address,undefined -fno-omit-frame-pointer",
Expand Down Expand Up @@ -113,8 +113,8 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/clang-tidy",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang-17",
"CMAKE_CXX_COMPILER": "clang++-17",
"CMAKE_C_COMPILER": "clang-18",
"CMAKE_CXX_COMPILER": "clang++-18",
"CMAKE_CXX_FLAGS": "-stdlib=libc++",
"CMAKE_EXE_LINKER_FLAGS": "-lc++abi",
"CMAKE_BUILD_TYPE": "Release",
Expand Down Expand Up @@ -160,4 +160,4 @@
"configurePreset": "linux-sanitizer"
}
]
}
}
2 changes: 1 addition & 1 deletion cmake/clang-tidy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ file(RELATIVE_PATH RELATIVE_SOURCE_DIR ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
if(NIGIRI_CLANG_TIDY_COMMAND)
set(CLANG_TIDY_COMMAND "${NIGIRI_CLANG_TIDY_COMMAND}")
else()
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy-17)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy-18)
endif()

if(NOT CLANG_TIDY_COMMAND)
Expand Down
7 changes: 3 additions & 4 deletions include/nigiri/routing/interval_estimate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ struct interval_estimator {
: tt_{tt}, q_{q} {

auto const start_itv = std::visit(
utl::overloaded{[](unixtime_t const& ut) {
return interval<unixtime_t>{ut, ut};
},
[](interval<unixtime_t> iut) { return iut; }},
utl::overloaded{
[](unixtime_t const& ut) { return interval<unixtime_t>{ut, ut}; },
[](interval<unixtime_t> iut) { return iut; }},
q.start_time_);

data_type_max_interval_ = {
Expand Down
42 changes: 21 additions & 21 deletions include/nigiri/routing/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ struct search {
state_{s},
q_{std::move(q)},
search_interval_{std::visit(
utl::overloaded{
[](interval<unixtime_t> const start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time, start_time};
}},
utl::overloaded{[](interval<unixtime_t> const start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time,
start_time};
}},
q_.start_time_)},
fastest_direct_{get_fastest_direct(tt_, q_, SearchDir)},
algo_{init(q_.allowed_claszes_,
Expand Down Expand Up @@ -209,13 +209,13 @@ struct search {
"timeout_reached={}\n",
is_ontrip(), q_.extend_interval_earlier_, q_.extend_interval_later_,
std::visit(
utl::overloaded{
[](interval<unixtime_t> const& start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time, start_time};
}},
utl::overloaded{[](interval<unixtime_t> const& start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time,
start_time};
}},
q_.start_time_),
search_interval_, tt_.external_interval(), n_results_in_interval(),
is_timeout_reached());
Expand All @@ -227,13 +227,13 @@ struct search {
"number_of_results_in_interval={}\n",
q_.extend_interval_earlier_, q_.extend_interval_later_,
std::visit(
utl::overloaded{
[](interval<unixtime_t> const& start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time, start_time};
}},
utl::overloaded{[](interval<unixtime_t> const& start_interval) {
return start_interval;
},
[](unixtime_t const start_time) {
return interval<unixtime_t>{start_time,
start_time};
}},
q_.start_time_),
search_interval_, tt_.external_interval(), n_results_in_interval());
}
Expand Down
5 changes: 2 additions & 3 deletions src/loader/gtfs/trip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ block::rule_services(trip_data& trips) {
gtfs_trip_idx_t trip_;
bitfield traffic_days_;
};
auto rule_trips = utl::to_vec(trips_, [&](auto&& t) {
return rule_trip{t, *trips.get(t).service_};
});
auto rule_trips = utl::to_vec(
trips_, [&](auto&& t) { return rule_trip{t, *trips.get(t).service_}; });

struct queue_entry {
std::vector<rule_trip>::iterator current_it_;
Expand Down

0 comments on commit ada780c

Please sign in to comment.