aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-01-30 13:28:41 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-01-30 22:44:28 +0200
commit2d483142a7051389afe74c57a216843e6306f1a8 (patch)
treeaccfe091b5d48697633acfb009a718d3939657d2 /src
parent72ca72e6370e4fabb40510f80c00b8863322aa50 (diff)
Remove 'boost::optional'-related gcc warnings
Diffstat (limited to 'src')
-rw-r--r--src/optional.h9
-rw-r--r--src/wallet/rpcwallet.cpp3
-rw-r--r--src/wallet/wallet.cpp3
3 files changed, 13 insertions, 2 deletions
diff --git a/src/optional.h b/src/optional.h
index 1614c89718..95a3b24d0a 100644
--- a/src/optional.h
+++ b/src/optional.h
@@ -5,12 +5,21 @@
#ifndef BITCOIN_OPTIONAL_H
#define BITCOIN_OPTIONAL_H
+#include <utility>
+
#include <boost/optional.hpp>
//! Substitute for C++17 std::optional
template <typename T>
using Optional = boost::optional<T>;
+//! Substitute for C++17 std::make_optional
+template <typename T>
+Optional<T> MakeOptional(bool condition, T&& value)
+{
+ return boost::make_optional(condition, std::forward<T>(value));
+}
+
//! Substitute for C++17 std::nullopt
static auto& nullopt = boost::none;
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 270a61ade8..ada66ec7f9 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -1591,7 +1591,8 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
- Optional<int> height; // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
+ // The way the 'height' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0.
+ Optional<int> height = MakeOptional(false, int()); // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
Optional<int> altheight; // Height of the specified block, even if it's in a deactivated chain.
int target_confirms = 1;
isminefilter filter = ISMINE_SPENDABLE;
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index ddeff8ba09..a6cabe1f90 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1642,7 +1642,8 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
fAbortRescan = false;
ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
uint256 tip_hash;
- Optional<int> block_height;
+ // The way the 'block_height' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0.
+ Optional<int> block_height = MakeOptional(false, int());
double progress_begin;
double progress_end;
{