diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -5,8 +5,8 @@ }, "clang-format": { "type": "clang-format", - "version": ">=8.0", - "bin": ["clang-format-8", "clang-format"], + "version": ">=10.0", + "bin": ["clang-format-10", "clang-format"], "include": "(^src/.*\\.(h|c|cpp|mm)$)", "exclude": [ "(^src/(secp256k1|univalue|leveldb)/)", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,27 +131,26 @@ If code formatting tools do not install automatically on your system, you will have to install the following: -On Ubuntu (>= 18.04+updates): +On Ubuntu 20.04: ``` -sudo apt-get install clang-format-8 clang-tidy-8 clang-tools-8 cppcheck python3-autopep8 flake8 php-codesniffer yamllint +sudo apt-get install clang-format clang-tidy clang-tools cppcheck python3-autopep8 flake8 php-codesniffer yamllint ``` -On Debian (>= 10), the clang-8 family of tools is available from the `buster-backports` repository: +If not available in the distribution, `clang-format-10` and `clang-tidy` can be +installed from or . + +On Debian (>= 10), the clang-10 family of tools is available from the https://apt.llvm.org/ repository: ``` -echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list -sudo apt-get update -sudo apt-get install cppcheck python3-autopep8 flake8 php-codesniffer mypy -sudo apt-get -t buster-backports install clang-format-8 clang-tidy-8 clang-tools-8 +wget https://apt.llvm.org/llvm.sh +chmod +x llvm.sh +sudo ./llvm.sh 10 ``` -If not available in the distribution, `clang-format-8` and `clang-tidy` can be -installed from or . - For example, for macOS: ``` -curl http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz | tar -xJv -ln -s $PWD/clang+llvm-8.0.0-x86_64-apple-darwin/bin/clang-format /usr/local/bin/clang-format -ln -s $PWD/clang+llvm-8.0.0-x86_64-apple-darwin/bin/clang-tidy /usr/local/bin/clang-tidy +curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz | tar -xJv +ln -s $PWD/clang+llvm-10.0.0-x86_64-apple-darwin/bin/clang-format /usr/local/bin/clang-format +ln -s $PWD/clang+llvm-10.0.0-x86_64-apple-darwin/bin/clang-tidy /usr/local/bin/clang-tidy ``` If you are modifying a python script, you will need to install `mypy`. The minimum required version is 0.780, because diff --git a/arcanist/linter/ClangFormatLinter.php b/arcanist/linter/ClangFormatLinter.php --- a/arcanist/linter/ClangFormatLinter.php +++ b/arcanist/linter/ClangFormatLinter.php @@ -46,13 +46,13 @@ } /* - * FIXME: This is a hack to only allow for clang-format version 8.x. + * FIXME: This is a hack to only allow for clang-format version 10.x. * The .arclint `version` field only allow to filter versions using `=`, * `>`, `<`, `>=` or `<=`. There is no facility to define that the required - * version should be >= 8.0 and < 9.0. + * version should be >= 10.0 and < 11.0. */ - if ($version[0] != '8') { - throw new Exception(pht('Linter %s requires clang-format version 8.x. '. + if (substr($version, 0, 2) != '10') { + throw new Exception(pht('Linter %s requires clang-format version 10.x. '. 'You have version %s.', ClangFormatLinter::class, $version)); diff --git a/cmake/modules/ClangTidy.cmake b/cmake/modules/ClangTidy.cmake --- a/cmake/modules/ClangTidy.cmake +++ b/cmake/modules/ClangTidy.cmake @@ -1,6 +1,6 @@ if(NOT CLANG_TIDY_EXE) include(DoOrFail) - find_program_or_fail(CLANG_TIDY_EXE clang-tidy clang-tidy-10 clang-tidy-9 clang-tidy-8) + find_program_or_fail(CLANG_TIDY_EXE clang-tidy clang-tidy-13 clang-tidy-12 clang-tidy-11 clang-tidy-10) execute_process( COMMAND "${CLANG_TIDY_EXE}" -version @@ -9,8 +9,8 @@ ) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION_OUTPUT}") - if("${CLANG_TIDY_VERSION}" VERSION_LESS "8.0.0") - message(FATAL_ERROR "clang-tidy version >= 8 is required") + if("${CLANG_TIDY_VERSION}" VERSION_LESS "10.0.0") + message(FATAL_ERROR "clang-tidy version >= 10 is required") endif() message(STATUS "Using clang-tidy: ${CLANG_TIDY_EXE} (version ${CLANG_TIDY_VERSION})") diff --git a/contrib/utils/install-dependencies.sh b/contrib/utils/install-dependencies.sh --- a/contrib/utils/install-dependencies.sh +++ b/contrib/utils/install-dependencies.sh @@ -107,9 +107,9 @@ LLVM_PACKAGES=( clang-10 - clang-format-8 - clang-tidy-8 - clang-tools-8 + clang-format-10 + clang-tidy-10 + clang-tools-10 ) DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${LLVM_PACKAGES[@]}") diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -219,9 +219,8 @@ updateAmountColumnTitle(); } -bool RecentRequestEntryLessThan:: -operator()(const RecentRequestEntry &left, - const RecentRequestEntry &right) const { +bool RecentRequestEntryLessThan::operator()( + const RecentRequestEntry &left, const RecentRequestEntry &right) const { const RecentRequestEntry *pLeft = &left; const RecentRequestEntry *pRight = &right; if (order == Qt::DescendingOrder) { diff --git a/src/random.cpp b/src/random.cpp --- a/src/random.cpp +++ b/src/random.cpp @@ -761,8 +761,8 @@ rng.SetKey(seed.begin(), 32); } -FastRandomContext &FastRandomContext:: -operator=(FastRandomContext &&from) noexcept { +FastRandomContext & +FastRandomContext::operator=(FastRandomContext &&from) noexcept { requires_seed = from.requires_seed; rng = from.rng; std::copy(std::begin(from.bytebuf), std::end(from.bytebuf),