From bb6579037835cdac12c53f5d88006a3eb0e62f3f Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 22 Aug 2025 16:00:16 +0200 Subject: [PATCH 1/4] Delete copy/move constructor/assignment operator for file_t They would break the cleanup function of the class destructor. --- tests/common-cleanup.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/common-cleanup.hpp b/tests/common-cleanup.hpp index 2fc870714..a480113d5 100644 --- a/tests/common-cleanup.hpp +++ b/tests/common-cleanup.hpp @@ -34,6 +34,12 @@ class file_t } } + file_t(file_t const &) = delete; + file_t &operator=(file_t const &) = delete; + + file_t(file_t &&) = delete; + file_t &operator=(file_t const &&) = delete; + ~file_t() noexcept { delete_file(true); } private: From ca536909f8873040c916fefd332ad81ef9f7374c Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 22 Aug 2025 17:34:58 +0200 Subject: [PATCH 2/4] Disable another clang-tidy warning --- tests/common-pg.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/common-pg.hpp b/tests/common-pg.hpp index 5189494e8..48a352483 100644 --- a/tests/common-pg.hpp +++ b/tests/common-pg.hpp @@ -132,6 +132,9 @@ class tempdb_t tempdb_t(tempdb_t &&) = delete; tempdb_t &operator=(tempdb_t const &&) = delete; + // We want to terminate the program if there is an exception thrown inside + // the destructor. + // NOLINTNEXTLINE(bugprone-exception-escape) ~tempdb_t() noexcept { if (m_db_name.empty()) { From 3bc0f6794eb0a9c260fd366e5fd4936933fdbd7b Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 22 Aug 2025 09:14:58 +0200 Subject: [PATCH 3/4] Also check headers in tests directory in clang-tidy --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index b4e660b85..31c6fedeb 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -88,7 +88,7 @@ Checks: '*,-abseil-*,-altera-*,-android-cloexec-*,-boost-use-ranges,-bugprone-ch # Readability is a matter of opinion here # #WarningsAsErrors: '*' -HeaderFilterRegex: '\/src\/' +HeaderFilterRegex: '\/(src|tests)\/' CheckOptions: - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor value: true From 069724f10332c4b7eba38a428946c360c0daf229 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 22 Aug 2025 09:15:21 +0200 Subject: [PATCH 4/4] Explicitly tell clang-tidy where the config file is For some reason clang-tidy will behave differently when run from different current directories if the config file is not set explicitly. It is supposed to find the source files to check in the compile_commands.json file and find the config from there, but apparently that is not the whole truth!? --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a5fbadd5..b4039bcf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,7 @@ if (CLANG_TIDY) add_custom_target(clang-tidy ${CLANG_TIDY} + --config-file ${CMAKE_SOURCE_DIR}/.clang-tidy -p ${CMAKE_BINARY_DIR} ${CT_CHECK_FILES} )