Skip to content

Commit ea79265

Browse files
committed
Merge #20413: build: Require C++17 compiler
fac7198 Use std::make_unique (MarcoFalke) faaee81 build: Require C++17 compiler (MarcoFalke) Pull request description: Developers have been compiling with C++17 for a few months now (fuzz tests and the msvc build have it even enabled by default). According to #16684, the 22.0 release shall be compiled with C++17 enabled. This only sets the build flag, any other changes need more discussion and can be done later. ACKs for top commit: elichai: utACK fac7198 hebasto: ACK fac7198, I've locally compiled on ARM 32bit SBC without GUI. fanquake: ACK fac7198 Tree-SHA512: 53eb40ba5d496376a2d2cf16e2000bef36616cc2a3696c3ec59a5366e41fa8b872817a7ca21751f030f9c1efb339dfa63cc655eaa5199b9a3d2e52c2de0ccb29
2 parents 50e019a + fac7198 commit ea79265

File tree

8 files changed

+19
-27
lines changed

8 files changed

+19
-27
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- set -o errexit; source ./ci/lint/06_script.sh
6767

6868
- stage: test
69-
name: '32-bit + dash [GOAL: install] [CentOS 7] [gui]'
69+
name: '32-bit + dash [GOAL: install] [CentOS 8] [gui]'
7070
env: >-
7171
FILE_ENV="./ci/test/00_setup_env_i686_centos.sh"
7272

ci/test/00_setup_env_i686_centos.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
export LC_ALL=C.UTF-8
88

99
export HOST=i686-pc-linux-gnu
10-
export CONTAINER_NAME=ci_i686_centos_7
11-
export DOCKER_NAME_TAG=centos:7
12-
export DOCKER_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python36-zmq which patch lbzip2 dash"
10+
export CONTAINER_NAME=ci_i686_centos_8
11+
export DOCKER_NAME_TAG=centos:8
12+
export DOCKER_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python3-zmq which patch lbzip2 dash rsync coreutils"
1313
export GOAL="install"
14-
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports --with-boost-process"
14+
export DEP_OPTS="NO_QT=1" # Gui disabled for now to avoid build failures
15+
export BITCOIN_CONFIG="--enable-zmq --with-gui=no --enable-reduce-exports --with-boost-process"
1516
export CONFIG_SHELL="/bin/dash"

ci/test/00_setup_env_native_nowallet.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
export LC_ALL=C.UTF-8
88

99
export CONTAINER_NAME=ci_native_nowallet
10-
export DOCKER_NAME_TAG=ubuntu:18.04 # Use bionic to have one config run the tests in python3.6, see doc/dependencies.md (3.6 is not available in xenial/16.04)
11-
export PACKAGES="python3-zmq clang-3.9 llvm-3.9" # Use clang-3.9 to test C++11 compatibility, see doc/dependencies.md (3.8 is not available in bionic)
10+
export DOCKER_NAME_TAG=ubuntu:18.04 # Use bionic to have one config run the tests in python3.6, see doc/dependencies.md
11+
export PACKAGES="python3-zmq clang-5.0 llvm-5.0" # Use clang-5 to test C++17 compatibility, see doc/dependencies.md
1212
export DEP_OPTS="NO_WALLET=1"
1313
export GOAL="install"
14-
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-3.9 CXX=clang++-3.9 --with-boost-process"
14+
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-5.0 CXX=clang++-5.0 --with-boost-process"

ci/test/00_setup_env_native_qt5.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export LC_ALL=C.UTF-8
88

99
export CONTAINER_NAME=ci_native_qt5
10-
export DOCKER_NAME_TAG=ubuntu:18.04 # Check that bionic can compile our c++17 and run our functional tests in python3
10+
export DOCKER_NAME_TAG=ubuntu:18.04 # Check that bionic gcc-7 can compile our c++17 and run our functional tests in python3, see doc/dependencies.md
1111
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
1212
export DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
1313
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
@@ -16,4 +16,4 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true"
1616
export RUN_UNIT_TESTS="false"
1717
export GOAL="install"
1818
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.2 v0.18.1 v0.19.1"
19-
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-c++17 --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process"
19+
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process"

ci/test/04_install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ if [ -n "$DPKG_ADD_ARCH" ]; then
6060
fi
6161

6262
if [[ $DOCKER_NAME_TAG == centos* ]]; then
63-
${CI_RETRY_EXE} DOCKER_EXEC yum -y install epel-release
64-
${CI_RETRY_EXE} DOCKER_EXEC yum -y install $DOCKER_PACKAGES $PACKAGES
63+
${CI_RETRY_EXE} DOCKER_EXEC dnf -y install epel-release
64+
${CI_RETRY_EXE} DOCKER_EXEC dnf -y --allowerasing install $DOCKER_PACKAGES $PACKAGES
6565
elif [ "$CI_USE_APT_INSTALL" != "no" ]; then
6666
${CI_RETRY_EXE} DOCKER_EXEC apt-get update
6767
${CI_RETRY_EXE} DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $DOCKER_PACKAGES

configure.ac

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,8 @@ case $host in
6868
;;
6969
esac
7070

71-
AC_ARG_ENABLE([c++17],
72-
[AS_HELP_STRING([--enable-c++17],
73-
[enable compilation in c++17 mode (disabled by default)])],
74-
[use_cxx17=$enableval],
75-
[use_cxx17=no])
76-
77-
dnl Require C++11 or C++17 compiler (no GNU extensions)
78-
if test "x$use_cxx17" = xyes -o "x$enable_fuzz" = xyes ; then
79-
AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
80-
else
81-
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
82-
fi
71+
dnl Require C++17 compiler (no GNU extensions)
72+
AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
8373

8474
dnl Check if -latomic is required for <std::atomic>
8575
CHECK_ATOMIC

doc/dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
77
| --- | --- | --- | --- | --- | --- |
88
| Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | |
99
| Boost | [1.70.0](https://www.boost.org/users/download/) | [1.58.0](https://github.com/bitcoin/bitcoin/pull/19667) | No | | |
10-
| Clang | | [3.3+](https://releases.llvm.org/download.html) (C++11 support) | | | |
10+
| Clang | | [5.0+](https://releases.llvm.org/download.html) (C++17 support) | | | |
1111
| Expat | [2.2.7](https://libexpat.github.io/) | | No | Yes | |
1212
| fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | |
1313
| FreeType | [2.7.1](https://download.savannah.gnu.org/releases/freetype) | | No | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) (Android only) |
14-
| GCC | | [4.8+](https://gcc.gnu.org/) (C++11 support) | | | |
14+
| GCC | | [7+](https://gcc.gnu.org/) (C++17 support) | | | |
1515
| HarfBuzz-NG | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) |
1616
| libevent | [2.1.11-stable](https://github.com/libevent/libevent/releases) | [2.0.21](https://github.com/bitcoin/bitcoin/pull/18676) | No | | |
1717
| libpng | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) |

src/util/memory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
#include <utility>
1111

1212
//! Substitute for C++14 std::make_unique.
13+
//! DEPRECATED use std::make_unique in new code.
1314
template <typename T, typename... Args>
1415
std::unique_ptr<T> MakeUnique(Args&&... args)
1516
{
16-
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
17+
return std::make_unique<T>(std::forward<Args>(args)...);
1718
}
1819

1920
#endif

0 commit comments

Comments
 (0)