Merge bitcoin/bitcoin#33555: build: Bump clang minimum supported version to 17

fa0fa0f70087d08fe5a54832b96799bd14293279 refactor: Revert "disable self-assign warning for tests" (MarcoFalke)
faed118fb30fbc303e9d4c70569abfee397f1759 build: Bump clang minimum supported version to 17 (MarcoFalke)

Pull request description:

  Most supported operating systems ship with clang-17 (or later), so bump the minimum to that and allow new code to drop workarounds for previous clang bugs.

  (Apart from dropping the small workaround, this bump allows the `ci_native_nowallet_libbitcoinkernel` CI to run on riscv64 without running into an ICE with clang-16.)

  This patch will only be released in version 31.x, next year (2026).

  For reference:

  * https://packages.debian.org/bookworm/clang-19
  * https://packages.ubuntu.com/noble/clang (clang-18)
  * CentOS-like 8/9/10 ship clang-17 (and later) via Stream
  * FreeBSD 12/13 ship clang-17 (and later) via packages
  * OpenSuse Tumbleweed ships with https://software.opensuse.org/package/clang (clang21); No idea about OpenSuse Leap

  On operating systems where the clang version is not shipped by default, the user would have to use GCC, or install clang in a different way. For example:

  * https://packages.debian.org/bookworm/g++ (g++-12)
  * https://packages.ubuntu.com/jammy/g++ (g++-11)
  * https://apt.llvm.org/, or nix, or guix, or compile clang from source, ...

  *Ubuntu 22.04 LTS does not ship with clang-16 (the previous minimum required), nor with clang-17, so one of the above workarounds is needed there.*

  macOS 14 is unaffected, and the previous minimum requirement of Xcode15.0 remains, see also 919e6d01e9/depends/hosts/darwin.mk (L3-L4). (Modulo compiling the fuzz tests, which requires 919e6d01e9/.github/workflows/ci.yml (L149))

ACKs for top commit:
  janb84:
    Concept ACK fa0fa0f70087d08fe5a54832b96799bd14293279
  l0rinc:
    Code review ACK fa0fa0f70087d08fe5a54832b96799bd14293279
  hebasto:
    ACK fa0fa0f70087d08fe5a54832b96799bd14293279.

Tree-SHA512: 5973cec39982f80b8b43e493cde012d9d1ab75a0362300b007d155db9f871c6341e7e209e5e63f0c3ca490136b684683de270136d62cb56f6b00b0ac0331dc36
This commit is contained in:
merge-script 2025-10-29 16:53:42 +00:00
commit 72511fd02e
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
6 changed files with 10 additions and 37 deletions

View File

@ -7,10 +7,10 @@
export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel
export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:bookworm"
# Use minimum supported python3.10 (or best-effort 3.11) and clang-16, see doc/dependencies.md
export PACKAGES="python3-zmq python3-pip clang-16 llvm-16 libc++abi-16-dev libc++-16-dev"
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
# Use minimum supported python3.10 (or best-effort 3.12) and clang-17, see doc/dependencies.md
export PACKAGES="python3-zmq python3-pip clang-17 llvm-17 libc++abi-17-dev libc++-17-dev"
export PIP_PACKAGES="--break-system-packages pycapnp"
export DEP_OPTS="NO_WALLET=1 CC=clang-16 CXX='clang++-16 -stdlib=libc++'"
export DEP_OPTS="NO_WALLET=1 CC=clang-17 CXX='clang++-17 -stdlib=libc++'"
export GOAL="install"
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_UTIL_CHAINSTATE=ON -DBUILD_KERNEL_LIB=ON -DBUILD_SHARED_LIBS=ON"

View File

@ -10,7 +10,7 @@ Bitcoin Core requires one of the following compilers.
| Dependency | Minimum required |
| --- | --- |
| [Clang](https://clang.llvm.org) | [16.0](https://github.com/bitcoin/bitcoin/pull/30263) |
| [Clang](https://clang.llvm.org) | [17.0](https://github.com/bitcoin/bitcoin/pull/33555) |
| [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) |
## Required

View File

@ -0,0 +1,5 @@
Build System
------------
- The minimum supported Clang compiler version has been raised to 17.0
(#33555).

View File

@ -580,20 +580,6 @@ BOOST_AUTO_TEST_CASE(conversion)
BOOST_AUTO_TEST_CASE(operator_with_self)
{
/* Clang 16 and earlier detects v -= v and v /= v as self-assignments
to 0 and 1 respectively.
See: https://github.com/llvm/llvm-project/issues/42469
and the fix in commit c5302325b2a62d77cf13dd16cd5c19141862fed0 .
This makes some sense for arithmetic classes, but could be considered a bug
elsewhere. Disable the warning here so that the code can be tested, but the
warning should remain on as there will likely always be a better way to
express this.
*/
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
arith_uint256 v{2};
v *= v;
BOOST_CHECK_EQUAL(v, arith_uint256{4});
@ -603,9 +589,6 @@ BOOST_AUTO_TEST_CASE(operator_with_self)
BOOST_CHECK_EQUAL(v, arith_uint256{2});
v -= v;
BOOST_CHECK_EQUAL(v, arith_uint256{0});
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -199,19 +199,7 @@ FUZZ_TARGET(muhash)
},
[&] {
// Test that dividing a MuHash by itself brings it back to its initial state
// See note about clang + self-assignment in test/uint256_tests.cpp
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
muhash /= muhash;
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
muhash.Finalize(out);
out2 = initial_state_hash;
},

View File

@ -14,9 +14,6 @@ namespace util {
//! Implementation comes from and example usage can be found at
//! https://en.cppreference.com/w/cpp/utility/variant/visit#Example
template<class... Ts> struct Overloaded : Ts... { using Ts::operator()...; };
//! Explicit deduction guide (not needed after clang-17)
template<class... Ts> Overloaded(Ts...) -> Overloaded<Ts...>;
} // namespace util
#endif // BITCOIN_UTIL_OVERLOADED_H