Skip to content

Commit cc44a68

Browse files
authored
Merge pull request #2113 from div72/c++17
build, refactor: bump to C++17
2 parents 2d8f583 + e8dfebc commit cc44a68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+708
-311
lines changed

build-aux/m4/ax_cxx_compile_stdcxx.m4

Lines changed: 419 additions & 36 deletions
Large diffs are not rendered by default.

ci/test/00_setup_env_native_old.sh

Lines changed: 1 addition & 1 deletion
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_old
10-
export DOCKER_NAME_TAG=ubuntu:16.04
10+
export DOCKER_NAME_TAG=ubuntu:18.04
1111
export PACKAGES="libqt5gui5 libqt5core5a qtbase5-dev libqt5dbus5 qttools5-dev qttools5-dev-tools libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-iostreams-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libqrencode-dev libzip-dev zlib1g zlib1g-dev libcurl4-openssl-dev"
1212
export RUN_UNIT_TESTS=true
1313
# export RUN_FUNCTIONAL_TESTS=false

configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ case $host in
5959
lt_cv_deplibs_check_method="pass_all"
6060
;;
6161
esac
62-
dnl Require C++11 compiler (no GNU extensions)
63-
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
62+
63+
dnl Require C++17 compiler (no GNU extensions)
64+
AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory], [nodefault])
6465
dnl Check if -latomic is required for <std::atomic>
6566
CHECK_ATOMIC
6667

depends/packages/bdb.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define $(package)_set_vars
1111
$(package)_config_opts+=--libdir=$($($(package)_type)_prefix)/lib
1212
$(package)_config_opts_mingw32=--enable-mingw
1313
$(package)_config_opts_linux=--with-pic
14-
$(package)_cxxflags=-std=c++11
14+
$(package)_cxxflags=-std=c++17
1515
$(package)_cxxflags_aarch64_linux = $(GCCFLAGS)
1616
$(package)_cflags_aarch64_linux = $(GCCFLAGS)
1717
$(package)_cxxflags_arm_linux = $(GCCFLAGS)

depends/packages/bdb53.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define $(package)_set_vars
1111
$(package)_config_opts+=--libdir=$($($(package)_type)_prefix)/lib
1212
$(package)_config_opts_mingw32=--enable-mingw
1313
$(package)_config_opts_linux=--with-pic
14-
$(package)_cxxflags=-std=c++11
14+
$(package)_cxxflags=-std=c++17
1515
$(package)_cxxflags_aarch64_linux = $(GCCFLAGS)
1616
$(package)_cflags_aarch64_linux = $(GCCFLAGS)
1717
$(package)_cxxflags_arm_linux = $(GCCFLAGS)

depends/packages/boost.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifneq (,$(findstring clang,$($(package)_cxx)))
2828
endif
2929
$(package)_archiver_$(host_os)=$($(package)_ar)
3030
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test,iostreams
31-
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
31+
$(package)_cxxflags=-std=c++17 -fvisibility=hidden
3232
$(package)_cxxflags_linux=-fPIC
3333
$(package)_cxxflags_android=-fPIC
3434
endef

depends/packages/qt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ define $(package)_set_vars
3636
$(package)_config_opts_release = -release
3737
$(package)_config_opts_debug = -debug
3838
$(package)_config_opts += -bindir $(build_prefix)/bin
39-
$(package)_config_opts += -c++std c++11
39+
$(package)_config_opts += -c++std c++1z
4040
$(package)_config_opts += -confirm-license
4141
$(package)_config_opts += -hostprefix $(build_prefix)
4242
$(package)_config_opts += -no-compile-examples

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ GRIDCOIN_CORE_H = \
7070
chainparamsbase.h \
7171
checkpoints.h \
7272
compat.h \
73+
compat/assumptions.h \
7374
compat/byteswap.h \
7475
compat/endian.h \
7576
consensus/consensus.h \
@@ -168,7 +169,6 @@ GRIDCOIN_CORE_H = \
168169
txdb-leveldb.h \
169170
ui_interface.h \
170171
uint256.h \
171-
util/memory.h \
172172
util/reverse_iterator.h \
173173
util/strencodings.h \
174174
util/threadnames.h \

src/attributes.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2018 The Bitcoin Core developers
2+
// Copyright (c) 2009-2020 The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

66
#ifndef BITCOIN_ATTRIBUTES_H
77
#define BITCOIN_ATTRIBUTES_H
88

9-
#if defined(__has_cpp_attribute)
10-
# if __has_cpp_attribute(nodiscard)
11-
# define NODISCARD [[nodiscard]]
12-
# endif
13-
#endif
14-
#ifndef NODISCARD
15-
# if defined(_MSC_VER) && _MSC_VER >= 1700
16-
# define NODISCARD _Check_return_
9+
#if defined(__clang__)
10+
# if __has_attribute(lifetimebound)
11+
# define LIFETIMEBOUND [[clang::lifetimebound]]
1712
# else
18-
# define NODISCARD __attribute__((warn_unused_result))
13+
# define LIFETIMEBOUND
1914
# endif
15+
#else
16+
# define LIFETIMEBOUND
2017
#endif
2118

2219
#endif // BITCOIN_ATTRIBUTES_H

src/base58.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
#ifndef BITCOIN_BASE58_H
1616
#define BITCOIN_BASE58_H
1717

18-
#include <string>
19-
#include <vector>
2018
#include "bignum.h"
2119
#include "key.h"
2220
#include "script.h"
2321

22+
#include <string>
23+
#include <variant>
24+
#include <vector>
25+
2426
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2527

2628
// Encode a byte sequence as a base58-encoded string
@@ -260,7 +262,7 @@ class CBase58Data
260262
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
261263
*/
262264
class CBitcoinAddress;
263-
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
265+
class CBitcoinAddressVisitor
264266
{
265267
private:
266268
CBitcoinAddress *addr;
@@ -295,7 +297,7 @@ class CBitcoinAddress : public CBase58Data
295297

296298
bool Set(const CTxDestination &dest)
297299
{
298-
return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
300+
return std::visit(CBitcoinAddressVisitor(this), dest);
299301
}
300302

301303
bool IsValid() const

0 commit comments

Comments
 (0)