Skip to content

Commit 523ee76

Browse files
Upgrade to clang-tidy 18 (#6919)
1 parent feeed75 commit 523ee76

File tree

9 files changed

+39
-12
lines changed

9 files changed

+39
-12
lines changed

.clang-tidy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Checks: >
1313
-bugprone-forward-declaration-namespace,
1414
-bugprone-sizeof-expression,
1515
-bugprone-throw-keyword-missing,
16+
-bugprone-chained-comparison,
17+
-bugprone-incorrect-enable-if,
18+
-bugprone-switch-missing-default-case,
19+
-bugprone-empty-catch,
20+
-bugprone-unused-return-value,
1621
-clang-analyzer-*,
1722
-clang-diagnostic-deprecated-declarations,
1823
-clang-diagnostic-constant-conversion,
@@ -49,11 +54,15 @@ Checks: >
4954
-misc-misplaced-const,
5055
-misc-definitions-in-headers,
5156
-misc-unused-parameters,
57+
-misc-include-cleaner,
5258
modernize-concat-nested-namespaces,
5359
modernize-use-using,
5460
performance-*,
5561
-performance-noexcept-move-constructor,
62+
-performance-noexcept-swap,
5663
-performance-no-int-to-ptr,
64+
-performance-enum-size,
65+
-performance-avoid-endl,
5766
readability-*,
5867
-readability-avoid-const-params-in-decls,
5968
-readability-braces-around-statements,
@@ -82,6 +91,10 @@ Checks: >
8291
-readability-make-member-function-const,
8392
-readability-redundant-string-init,
8493
-readability-non-const-parameter,
94+
-readability-redundant-inline-specifier,
95+
-readability-avoid-nested-conditional-operator,
96+
-readability-avoid-return-with-void-value,
97+
-readability-redundant-casting,
8598
-readability-static-accessed-through-instance
8699
87100
WarningsAsErrors: '*'

.github/workflows/osrm-backend.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ jobs:
192192
CXXCOMPILER: clang++-15
193193
CUCUMBER_TIMEOUT: 60000
194194

195-
- name: clang-15-debug-clang-tidy
195+
- name: clang-18-debug-clang-tidy
196196
continue-on-error: false
197197
node: 18
198-
runs-on: ubuntu-22.04
198+
runs-on: ubuntu-24.04
199199
BUILD_TOOLS: ON
200200
BUILD_TYPE: Debug
201-
CCOMPILER: clang-15
202-
CXXCOMPILER: clang++-15
201+
CCOMPILER: clang-18
202+
CXXCOMPILER: clang++-18
203203
CUCUMBER_TIMEOUT: 60000
204204
ENABLE_CLANG_TIDY: ON
205205

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- ADDED: Add support for opposite approach request parameter. [#6842](https://github.com/Project-OSRM/osrm-backend/pull/6842)
99
- ADDED: Add support for accessing edge flags in `process_segment` [#6658](https://github.com/Project-OSRM/osrm-backend/pull/6658)
1010
- Build:
11+
- CHANGED: Upgrade clang-format to version 15. [#6919](https://github.com/Project-OSRM/osrm-backend/pull/6919)
1112
- CHANGED: Use Debian Bookworm as base Docker image [#6904](https://github.com/Project-OSRM/osrm-backend/pull/6904)
1213
- CHANGED: Upgrade CI actions to latest versions [#6893](https://github.com/Project-OSRM/osrm-backend/pull/6893)
1314
- CHANGED: Remove outdated warnings #6894 [#6894](https://github.com/Project-OSRM/osrm-backend/pull/6894)

include/extractor/serialization.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ inline void read(storage::tar::FileReader &reader,
215215
const std::string &name,
216216
detail::NameTableImpl<Ownership> &name_table)
217217
{
218-
std::string buffer;
219218
util::serialization::read(reader, name, name_table.indexed_data);
220219
}
221220
} // namespace osrm::extractor::serialization

include/storage/shared_memory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SharedMemory
6161
{
6262
shm = boost::interprocess::xsi_shared_memory(boost::interprocess::open_only, key);
6363

64-
util::Log(logDEBUG) << "opening " << (int)shm.get_shmid() << " from id " << (int)id;
64+
util::Log(logDEBUG) << "opening " << shm.get_shmid() << " from id " << (int)id;
6565

6666
region = boost::interprocess::mapped_region(shm, boost::interprocess::read_only);
6767
}

third_party/sol2/include/sol/sol.hpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19416,7 +19416,14 @@ namespace sol { namespace function_detail {
1941619416
}
1941719417

1941819418
template <bool is_yielding, bool no_trampoline>
19419-
static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
19419+
static int call(lua_State* L)
19420+
// see https://github.com/ThePhD/sol2/issues/1581#issuecomment-2103463524
19421+
#if SOL_IS_ON(SOL_COMPILER_CLANG)
19422+
// apparent regression in clang 18 - llvm/llvm-project#91362
19423+
#else
19424+
noexcept(std::is_nothrow_copy_assignable_v<T>)
19425+
#endif
19426+
{
1942019427
int nr;
1942119428
if constexpr (no_trampoline) {
1942219429
nr = real_call(L);
@@ -19456,7 +19463,14 @@ namespace sol { namespace function_detail {
1945619463
}
1945719464

1945819465
template <bool is_yielding, bool no_trampoline>
19459-
static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
19466+
static int call(lua_State* L)
19467+
// see https://github.com/ThePhD/sol2/issues/1581#issuecomment-2103463524
19468+
#if SOL_IS_ON(SOL_COMPILER_CLANG)
19469+
// apparent regression in clang 18 - llvm/llvm-project#91362
19470+
#else
19471+
noexcept(std::is_nothrow_copy_assignable_v<T>)
19472+
#endif
19473+
{
1946019474
int nr;
1946119475
if constexpr (no_trampoline) {
1946219476
nr = real_call(L);

unit_tests/library/route.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ void test_route_same_coordinates(bool use_json_only_api)
239239
BOOST_CHECK(((void)name, true));
240240

241241
// nothing can be said about mode, contains mode of transportation
242-
const auto mode = std::get<json::String>(step_object.values.at("mode")).value;
243242
BOOST_CHECK(!name.empty());
244243

245244
const auto &maneuver =

unit_tests/partitioner/bisection_graph_view.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ using namespace osrm::util;
1616

1717
BOOST_AUTO_TEST_SUITE(graph_view)
1818

19-
static void shuffle(std::vector<EdgeWithSomeAdditionalData> &grid_edges)
19+
namespace
20+
{
21+
void shuffle(std::vector<EdgeWithSomeAdditionalData> &grid_edges)
2022
{
2123
std::random_device rd;
2224
std::mt19937 rng(rd());
2325
std::shuffle(grid_edges.begin(), grid_edges.end(), rng);
2426
}
27+
} // namespace
2528

2629
BOOST_AUTO_TEST_CASE(separate_top_bottom)
2730
{

unit_tests/util/static_rtree.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ auto make_rtree(const boost::filesystem::path &path, FixtureT &fixture)
235235
template <typename RTreeT = TestStaticRTree, typename FixtureT>
236236
void construction_test(const std::string &path, FixtureT &fixture)
237237
{
238-
std::string leaves_path;
239-
std::string nodes_path;
240238
auto rtree = make_rtree<RTreeT>(path, fixture);
241239
LinearSearchNN<TestData> lsnn(fixture.coords, fixture.edges);
242240

0 commit comments

Comments
 (0)