From eb17f29aa5791136af0be5d5554d41ce34a53aa5 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 24 Feb 2026 12:56:28 +0000 Subject: [PATCH 1/4] tidy: clang-tidy is required Otherwise this check will "pass", like: ```bash -- Detecting CXX compile features - done -- Found LLVM 21.1.8 -- Found clang-tidy: CLANG_TIDY_EXE-NOTFOUND -- Configuring done (0.5s) ``` --- contrib/devtools/bitcoin-tidy/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/devtools/bitcoin-tidy/CMakeLists.txt b/contrib/devtools/bitcoin-tidy/CMakeLists.txt index c6f683f7aba..a7422a2807e 100644 --- a/contrib/devtools/bitcoin-tidy/CMakeLists.txt +++ b/contrib/devtools/bitcoin-tidy/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB ON) set(CMAKE_DISABLE_FIND_PACKAGE_zstd ON) find_package(LLVM REQUIRED CONFIG) -find_program(CLANG_TIDY_EXE NAMES "clang-tidy-${LLVM_VERSION_MAJOR}" "clang-tidy" HINTS ${LLVM_TOOLS_BINARY_DIR}) +find_program(CLANG_TIDY_EXE REQUIRED NAMES "clang-tidy-${LLVM_VERSION_MAJOR}" "clang-tidy" HINTS ${LLVM_TOOLS_BINARY_DIR}) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}") From 7ea076f996dee27a640b8b18b2b58be8011dfe6e Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 24 Feb 2026 10:20:20 +0000 Subject: [PATCH 2/4] tidy: remove deprecated header ```bash 15 | #warning The ClangTidyModuleRegistry.h header is deprecated and will be removed in LLVM 24. All of the symbols it used to define have been moved into ClangTidyModule.h. | ^~~~~~~ [100%] Linking CXX shared module libbitcoin-tidy.so ``` --- contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp b/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp index f2658b5a586..bf79f387ecd 100644 --- a/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp +++ b/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp @@ -5,7 +5,6 @@ #include "nontrivial-threadlocal.h" #include -#include class BitcoinModule final : public clang::tidy::ClangTidyModule { From 4089682f5cfecd04b8d983be5f82d00c0c418bf4 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 24 Feb 2026 10:09:33 +0000 Subject: [PATCH 3/4] ci: use Clang 22 in tidy task Added -config-file as otherwise run-clang-tidy no-longer seemed able to find the config file. --- ci/test/00_setup_env_native_tidy.sh | 2 +- ci/test/03_test_script.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh index 04f3e2e759c..b3cda17e8ee 100755 --- a/ci/test/00_setup_env_native_tidy.sh +++ b/ci/test/00_setup_env_native_tidy.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_tidy -export TIDY_LLVM_V="21" +export TIDY_LLVM_V="22" export APT_LLVM_V="${TIDY_LLVM_V}" export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" export NO_DEPENDS=1 diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index d81bd0b9ea8..eb03c2dd493 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -174,7 +174,7 @@ if [ "${RUN_TIDY}" = "true" ]; then mv tmp.json "${BASE_BUILD_DIR}/compile_commands.json" cd "${BASE_BUILD_DIR}/src/" - if ! ( run-clang-tidy-"${TIDY_LLVM_V}" -quiet -load="/tidy-build/libbitcoin-tidy.so" "${MAKEJOBS}" | tee tmp.tidy-out.txt ); then + if ! ( run-clang-tidy-"${TIDY_LLVM_V}" -config-file="${BASE_ROOT_DIR}/src/.clang-tidy" -quiet -load="/tidy-build/libbitcoin-tidy.so" "${MAKEJOBS}" | tee tmp.tidy-out.txt ); then grep -C5 "error: " tmp.tidy-out.txt echo "^^^ ⚠️ Failure generated from clang-tidy" false From 5e35a9069d655419cada6070e1f00a28d4a877f9 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 24 Feb 2026 10:19:39 +0000 Subject: [PATCH 4/4] interpreter: remove clang-tidy suppression --- src/script/interpreter.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 49fa2bd9502..443714ceeda 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1258,12 +1258,8 @@ private: const CScript& scriptCode; //!< output script being consumed const unsigned int nIn; //!< input index of txTo being signed const bool fAnyoneCanPay; //!< whether the hashtype has the SIGHASH_ANYONECANPAY flag set - // Temporary workaround for a clang-tidy bug fixed in version 22. - // See: https://github.com/llvm/llvm-project/issues/160394. - // NOLINTBEGIN(modernize-use-default-member-init) const bool fHashSingle; //!< whether the hashtype is SIGHASH_SINGLE const bool fHashNone; //!< whether the hashtype is SIGHASH_NONE - // NOLINTEND(modernize-use-default-member-init) public: CTransactionSignatureSerializer(const T& txToIn, const CScript& scriptCodeIn, unsigned int nInIn, int nHashTypeIn) :