aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-01-30 23:28:07 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-01-30 23:39:00 +0100
commitcb77dc820f1bc1965a9d40759feb201d7869cfa9 (patch)
tree52ac36d1379aecf69177546d3f92c09810c22cc3 /src/wallet
parentbb36f5e24b63ba805d4b4470409adb09e1a056e6 (diff)
parent2d483142a7051389afe74c57a216843e6306f1a8 (diff)
Merge #15292: Remove 'boost::optional'-related false positive -Wmaybe-uninitialized warnings on GCC compiler
2d483142a7051389afe74c57a216843e6306f1a8 Remove 'boost::optional'-related gcc warnings (Hennadii Stepanov) Pull request description: #14711 introduced some warnings when building with gcc compiler. See: - https://github.com/bitcoin/bitcoin/pull/14711#issuecomment-454760017 by @laanwj - https://github.com/bitcoin/bitcoin/pull/14711#pullrequestreview-193702611 by @ryanofsky This gcc [issue](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679) has been known since version 4.6.0 and last updated in 2017. From the boost [docs](https://www.boost.org/doc/libs/1_69_0/libs/optional/doc/html/boost_optional/quick_start/optional_automatic_variables.html): > The default constructor of `optional` creates an _uninitialized_ `optional` object. Also: [False positive with -Wmaybe-uninitialized](https://www.boost.org/doc/libs/1_69_0/libs/optional/doc/html/boost_optional/tutorial/gotchas/false_positive_with__wmaybe_uninitialized.html) ([pointed out](https://github.com/bitcoin/bitcoin/pull/15292#issuecomment-459063170) by @Empact) This PR removes these warnings. cc: @Empact @practicalswift Tree-SHA512: 752ae3c3ca6282bbf98726236fbc3069ab9d1aee57ae2ec2668b32e4541e7bc1acb15b7d6fa9e2b6daf1ec29c0987a1053ee1ca0f523b71367ff911221c58c94
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcwallet.cpp3
-rw-r--r--src/wallet/wallet.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 2f37a1cfbe..213765209c 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;
{