diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index fb003981cc4ee..13409305654f8 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -41,7 +41,7 @@ export RUN_INTEGRATION_TESTS=${RUN_INTEGRATION_TESTS:-true} export RUN_SECURITY_TESTS=${RUN_SECURITY_TESTS:-false} export TEST_PREVIOUS_RELEASES=${TEST_PREVIOUS_RELEASES:-false} export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false} -export RUN_SYMBOL_TESTS=${RUN_SYMBOL_TESTS:-true} +export RUN_SYMBOL_TESTS=${RUN_SYMBOL_TESTS:-false} export CONTAINER_NAME=${CONTAINER_NAME:-ci_unnamed} export DOCKER_NAME_TAG=${DOCKER_NAME_TAG:-ubuntu:focal} # Randomize test order. diff --git a/ci/test/00_setup_env_mac.sh b/ci/test/00_setup_env_mac.sh index befdb2dbab0a5..c59da20c98850 100755 --- a/ci/test/00_setup_env_mac.sh +++ b/ci/test/00_setup_env_mac.sh @@ -9,8 +9,8 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_macos_cross export HOST=x86_64-apple-darwin export PACKAGES="cmake libcap-dev libz-dev libbz2-dev python3-dev python3-setuptools" -export XCODE_VERSION=12.2 -export XCODE_BUILD_ID=12B45b +export XCODE_VERSION=15.0 +export XCODE_BUILD_ID=15A240d export RUN_UNIT_TESTS=false export RUN_INTEGRATION_TESTS=false export GOAL="all deploy" diff --git a/configure.ac b/configure.ac index 8115ca67b3c8f..eda39bf041653 100644 --- a/configure.ac +++ b/configure.ac @@ -62,18 +62,8 @@ case $host in ;; esac -AC_ARG_ENABLE([c++20], - [AS_HELP_STRING([--enable-c++20], - [enable compilation in c++20 mode (disabled by default)])], - [use_cxx20=$enableval], - [use_cxx20=no]) - -dnl Require C++17 or C++20 compiler (no GNU extensions) -if test "x$use_cxx20" = xyes; then - AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) -else - AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) -fi +dnl Require C++20 compiler (no GNU extensions) +AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) dnl Check if -latomic is required for CHECK_ATOMIC diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index 8d404d8edc770..c629312b5782f 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:focal +FROM ubuntu:jammy # Needed to prevent tzdata hanging while expecting user input ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" @@ -11,7 +11,7 @@ ENV APT_ARGS="-y --no-install-recommends --no-upgrade" # Install packages for i386; disabled on aarch64 and arm64 hosts RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || dpkg --add-architecture i386) RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || (apt-get update && apt-get install $APT_ARGS \ - g++-9-multilib \ + g++-12-multilib \ wine32) && rm -rf /var/lib/apt/lists/*) RUN apt-get update && apt-get install $APT_ARGS \ @@ -23,10 +23,10 @@ RUN apt-get update && apt-get install $APT_ARGS \ bsdmainutils \ curl \ ccache \ - clang \ + clang-15 \ cmake \ git \ - g++ \ + g++-12 \ gettext \ libtool \ libxcb-icccm4 \ @@ -98,7 +98,7 @@ RUN useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /home/dash dash RUN apt-get update && apt-get install $APT_ARGS \ bc \ gawk \ - g++-arm-linux-gnueabihf \ + g++-12-arm-linux-gnueabihf \ g++-mingw-w64-x86-64 \ jq \ libcap-dev \ @@ -133,6 +133,8 @@ RUN ln -s x86_64-linux-gnu/asm /usr/include/asm RUN \ update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix; \ update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; \ + update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-12 50; \ + update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-12 50; \ exit 0 ARG LLVM_VERSION=15 diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index 39127e9782c06..005039604caaf 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -224,7 +224,7 @@ def check_MACHO_min_os(binary) -> bool: return False def check_MACHO_sdk(binary) -> bool: - if binary.build_version.sdk == [11, 0, 0]: + if binary.build_version.sdk == [14, 0, 0]: return True return False diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 648420f023f78..0bd4529f7330b 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -133,7 +133,7 @@ chain for " target " development.")) (home-page (package-home-page xgcc)) (license (package-license xgcc))))) -(define base-gcc gcc-10) +(define base-gcc gcc-12) (define base-linux-kernel-headers linux-libre-headers-5.15) ;; https://gcc.gnu.org/install/configure.html @@ -196,10 +196,6 @@ chain for " target " development.")) (home-page (package-home-page pthreads-xgcc)) (license (package-license pthreads-xgcc))))) -(define (make-nsis-for-gcc-10 base-nsis) - (package-with-extra-patches base-nsis - (search-our-patches "nsis-gcc-10-memmove.patch"))) - (define osslsigncode (package (name "osslsigncode") @@ -593,9 +589,9 @@ parse, modify and abstract ELF, PE and MachO formats.") automake pkg-config bison - ;; Native GCC 10 toolchain - gcc-toolchain-10 - (list gcc-toolchain-10 "static") + ;; Native GCC 12 toolchain + gcc-toolchain-12 + (list gcc-toolchain-12 "static") ;; Scripting python-minimal ;; (3.9) ;; Git @@ -607,10 +603,10 @@ parse, modify and abstract ELF, PE and MachO formats.") ;; Windows (list zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") - (make-nsis-for-gcc-10 nsis-x86_64) + nsis-x86_64 osslsigncode)) ((string-contains target "-linux-") (list (make-bitcoin-cross-toolchain target))) ((string-contains target "darwin") - (list clang-toolchain-10 binutils cmake-minimal xorriso python-signapple)) + (list clang-toolchain-15 binutils cmake-minimal xorriso python-signapple)) (else '()))))) diff --git a/contrib/guix/patches/nsis-gcc-10-memmove.patch b/contrib/guix/patches/nsis-gcc-10-memmove.patch deleted file mode 100644 index a1aadfd4f3618..0000000000000 --- a/contrib/guix/patches/nsis-gcc-10-memmove.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit f6df41524e703dc471e283e566a48e05a735b7f2 -Author: Anders -Date: Sat Jun 27 23:18:45 2020 +0000 - - Don't let GCC 10 generate memmove calls (bug #1248) - - git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7189 212acab6-be3b-0410-9dea-997c60f758d6 - -diff --git a/SCons/Config/gnu b/SCons/Config/gnu -index bfcb362d..21fa446b 100644 ---- a/SCons/Config/gnu -+++ b/SCons/Config/gnu -@@ -103,6 +103,10 @@ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries - stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align - stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file - -+conf = FlagsConfigure(stub_env) -+conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248) -+conf.Finish() -+ - stub_uenv = stub_env.Clone() - stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE']) - diff --git a/contrib/guix/patches/vmov-alignment.patch b/contrib/guix/patches/vmov-alignment.patch index 7976b864af0f2..96e1cb7cd19f1 100644 --- a/contrib/guix/patches/vmov-alignment.patch +++ b/contrib/guix/patches/vmov-alignment.patch @@ -168,14 +168,19 @@ Based on a patch originally by Claude Heiland-Allen default: gcc_unreachable (); } ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -4981,13 +4981,13 @@ - switch (type) +--- a/gcc/config/i386/i386.cc ++++ b/gcc/config/i386/i386.cc +@@ -5418,17 +5418,15 @@ ix86_get_ssemov (rtx *operands, unsigned size, { case opcode_int: -- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; -+ opcode = "vmovdqu32"; + if (scalar_mode == E_HFmode) +- opcode = (misaligned_p +- ? (TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64") +- : "vmovdqa64"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; + else +- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; ++ opcode = "vmovdqu32"; break; case opcode_float: - opcode = misaligned_p ? "vmovups" : "vmovaps"; @@ -187,9 +192,24 @@ Based on a patch originally by Claude Heiland-Allen break; } } -@@ -4996,16 +4996,16 @@ - switch (scalar_mode) +@@ -5438,29 +5436,21 @@ ix86_get_ssemov (rtx *operands, unsigned size, { + case E_HFmode: + if (evex_reg_p) +- opcode = (misaligned_p +- ? (TARGET_AVX512BW +- ? "vmovdqu16" +- : "vmovdqu64") +- : "vmovdqa64"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; + else +- opcode = (misaligned_p +- ? (TARGET_AVX512BW +- ? "vmovdqu16" +- : "%vmovdqu") +- : "%vmovdqa"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "%vmovdqu"; + break; case E_SFmode: - opcode = misaligned_p ? "%vmovups" : "%vmovaps"; + opcode = "%vmovups"; @@ -208,7 +228,7 @@ Based on a patch originally by Claude Heiland-Allen break; default: gcc_unreachable (); -@@ -5017,48 +5017,32 @@ +@@ -5472,48 +5462,32 @@ ix86_get_ssemov (rtx *operands, unsigned size, { case E_QImode: if (evex_reg_p) diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md index 3c38ad62b592b..25ae7fb54c3f2 100644 --- a/contrib/macdeploy/README.md +++ b/contrib/macdeploy/README.md @@ -12,50 +12,49 @@ When complete, it will have produced `Dash-Qt.dmg`. ### Step 1: Obtaining `Xcode.app` -Our current macOS SDK -(`Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz`) can be +Our macOS SDK can be extracted from -[Xcode_12.2.xip](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip). +[Xcode_15.xip](https://download.developer.apple.com/Developer_Tools/Xcode_15/Xcode_15.xip). Alternatively, after logging in to your account go to 'Downloads', then 'More' -and look for [`Xcode_12.2`](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip). +and search for [`Xcode 15`](https://developer.apple.com/download/all/?q=Xcode%2015). + An Apple ID and cookies enabled for the hostname are needed to download this. -The `sha256sum` of the archive should be `28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0`. +The `sha256sum` of the archive should be `4daaed2ef2253c9661779fa40bfff50655dc7ec45801aba5a39653e7bcdde48e`. -After Xcode version 7.x, Apple started shipping the `Xcode.app` in a `.xip` -archive. This makes the SDK less-trivial to extract on non-macOS machines. One -approach (tested on Debian Buster) is outlined below: +To extract the `.xip` on Linux: ```bash # Install/clone tools needed for extracting Xcode.app apt install cpio git clone https://github.com/bitcoin-core/apple-sdk-tools.git -# Unpack Xcode_12.2.xip and place the resulting Xcode.app in your current +# Unpack the .xip and place the resulting Xcode.app in your current # working directory -python3 apple-sdk-tools/extract_xcode.py -f Xcode_12.2.xip | cpio -d -i +python3 apple-sdk-tools/extract_xcode.py -f Xcode_15.xip | cpio -d -i ``` -On macOS the process is more straightforward: +On macOS: ```bash -xip -x Xcode_12.2.xip +xip -x Xcode_15.xip ``` -### Step 2: Generating `Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz` from `Xcode.app` +### Step 2: Generating the SDK tarball from `Xcode.app` -To generate `Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz`, run -the script [`gen-sdk`](./gen-sdk) with the path to `Xcode.app` (extracted in the -previous stage) as the first argument. +To generate the SDK, run the script [`gen-sdk`](./gen-sdk) with the +path to `Xcode.app` (extracted in the previous stage) as the first argument. ```bash -# Generate a Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz from -# the supplied Xcode.app ./contrib/macdeploy/gen-sdk '/path/to/Xcode.app' ``` -## Deterministic macOS DMG Notes -Working macOS DMGs are created in Linux by combining a recent `clang`, the Apple -`binutils` (`ld`, `ar`, etc) and DMG authoring tools. +The generated archive should be: `Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz`. +The `sha256sum` should be `70cccc19df2fc1746bfddf939bf7370eb0b3d8f5f7198896358fa1ebde37e9e7`. + +## Deterministic macOS App Notes + +macOS Applications are created in Linux by combining a recent `clang` and the Apple +`binutils` (`ld`, `ar`, etc). Apple uses `clang` extensively for development and has upstreamed the necessary functionality so that a vanilla clang can take advantage. It supports the use of `-F`, diff --git a/contrib/macdeploy/gen-sdk b/contrib/macdeploy/gen-sdk index e4794846e2b7b..ce4f24f9d4ed6 100755 --- a/contrib/macdeploy/gen-sdk +++ b/contrib/macdeploy/gen-sdk @@ -47,9 +47,6 @@ def run(): out_name = "Xcode-{xcode_version}-{xcode_build_id}-extracted-SDK-with-libcxx-headers".format(xcode_version=xcode_version, xcode_build_id=xcode_build_id) - xcode_libcxx_dir = xcode_app.joinpath("Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1") - assert xcode_libcxx_dir.is_dir() - if args.out_sdktgz: out_sdktgz_path = pathlib.Path(args.out_sdktgz_path) else: @@ -57,7 +54,7 @@ def run(): out_sdktgz_path = pathlib.Path("./{}.tar.gz".format(out_name)) def tarfp_add_with_base_change(tarfp, dir_to_add, alt_base_dir): - """Add all files in dir_to_add to tarfp, but prepent MEMBERPREFIX to the file's + """Add all files in dir_to_add to tarfp, but prepent alt_base_dir to the file's name e.g. if the only file under /root/bazdir is /root/bazdir/qux, invoking: @@ -77,7 +74,8 @@ def run(): tarinfo.linkname = str(pathlib.Path(alt_base_dir, tarinfo.linkname)) return tarinfo with cd(dir_to_add): - tarfp.add(".", recursive=True, filter=change_tarinfo_base) + tarfp.add("./usr/include", recursive=True, filter=change_tarinfo_base) + tarfp.add("./usr/lib", recursive=True, filter=change_tarinfo_base) print("Creating output .tar.gz file...") with out_sdktgz_path.open("wb") as fp: @@ -85,8 +83,6 @@ def run(): with tarfile.open(mode="w", fileobj=gzf) as tarfp: print("Adding MacOSX SDK {} files...".format(sdk_version)) tarfp_add_with_base_change(tarfp, sdk_dir, out_name) - print("Adding libc++ headers...") - tarfp_add_with_base_change(tarfp, xcode_libcxx_dir, "{}/usr/include/c++/v1".format(out_name)) print("Done! Find the resulting gzipped tarball at:") print(out_sdktgz_path.resolve()) diff --git a/depends/Makefile b/depends/Makefile index ab641bc6db6df..21ddb21b84995 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -40,6 +40,9 @@ NO_UPNP ?= NO_NATPMP ?= FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources +#C_STANDARD ?= c11 +#CXX_STANDARD ?= c++20 + BUILD = $(shell ./config.guess) HOST ?= $(BUILD) PATCHES_PATH = $(BASEDIR)/patches diff --git a/depends/README.md b/depends/README.md index 9f29498cdb918..076f0fafeab61 100644 --- a/depends/README.md +++ b/depends/README.md @@ -47,7 +47,7 @@ The paths are automatically configured and no other options are needed unless ta #### For macOS cross compilation - sudo apt-get install curl bsdmainutils cmake libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5 xorriso + sudo apt-get install curl bsdmainutils cmake libcap-dev libz-dev libbz2-dev python3-setuptools xorriso Note: You must obtain the macOS SDK before proceeding with a cross-compile. Under the depends directory, create a subdirectory named `SDKs`. diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 1f09b15f1a185..1666b1fd6d265 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,7 +1,7 @@ OSX_MIN_VERSION=10.15 -OSX_SDK_VERSION=11.0 -XCODE_VERSION=12.2 -XCODE_BUILD_ID=12B45b +OSX_SDK_VERSION=14.0 +XCODE_VERSION=15.0 +XCODE_BUILD_ID=15A240d LD64_VERSION=609 OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 30f22365a6833..14bf4e5f1702a 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -1,8 +1,8 @@ package=boost -$(package)_version=1_73_0 -$(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$(subst _,.,$($(package)_version))/source/ -$(package)_file_name=boost_$($(package)_version).tar.bz2 -$(package)_sha256_hash=4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 +$(package)_version=1.81.0 +$(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$($(package)_version)/source/ +$(package)_file_name=boost_$(subst .,_,$($(package)_version)).tar.bz2 +$(package)_sha256_hash=71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa $(package)_dependencies=native_b2 define $(package)_set_vars @@ -39,14 +39,6 @@ $(package)_cxxflags_android=-fPIC $(package)_cxxflags_x86_64=-fcf-protection=full endef -# Fix unused variable in boost_process, can be removed after upgrading to 1.72 -# Fix missing unary_function in clang15 on macos, can be removed after upgrading to 1.81 -define $(package)_preprocess_cmds - sed -i.old "s/int ret_sig = 0;//" boost/process/detail/posix/wait_group.hpp && \ - sed -i.old "s/unary_function/$(unary_function)/" boost/container_hash/hash.hpp && \ - echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cflags)\" \"$($(package)_cxxflags)\" \"$($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$($(package)_ar)\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam -endef - define $(package)_config_cmds ./bootstrap.sh --without-icu --with-libraries=$($(package)_config_libraries) --with-toolset=$($(package)_toolset_$(host_os)) --with-bjam=b2 endef diff --git a/depends/packages/native_clang.mk b/depends/packages/native_clang.mk index f2712294ab20e..5f7d440cc38ea 100644 --- a/depends/packages/native_clang.mk +++ b/depends/packages/native_clang.mk @@ -1,12 +1,12 @@ package=native_clang -$(package)_version=10.0.1 +$(package)_version=15.0.6 $(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version) ifneq (,$(findstring aarch64,$(BUILD))) $(package)_file_name=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz -$(package)_sha256_hash=90dc69a4758ca15cd0ffa45d07fbf5bf4309d47d2c7745a9f0735ecffde9c31f +$(package)_sha256_hash=8ca4d68cf103da8331ca3f35fe23d940c1b78fb7f0d4763c1c059e352f5d1bec else -$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz -$(package)_sha256_hash=48b83ef827ac2c213d5b64f5ad7ed082c8bcb712b46644e0dc5045c6f462c231 +$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-18.04.tar.xz +$(package)_sha256_hash=38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036 endif define $(package)_preprocess_cmds diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 80b2300f73d9b..7f078b31650d6 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -1,9 +1,9 @@ package=qt -$(package)_version=5.15.5 +$(package)_version=5.15.10 $(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules $(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz $(package)_file_name=qtbase-$($(package)_suffix) -$(package)_sha256_hash=0c42c799aa7c89e479a07c451bf5a301e291266ba789e81afc18f95049524edc +$(package)_sha256_hash=c0d06cb18d20f10bf7ad53552099e097ec39362d30a5d6f104724f55fa1c8fb9 $(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm $(package)_qt_libs=corelib network widgets gui plugins testlib $(package)_linguist_tools = lrelease lupdate lconvert @@ -13,8 +13,6 @@ $(package)_patches += mac-qmake.conf $(package)_patches += fix_qt_pkgconfig.patch $(package)_patches += fix_qt_placeholders.patch $(package)_patches += no-xlib.patch -$(package)_patches += dont_hardcode_x86_64.patch -$(package)_patches += fix_montery_include.patch $(package)_patches += fix_android_jni_static.patch $(package)_patches += dont_hardcode_pwd.patch $(package)_patches += qtbase-moc-ignore-gcc-macro.patch @@ -25,12 +23,13 @@ $(package)_patches += guix_cross_lib_path.patch $(package)_patches += fast_fixed_dtoa_no_optimize.patch $(package)_patches += fix-macos-linker.patch $(package)_patches += memory_resource.patch +$(package)_patches += cpp20_ambiguous.patch $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) -$(package)_qttranslations_sha256_hash=c92af4171397a0ed272330b4fa0669790fcac8d050b07c8b8cc565ebeba6735e +$(package)_qttranslations_sha256_hash=38b942bc7e62794dd072945c8a92bb9dfffed24070aea300327a3bb42f855609 $(package)_qttools_file_name=qttools-$($(package)_suffix) -$(package)_qttools_sha256_hash=6d0778b71b2742cb527561791d1d3d255366163d54a10f78c683a398f09ffc6c +$(package)_qttools_sha256_hash=66f46c9729c831dce431778a9c561cca32daceaede1c7e58568d7a5898167dae $(package)_extra_sources = $($(package)_qttranslations_file_name) $(package)_extra_sources += $($(package)_qttools_file_name) @@ -41,7 +40,7 @@ $(package)_config_opts_release += -silent $(package)_config_opts_debug = -debug $(package)_config_opts_debug += -optimized-tools $(package)_config_opts += -bindir $(build_prefix)/bin -$(package)_config_opts += -c++std c++17 +$(package)_config_opts += -c++std c++2a $(package)_config_opts += -confirm-license $(package)_config_opts += -hostprefix $(build_prefix) $(package)_config_opts += -no-compile-examples @@ -255,8 +254,6 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/fix_qt_placeholders.patch && \ patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch && \ patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \ - patch -p1 -i $($(package)_patch_dir)/dont_hardcode_x86_64.patch && \ - patch -p1 -i $($(package)_patch_dir)/fix_montery_include.patch && \ patch -p1 -i $($(package)_patch_dir)/use_android_ndk23.patch && \ patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \ patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \ diff --git a/depends/patches/qt/cpp20_ambiguous.patch b/depends/patches/qt/cpp20_ambiguous.patch new file mode 100644 index 0000000000000..e38803a169334 --- /dev/null +++ b/depends/patches/qt/cpp20_ambiguous.patch @@ -0,0 +1,24 @@ +X-Git-Url: https://codereview.qt-project.org/gitweb?p=qt%2Fqtbase.git;a=blobdiff_plain;f=src%2Fgui%2Ftext%2Fqfontdatabase.cpp;h=cd1cad6603b889de204a8614c43c37273d48f650;hp=1f9e8994134e415e1fd3bdf7f88339ce87e2535b;hb=962576790d21e32b745fb339247ef33c13b81e34;hpb=54c2cebabdda0280b8443c6947b6fee02445e138 + +diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp +index 1f9e8994134e..cd1cad6603b8 100644 +--- a/src/gui/text/qfontdatabase.cpp ++++ b/src/gui/text/qfontdatabase.cpp +@@ -194,14 +194,14 @@ struct QtFontStyle + signed int weight : 8; + signed int stretch : 12; + +- bool operator==(const Key & other) { ++ bool operator==(const Key & other) const { + return (style == other.style && weight == other.weight && + (stretch == 0 || other.stretch == 0 || stretch == other.stretch)); + } +- bool operator!=(const Key &other) { ++ bool operator!=(const Key &other) const { + return !operator==(other); + } +- bool operator <(const Key &o) { ++ bool operator <(const Key &o) const { + int x = (style << 12) + (weight << 14) + stretch; + int y = (o.style << 12) + (o.weight << 14) + o.stretch; + return (x < y); \ No newline at end of file diff --git a/depends/patches/qt/dont_hardcode_x86_64.patch b/depends/patches/qt/dont_hardcode_x86_64.patch deleted file mode 100644 index a66426877ad78..0000000000000 --- a/depends/patches/qt/dont_hardcode_x86_64.patch +++ /dev/null @@ -1,119 +0,0 @@ -macOS: Don't hard-code x86_64 as the architecture when using qmake - -Upstream commit: - - Qt 6.1: 9082cc8e8d5a6441dabe5e7a95bc0cd9085b95fe - -For other Qt branches see -https://codereview.qt-project.org/q/I70db7e4c27f0d3da5d0af33cb491d72c312d3fa8 - - ---- old/qtbase/configure.json -+++ new/qtbase/configure.json -@@ -244,11 +244,18 @@ - - "testTypeDependencies": { - "linkerSupportsFlag": [ "use_bfd_linker", "use_gold_linker", "use_lld_linker" ], -- "verifySpec": [ "shared", "use_bfd_linker", "use_gold_linker", "use_lld_linker", "compiler-flags", "qmakeargs", "commit" ], -+ "verifySpec": [ -+ "shared", -+ "use_bfd_linker", "use_gold_linker", "use_lld_linker", -+ "compiler-flags", "qmakeargs", -+ "simulator_and_device", -+ "thread", -+ "commit" ], - "compile": [ "verifyspec" ], - "detectPkgConfig": [ "cross_compile", "machineTuple" ], - "library": [ "pkg-config", "compiler-flags" ], -- "getPkgConfigVariable": [ "pkg-config" ] -+ "getPkgConfigVariable": [ "pkg-config" ], -+ "architecture" : [ "verifyspec" ] - }, - - "testTypeAliases": { -@@ -762,7 +769,7 @@ - }, - "architecture": { - "label": "Architecture", -- "output": [ "architecture" ] -+ "output": [ "architecture", "commitConfig" ] - }, - "pkg-config": { - "label": "Using pkg-config", -diff --git a/configure.pri b/configure.pri -index 49755f7abfd..8be9b10d7d4 100644 ---- old/qtbase/configure.pri -+++ new/qtbase/configure.pri -@@ -662,6 +662,13 @@ defineTest(qtConfOutput_commitOptions) { - write_file($$QT_BUILD_TREE/mkspecs/qdevice.pri, $${currentConfig}.output.devicePro)|error() - } - -+# Output is written after configuring each Qt module, -+# but some tests within a module might depend on the -+# configuration output of previous tests. -+defineTest(qtConfOutput_commitConfig) { -+ qtConfProcessOutput() -+} -+ - # type (empty or 'host'), option name, default value - defineTest(processQtPath) { - out_var = config.rel_input.$${2} -diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf -index d16b77acb8e..4ba0a8eaa36 100644 ---- old/qtbase/mkspecs/common/macx.conf -+++ new/qtbase/mkspecs/common/macx.conf -@@ -6,7 +6,6 @@ QMAKE_PLATFORM += macos osx macx - QMAKE_MAC_SDK = macosx - - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13 --QMAKE_APPLE_DEVICE_ARCHS = x86_64 - - # Should be 10.15, but as long as the CI builds with - # older SDKs we have to keep this. -diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf -index 92a9112bca6..d888731ec8d 100644 ---- old/qtbase/mkspecs/features/mac/default_post.prf -+++ new/qtbase/mkspecs/features/mac/default_post.prf -@@ -95,6 +95,11 @@ app_extension_api_only { - QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - } - -+# Non-universal builds do not set QMAKE_APPLE_DEVICE_ARCHS, -+# so we pick it up from what the arch test resolved instead. -+isEmpty(QMAKE_APPLE_DEVICE_ARCHS): \ -+ QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCH -+ - macx-xcode { - qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO - !isEmpty(QMAKE_PKGINFO_TYPEINFO): \ -@@ -150,9 +155,6 @@ macx-xcode { - simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS - VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS - -- isEmpty(VALID_ARCHS): \ -- error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture") -- - single_arch: VALID_ARCHS = $$first(VALID_ARCHS) - - ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS)) -diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf -index efbe7c1e55b..8add6dc8043 100644 ---- old/qtbase/mkspecs/features/toolchain.prf -+++ new/qtbase/mkspecs/features/toolchain.prf -@@ -182,9 +182,14 @@ isEmpty($${target_prefix}.INCDIRS) { - # UIKit simulator platforms will see the device SDK's sysroot in - # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. - darwin { -- # Clang doesn't pick up the architecture from the sysroot, and will -- # default to the host architecture, so we need to manually set it. -- cxx_flags += -arch $$QMAKE_APPLE_DEVICE_ARCHS -+ uikit { -+ # Clang doesn't automatically pick up the architecture, just because -+ # we're passing the iOS sysroot below, and we will end up building the -+ # test for the host architecture, resulting in linker errors when -+ # linking against the iOS libraries. We work around this by passing -+ # the architecture explicitly. -+ cxx_flags += -arch $$first(QMAKE_APPLE_DEVICE_ARCHS) -+ } - - uikit:macx-xcode: \ - cxx_flags += -isysroot $$sdk_path_device.value diff --git a/depends/patches/qt/fix-macos-linker.patch b/depends/patches/qt/fix-macos-linker.patch index db056de4d9b25..e439685656550 100644 --- a/depends/patches/qt/fix-macos-linker.patch +++ b/depends/patches/qt/fix-macos-linker.patch @@ -29,7 +29,7 @@ https://codereview.qt-project.org/q/I2347b26e2df0828471373b0e15b8c9089274c65d --- old/qtbase/mkspecs/features/toolchain.prf +++ new/qtbase/mkspecs/features/toolchain.prf -@@ -283,9 +283,12 @@ isEmpty($${target_prefix}.INCDIRS) { +@@ -288,9 +288,12 @@ isEmpty($${target_prefix}.INCDIRS) { } } } @@ -44,7 +44,7 @@ https://codereview.qt-project.org/q/I2347b26e2df0828471373b0e15b8c9089274c65d QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) } else: ghs { cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp -@@ -407,7 +410,7 @@ isEmpty($${target_prefix}.INCDIRS) { +@@ -412,7 +415,7 @@ isEmpty($${target_prefix}.INCDIRS) { QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP) } diff --git a/depends/patches/qt/fix_android_jni_static.patch b/depends/patches/qt/fix_android_jni_static.patch index 936b82e1522e3..7dbd68fe9c818 100644 --- a/depends/patches/qt/fix_android_jni_static.patch +++ b/depends/patches/qt/fix_android_jni_static.patch @@ -1,6 +1,6 @@ --- old/qtbase/src/plugins/platforms/android/androidjnimain.cpp +++ new/qtbase/src/plugins/platforms/android/androidjnimain.cpp -@@ -943,6 +943,14 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) +@@ -980,6 +980,14 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed"); return -1; } diff --git a/depends/patches/qt/fix_montery_include.patch b/depends/patches/qt/fix_montery_include.patch deleted file mode 100644 index f2d033a7888b3..0000000000000 --- a/depends/patches/qt/fix_montery_include.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Øystein Heskestad -Date: Wed, 27 Oct 2021 13:07:46 +0200 -Subject: [PATCH] Add missing macOS header file that was indirectly included before - -See: https://bugreports.qt.io/browse/QTBUG-97855 - -Upstream Commits: - - Qt 6.2: c884bf138a21dd7320e35cef34d24e22e74d7ce0 - -diff --git a/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -index e070ba977d..0896917334 100644 ---- a/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -+++ b/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -@@ -43,6 +43,8 @@ - #include - #include - -+#include -+ - QT_BEGIN_NAMESPACE - - class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer diff --git a/depends/patches/qt/memory_resource.patch b/depends/patches/qt/memory_resource.patch index e41d68db30171..650c32852859d 100644 --- a/depends/patches/qt/memory_resource.patch +++ b/depends/patches/qt/memory_resource.patch @@ -17,7 +17,7 @@ and https://bugreports.qt.io/browse/QTBUG-114316 --- a/qtbase/src/corelib/global/qcompilerdetection.h +++ b/qtbase/src/corelib/global/qcompilerdetection.h -@@ -1041,16 +1041,22 @@ +@@ -1050,16 +1050,22 @@ # endif // !_HAS_CONSTEXPR # endif // !__GLIBCXX__ && !_LIBCPP_VERSION # endif // Q_OS_QNX diff --git a/depends/patches/qt/no-xlib.patch b/depends/patches/qt/no-xlib.patch index d6846aaca2c29..0f7965d2ea8b7 100644 --- a/depends/patches/qt/no-xlib.patch +++ b/depends/patches/qt/no-xlib.patch @@ -4,12 +4,7 @@ Date: Thu, 18 Jul 2019 17:22:05 -0400 Subject: [PATCH] Wrap xlib related code blocks in #if's They are not necessary to compile QT. ---- - qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) -diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp -index 7c62c2e2b3..c05c6c0a07 100644 --- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -49,7 +49,9 @@ @@ -22,7 +17,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 #include #include -@@ -391,6 +391,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) +@@ -391,6 +393,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window) xcb_flush(xcb_connection()); } @@ -30,7 +25,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 static int cursorIdForShape(int cshape) { int cursorId = 0; -@@ -444,6 +445,7 @@ static int cursorIdForShape(int cshape) +@@ -444,6 +447,7 @@ static int cursorIdForShape(int cshape) } return cursorId; } @@ -38,7 +33,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) { -@@ -556,7 +558,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) +@@ -558,7 +562,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { xcb_connection_t *conn = xcb_connection(); @@ -47,8 +42,8 @@ index 7c62c2e2b3..c05c6c0a07 100644 +#endif xcb_cursor_t cursor = XCB_NONE; - // Try Xcursor first -@@ -586,6 +590,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) +@@ -590,6 +596,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) // Non-standard X11 cursors are created from bitmaps cursor = createNonStandardCursor(cshape); @@ -56,7 +51,7 @@ index 7c62c2e2b3..c05c6c0a07 100644 // Create a glpyh cursor if everything else failed if (!cursor && cursorId) { cursor = xcb_generate_id(conn); -@@ -593,6 +598,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) +@@ -597,6 +604,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) cursorId, cursorId + 1, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); } @@ -64,6 +59,3 @@ index 7c62c2e2b3..c05c6c0a07 100644 if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { const char *name = cursorNames[cshape].front(); --- -2.22.0 - diff --git a/doc/dependencies.md b/doc/dependencies.md index 40fc07ee8c630..be0aa06a1300e 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -6,7 +6,7 @@ These are the dependencies currently used by Dash Core. You can find instruction | Dependency | Version used | Minimum required | CVEs | Shared | [Bundled Qt library](https://doc.qt.io/qt-5/configure-options.html#third-party-libraries) | | --- | --- | --- | --- | --- | --- | | Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | | -| Boost | [1.73.0](https://www.boost.org/users/download/) | [1.64.0](https://github.com/bitcoin/bitcoin/pull/22320) | No | | | +| Boost | [1.77.0](https://www.boost.org/users/download/) | [1.64.0](https://github.com/bitcoin/bitcoin/pull/22320) | No | | | | Clang[ \* ](#note1) | | [5.0+](https://releases.llvm.org/download.html) (C++17 support) | | | | | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | | FreeType | [2.11.0](https://download.savannah.gnu.org/releases/freetype) | | No | | [Yes](https://github.com/dashpay/dash/blob/develop/depends/packages/qt.mk) (Android only) | diff --git a/src/.clang-format b/src/.clang-format index 7e649de43fb4f..194a4b9005571 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -52,6 +52,5 @@ SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false -Standard: Cpp11 -TabWidth: 8 +Standard: c++20 UseTab: Never diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index 77986a288c903..2f67910e597ef 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -11,6 +11,7 @@ #include #include +#include template bool VerifyVectorHelper(Span vec) @@ -109,7 +110,7 @@ bool CBLSWorker::GenerateContributions(int quorumThreshold, Span ids, BL }; futures.emplace_back(workerPool.push(f)); } - return ranges::all_of(futures, [](auto& f){ + return std::ranges::all_of(futures, [](auto& f){ return f.get(); }); } diff --git a/src/coinjoin/coinjoin.h b/src/coinjoin/coinjoin.h index 8f56aa61b696d..eae68fac4f3f7 100644 --- a/src/coinjoin/coinjoin.h +++ b/src/coinjoin/coinjoin.h @@ -465,7 +465,7 @@ class CCoinJoin static constexpr int CalculateAmountPriority(CAmount nInputAmount) { - if (auto optDenom = ranges::find_if_opt(GetStandardDenominations(), [&nInputAmount](const auto& denom) { + if (auto optDenom = ranges_util::find_if_opt(GetStandardDenominations(), [&nInputAmount](const auto& denom) { return nInputAmount == denom; })) { return (float)COIN / *optDenom * 10000; diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 2a0bc7c9ef58b..98b5150bd9d85 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -116,7 +116,7 @@ CDeterministicMNCPtr CDeterministicMNList::GetValidMN(const uint256& proTxHash) CDeterministicMNCPtr CDeterministicMNList::GetMNByOperatorKey(const CBLSPublicKey& pubKey) const { - const auto it = ranges::find_if(mnMap, + const auto it = std::find_if(mnMap.begin(), mnMap.end(), [&pubKey](const auto& p){return p.second->pdmnState->pubKeyOperator.Get() == pubKey;}); if (it == mnMap.end()) { return nullptr; diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index 96e9e5ef4211b..3b6c06d1b31d4 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -239,17 +239,17 @@ class CDeterministicMNList [[nodiscard]] size_t GetValidMNsCount() const { - return ranges::count_if(mnMap, [this](const auto& p){ return IsMNValid(*p.second); }); + return std::count_if(mnMap.begin(), mnMap.end(), [this](const auto& p){ return IsMNValid(*p.second); }); } [[nodiscard]] size_t GetAllEvoCount() const { - return ranges::count_if(mnMap, [this](const auto& p) { return p.second->nType == MnType::Evo; }); + return std::count_if(mnMap.begin(), mnMap.end(), [this](const auto& p) { return p.second->nType == MnType::Evo; }); } [[nodiscard]] size_t GetValidEvoCount() const { - return ranges::count_if(mnMap, [this](const auto& p) { return p.second->nType == MnType::Evo && IsMNValid(*p.second); }); + return std::count_if(mnMap.begin(), mnMap.end(), [this](const auto& p) { return p.second->nType == MnType::Evo && IsMNValid(*p.second); }); } [[nodiscard]] size_t GetValidWeightedMNsCount() const diff --git a/src/leveldb/util/env_windows.cc b/src/leveldb/util/env_windows.cc index 1834206562cbd..4dcba222a1b52 100644 --- a/src/leveldb/util/env_windows.cc +++ b/src/leveldb/util/env_windows.cc @@ -798,7 +798,7 @@ class SingletonEnv { public: SingletonEnv() { #if !defined(NDEBUG) - env_initialized_.store(true, std::memory_order::memory_order_relaxed); + env_initialized_.store(true, std::memory_order_relaxed); #endif // !defined(NDEBUG) static_assert(sizeof(env_storage_) >= sizeof(EnvType), "env_storage_ will not fit the Env"); @@ -815,7 +815,7 @@ class SingletonEnv { static void AssertEnvNotInitialized() { #if !defined(NDEBUG) - assert(!env_initialized_.load(std::memory_order::memory_order_relaxed)); + assert(!env_initialized_.load(std::memory_order_relaxed)); #endif // !defined(NDEBUG) } diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 4cf0532978f24..801d181ada9ab 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -1046,7 +1046,7 @@ std::map GetEnabledQuorumVvecSyncEntries() throw std::invalid_argument(strprintf("Invalid format in -llmq-qvvec-sync: %s", strEntry)); } - if (auto optLLMQParams = ranges::find_if_opt(Params().GetConsensus().llmqs, + if (auto optLLMQParams = ranges_util::find_if_opt(Params().GetConsensus().llmqs, [&strLLMQType](const auto& params){return params.name == strLLMQType;})) { llmqType = optLLMQParams->type; } else { diff --git a/src/spork.cpp b/src/spork.cpp index 73873e05b3434..b7110393bc6af 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -272,7 +272,7 @@ SporkValue CSporkManager::GetSporkValue(SporkId nSporkID) const } - if (auto optSpork = ranges::find_if_opt(sporkDefs, + if (auto optSpork = ranges_util::find_if_opt(sporkDefs, [&nSporkID](const auto& sporkDef){return sporkDef.sporkId == nSporkID;})) { return optSpork->defaultValue; } else { @@ -283,7 +283,7 @@ SporkValue CSporkManager::GetSporkValue(SporkId nSporkID) const SporkId CSporkManager::GetSporkIDByName(std::string_view strName) { - if (auto optSpork = ranges::find_if_opt(sporkDefs, + if (auto optSpork = ranges_util::find_if_opt(sporkDefs, [&strName](const auto& sporkDef){return sporkDef.name == strName;})) { return optSpork->sporkId; } diff --git a/src/util/ranges.h b/src/util/ranges.h index dca6866eea31d..3885ee50996ae 100644 --- a/src/util/ranges.h +++ b/src/util/ranges.h @@ -8,9 +8,10 @@ #include #include -//#if __cplusplus > 201703L // C++20 compiler -//namespace ranges = std::ranges; -//#else +#if __cplusplus > 201703L // C++20 compiler +#include +namespace ranges = std::ranges; +#else #define MK_RANGE(FUN) \ template \ @@ -28,7 +29,11 @@ namespace ranges { MK_RANGE(any_of) MK_RANGE(count_if) MK_RANGE(find_if) +} + +#endif // C++20 compiler +namespace ranges_util { template constexpr inline auto find_if_opt(const X& ds, const Z& fn) { const auto it = ranges::find_if(ds, fn); @@ -37,8 +42,6 @@ namespace ranges { } return std::optional>{}; } - } -//#endif // C++20 compiler #endif // BITCOIN_UTIL_RANGES_H