Skip to content

Commit 1cf6a67

Browse files
Merge #6668: backport: trivial 2025 05 08
6dfb41e Merge bitcoin#30235: build: warn on self-assignment (merge-script) 325c8f0 Merge bitcoin#30236: build: re-enable deprecated warning copy (merge-script) 796e6ee Merge bitcoin#29882: netbase: clean up Proxy logging (merge-script) 9116563 Merge bitcoin#29315: refactor: Compile unreachable walletdb code (Ava Chow) ddbe865 Merge bitcoin#28672: build: move `-fstack-reuse=none` to CORE_CXXFLAGS (fanquake) 5349c5e Merge bitcoin#27918: fuzz: addrman, avoid `ConsumeDeserializable` when possible (fanquake) da71765 Merge bitcoin#28091: fuzz: use `ConnmanTestMsg` in `connman` (fanquake) 768f07c Merge bitcoin#27420: build: remove ancient unused define (fanquake) 84ce049 Merge bitcoin#25985: Revert "build: Use Homebrew's sqlite package if it is available" (Andrew Chow) 4d9b355 Merge bitcoin#26070: build: Quiet warnings in symlinked headers installed from homebrew (fanquake) f8630ba Merge bitcoin#25906: test: add coverage for invalid parameters for `rescanblockchain` (MacroFake) 494b7c0 Merge bitcoin#25282: Bugfix: configure: Define default for use_libevent (laanwj) ca63ea7 Merge bitcoin#24958: build: Fix macOS Apple M1 build with miniupnpc and libnatpmp. Again :) (laanwj) 075f8db Merge bitcoin#24696: ci: Use monterey-xcode-13.3 (MarcoFalke) Pull request description: ## Issue being fixed or feature implemented Batch of trivial backports ## How Has This Been Tested? CI ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 6dfb41e knst: utACK 6dfb41e Tree-SHA512: ff0eb987feadbefa9493abc2a727ce7df6249ae1d82e929c44a90a9b23eff95d6f4f7d07a85c5b9a8ff54cf98b1b4bfa490fc6b38b705eae3f1d890383a323e6
2 parents 9cb43c2 + 6dfb41e commit 1cf6a67

File tree

9 files changed

+126
-86
lines changed

9 files changed

+126
-86
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ task:
175175
<< : *GLOBAL_TASK_TEMPLATE
176176
macos_instance:
177177
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
178-
image: monterey-xcode-13.2 # https://cirrus-ci.org/guide/macOS
178+
image: monterey-xcode-13.3 # https://cirrus-ci.org/guide/macOS
179179
env:
180180
DANGER_RUN_CI_ON_HOST: "true"
181181
CI_USE_APT_INSTALL: "no"

configure.ac

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,22 @@ AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsug
513513
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wimplicit-fallthrough"], [], [$CXXFLAG_WERROR])
514514
AX_CHECK_COMPILE_FLAG([-Wunreachable-code], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code"], [], [$CXXFLAG_WERROR])
515515
AX_CHECK_COMPILE_FLAG([-Wdocumentation], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdocumentation"], [], [$CXXFLAG_WERROR])
516+
AX_CHECK_COMPILE_FLAG([-Wself-assign], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wself-assign"], [], [$CXXFLAG_WERROR])
516517

517518
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
518519
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
519520
dnl set the -Wno-foo case if it works.
520521
AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"], [], [$CXXFLAG_WERROR])
521-
AX_CHECK_COMPILE_FLAG([-Wself-assign], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"], [], [$CXXFLAG_WERROR])
522-
if test "$suppress_external_warnings" != "yes" ; then
523-
AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"], [], [$CXXFLAG_WERROR])
524-
fi
525522

526523
dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
527524
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"], [], [$CXXFLAG_WERROR])
528525

526+
dnl Currently all versions of gcc are subject to a class of bugs, see the
527+
dnl gccbug_90348 test case (only reproduces on GCC 11 and earlier) and
528+
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set
529+
dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
530+
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none], [CORE_CXXFLAGS="$CORE_CXXFLAGS -fstack-reuse=none"])
531+
529532
enable_arm_crc=no
530533
enable_arm_shani=no
531534
enable_sse42=no
@@ -782,17 +785,23 @@ case $host in
782785
dnl It's safe to add these paths even if the functionality is disabled by
783786
dnl the user (--without-wallet or --without-gui for example).
784787

788+
dnl Homebrew may create symlinks in /usr/local/include for some packages.
789+
dnl Because MacOS's clang internally adds "-I /usr/local/include" to its search
790+
dnl paths, this will negate efforts to use -isystem for those packages, as they
791+
dnl will be found first in /usr/local. Use the internal "-internal-isystem"
792+
dnl option to system-ify all /usr/local/include paths without adding it to the list
793+
dnl of search paths in case it's not already there.
794+
if test "$suppress_external_warnings" != "no"; then
795+
AX_CHECK_PREPROC_FLAG([-Xclang -internal-isystem/usr/local/include], [CORE_CPPFLAGS="$CORE_CPPFLAGS -Xclang -internal-isystem/usr/local/include"], [], [$CXXFLAG_WERROR])
796+
fi
797+
785798
if test "$use_bdb" != "no" && $BREW list --versions berkeley-db@4 >/dev/null && test "$BDB_CFLAGS" = "" && test "$BDB_LIBS" = ""; then
786799
bdb_prefix=$($BREW --prefix berkeley-db@4 2>/dev/null)
787800
dnl This must precede the call to BITCOIN_FIND_BDB48 below.
788801
BDB_CFLAGS="-I$bdb_prefix/include"
789802
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
790803
fi
791804

792-
if test "$use_sqlite" != "no" && $BREW list --versions sqlite3 >/dev/null; then
793-
export PKG_CONFIG_PATH="$($BREW --prefix sqlite3 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
794-
fi
795-
796805
if $BREW list --versions qt@5 >/dev/null; then
797806
export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
798807
fi
@@ -812,20 +821,20 @@ case $host in
812821
if test "$use_upnp" != "no" && $BREW list --versions miniupnpc >/dev/null; then
813822
miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
814823
if test "$suppress_external_warnings" != "no"; then
815-
CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
824+
MINIUPNPC_CPPFLAGS="-isystem $miniupnpc_prefix/include"
816825
else
817-
CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
826+
MINIUPNPC_CPPFLAGS="-I$miniupnpc_prefix/include"
818827
fi
819-
CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
828+
MINIUPNPC_LIBS="-L$miniupnpc_prefix/lib"
820829
fi
821830
if test "$use_natpmp" != "no" && $BREW list --versions libnatpmp >/dev/null; then
822831
libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
823832
if test "$suppress_external_warnings" != "no"; then
824-
CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
833+
NATPMP_CPPFLAGS="-isystem $libnatpmp_prefix/include"
825834
else
826-
CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
835+
NATPMP_CPPFLAGS="-I$libnatpmp_prefix/include"
827836
fi
828-
CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
837+
NATPMP_LIBS="-L$libnatpmp_prefix/lib"
829838
fi
830839
;;
831840
esac
@@ -981,11 +990,6 @@ if test "$TARGET_OS" != "windows"; then
981990
AX_CHECK_COMPILE_FLAG([-fPIC], [PIC_FLAGS="-fPIC"])
982991
fi
983992

984-
dnl Currently all versions of gcc are subject to a class of bugs, see the
985-
dnl gccbug_90348 test case (only reproduces on GCC 11 and earlier) and the related bugs of
986-
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
987-
dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
988-
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])
989993
if test "$use_hardening" != "no"; then
990994
use_hardening=yes
991995
AX_CHECK_COMPILE_FLAG([-Wstack-protector], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
@@ -1418,38 +1422,44 @@ AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"])
14181422

14191423
dnl Check for libminiupnpc (optional)
14201424
if test "$use_upnp" != "no"; then
1425+
TEMP_CPPFLAGS="$CPPFLAGS"
1426+
CPPFLAGS="$CPPFLAGS $MINIUPNPC_CPPFLAGS"
14211427
AC_CHECK_HEADERS(
14221428
[miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h],
1423-
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])],
1429+
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc"], [have_miniupnpc=no], [$MINIUPNPC_LIBS])],
14241430
[have_miniupnpc=no]
14251431
)
1426-
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1427-
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1428-
if test "$have_miniupnpc" != "no"; then
1429-
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
1430-
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
1431-
@%:@include <miniupnpc/miniupnpc.h>
1432-
]], [[
1433-
#if MINIUPNPC_API_VERSION >= 10
1434-
// Everything is okay
1435-
#else
1436-
# error miniUPnPc API version is too old
1437-
#endif
1438-
]])],[
1439-
AC_MSG_RESULT([yes])
1440-
],[
1441-
AC_MSG_RESULT([no])
1442-
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
1443-
have_miniupnpc=no
1444-
])
1445-
fi
1432+
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1433+
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1434+
if test "$have_miniupnpc" != "no"; then
1435+
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
1436+
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
1437+
@%:@include <miniupnpc/miniupnpc.h>
1438+
]], [[
1439+
#if MINIUPNPC_API_VERSION >= 10
1440+
// Everything is okay
1441+
#else
1442+
# error miniUPnPc API version is too old
1443+
#endif
1444+
]])],[
1445+
AC_MSG_RESULT([yes])
1446+
],[
1447+
AC_MSG_RESULT([no])
1448+
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
1449+
have_miniupnpc=no
1450+
])
1451+
fi
1452+
CPPFLAGS="$TEMP_CPPFLAGS"
14461453
fi
14471454

14481455
dnl Check for libnatpmp (optional).
14491456
if test "$use_natpmp" != "no"; then
1457+
TEMP_CPPFLAGS="$CPPFLAGS"
1458+
CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS"
14501459
AC_CHECK_HEADERS([natpmp.h],
1451-
[AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS=-lnatpmp], [have_natpmp=no])],
1460+
[AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS="$NATPMP_LIBS -lnatpmp"], [have_natpmp=no], [$NATPMP_LIBS])],
14521461
[have_natpmp=no])
1462+
CPPFLAGS="$TEMP_CPPFLAGS"
14531463
fi
14541464

14551465
if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" = "nonononononono"; then
@@ -1508,6 +1518,7 @@ fi
15081518

15091519
dnl libevent check
15101520

1521+
use_libevent=no
15111522
if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" != "nonononono"; then
15121523
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.21], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.0.21 or greater not found.])])
15131524
if test "$TARGET_OS" != "windows"; then
@@ -1681,7 +1692,7 @@ else
16811692
use_upnp=yes
16821693
AC_DEFINE([USE_UPNP], [1], [Define to 1 if UPnP support should be compiled in.])
16831694
if test "$TARGET_OS" = "windows"; then
1684-
MINIUPNPC_CPPFLAGS="-DSTATICLIB -DMINIUPNP_STATICLIB"
1695+
MINIUPNPC_CPPFLAGS="$MINIUPNPC_CPPFLAGS -DMINIUPNP_STATICLIB"
16851696
fi
16861697
else
16871698
AC_MSG_RESULT([no])
@@ -1702,7 +1713,7 @@ else
17021713
use_natpmp=yes
17031714
AC_DEFINE([USE_NATPMP], [1], [Define to 1 if UPnP support should be compiled in.])
17041715
if test "$TARGET_OS" = "windows"; then
1705-
NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
1716+
NATPMP_CPPFLAGS="$NATPMP_CPPFLAGS -DSTATICLIB -DNATPMP_STATICLIB"
17061717
fi
17071718
else
17081719
AC_MSG_RESULT([no])

src/netbase.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,7 @@ std::unique_ptr<Sock> ConnectDirectly(const CService& dest, bool manual_connecti
639639

640640
std::unique_ptr<Sock> Proxy::Connect() const
641641
{
642-
if (!IsValid()) {
643-
LogPrintf("Cannot connect to invalid Proxy\n");
644-
return {};
645-
}
642+
if (!IsValid()) return {};
646643

647644
if (!m_is_unix_socket) return ConnectDirectly(proxy, /*manual_connection=*/true);
648645

@@ -663,7 +660,6 @@ std::unique_ptr<Sock> Proxy::Connect() const
663660
socklen_t len = sizeof(addrun);
664661

665662
if(!ConnectToSocket(*sock, (struct sockaddr*)&addrun, len, path, /*manual_connection=*/true)) {
666-
LogPrintf("Cannot connect to socket for %s\n", path);
667663
return {};
668664
}
669665

src/test/fuzz/addrman.cpp

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -271,40 +271,21 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
271271
[&] {
272272
std::vector<CAddress> addresses;
273273
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
274-
const std::optional<CAddress> opt_address = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
275-
if (!opt_address) {
276-
break;
277-
}
278-
addresses.push_back(*opt_address);
279-
}
280-
const std::optional<CNetAddr> opt_net_addr = ConsumeDeserializable<CNetAddr>(fuzzed_data_provider);
281-
if (opt_net_addr) {
282-
addr_man.Add(addresses, *opt_net_addr, std::chrono::seconds{ConsumeTime(fuzzed_data_provider, 0, 100000000)});
274+
addresses.push_back(ConsumeAddress(fuzzed_data_provider));
283275
}
276+
addr_man.Add(addresses, ConsumeNetAddr(fuzzed_data_provider), std::chrono::seconds{ConsumeTime(fuzzed_data_provider, 0, 100000000)});
284277
},
285278
[&] {
286-
const std::optional<CService> opt_service = ConsumeDeserializable<CService>(fuzzed_data_provider);
287-
if (opt_service) {
288-
addr_man.Good(*opt_service, NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
289-
}
279+
addr_man.Good(ConsumeService(fuzzed_data_provider), NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
290280
},
291281
[&] {
292-
const std::optional<CService> opt_service = ConsumeDeserializable<CService>(fuzzed_data_provider);
293-
if (opt_service) {
294-
addr_man.Attempt(*opt_service, fuzzed_data_provider.ConsumeBool(), NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
295-
}
282+
addr_man.Attempt(ConsumeService(fuzzed_data_provider), fuzzed_data_provider.ConsumeBool(), NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
296283
},
297284
[&] {
298-
const std::optional<CService> opt_service = ConsumeDeserializable<CService>(fuzzed_data_provider);
299-
if (opt_service) {
300-
addr_man.Connected(*opt_service, NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
301-
}
285+
addr_man.Connected(ConsumeService(fuzzed_data_provider), NodeSeconds{std::chrono::seconds{ConsumeTime(fuzzed_data_provider)}});
302286
},
303287
[&] {
304-
const std::optional<CService> opt_service = ConsumeDeserializable<CService>(fuzzed_data_provider);
305-
if (opt_service) {
306-
addr_man.SetServices(*opt_service, ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS));
307-
}
288+
addr_man.SetServices(ConsumeService(fuzzed_data_provider), ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS));
308289
});
309290
}
310291
(void)addr_man.Size();
@@ -328,4 +309,4 @@ FUZZ_TARGET(addrman_serdeser, .init = initialize_addrman)
328309
data_stream << addr_man1;
329310
data_stream >> addr_man2;
330311
assert(addr_man1 == addr_man2);
331-
}
312+
}

src/test/fuzz/connman.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ FUZZ_TARGET(connman, .init = initialize_connman)
3333
{
3434
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
3535
SetMockTime(ConsumeTime(fuzzed_data_provider));
36-
CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
36+
ConnmanTestMsg connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
3737
fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
3838
*g_setup->m_node.addrman,
3939
*g_setup->m_node.netgroupman,
@@ -48,6 +48,12 @@ FUZZ_TARGET(connman, .init = initialize_connman)
4848
CNode random_node = ConsumeNode(fuzzed_data_provider);
4949
CSubNet random_subnet;
5050
std::string random_string;
51+
52+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
53+
CNode& p2p_node{*ConsumeNodeAsUniquePtr(fuzzed_data_provider).release()};
54+
connman.AddTestNode(p2p_node);
55+
}
56+
5157
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
5258
CallOneOf(
5359
fuzzed_data_provider,
@@ -138,4 +144,6 @@ FUZZ_TARGET(connman, .init = initialize_connman)
138144
(void)connman.GetTotalBytesSent();
139145
(void)connman.GetTryNewOutboundPeer();
140146
(void)connman.GetUseAddrmanOutgoing();
147+
148+
connman.ClearTestNodes();
141149
}

src/test/fuzz/muhash.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,19 @@ FUZZ_TARGET(muhash)
4343
},
4444
[&] {
4545
// Test that dividing a MuHash by itself brings it back to it's initial state
46+
47+
// See note about clang + self-assignment in test/uint256_tests.cpp
48+
#if defined(__clang__)
49+
# pragma clang diagnostic push
50+
# pragma clang diagnostic ignored "-Wself-assign-overloaded"
51+
#endif
52+
4653
muhash /= muhash;
54+
55+
#if defined(__clang__)
56+
# pragma clang diagnostic pop
57+
#endif
58+
4759
muhash.Finalize(out);
4860
out2 = uint256S(initial_state_hash);
4961
},

src/test/uint256_tests.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,22 @@ BOOST_AUTO_TEST_CASE( conversion )
268268

269269
BOOST_AUTO_TEST_CASE( operator_with_self )
270270
{
271+
272+
/* Clang 16 and earlier detects v -= v and v /= v as self-assignments
273+
to 0 and 1 respectively.
274+
See: https://github.com/llvm/llvm-project/issues/42469
275+
and the fix in commit c5302325b2a62d77cf13dd16cd5c19141862fed0 .
276+
277+
This makes some sense for arithmetic classes, but could be considered a bug
278+
elsewhere. Disable the warning here so that the code can be tested, but the
279+
warning should remain on as there will likely always be a better way to
280+
express this.
281+
*/
282+
283+
#if defined(__clang__)
284+
# pragma clang diagnostic push
285+
# pragma clang diagnostic ignored "-Wself-assign-overloaded"
286+
#endif
271287
arith_uint256 v = UintToArith256(uint256S("02"));
272288
v *= v;
273289
BOOST_CHECK(v == UintToArith256(uint256S("04")));
@@ -277,6 +293,9 @@ BOOST_AUTO_TEST_CASE( operator_with_self )
277293
BOOST_CHECK(v == UintToArith256(uint256S("02")));
278294
v -= v;
279295
BOOST_CHECK(v == UintToArith256(uint256S("0")));
296+
#if defined(__clang__)
297+
# pragma clang diagnostic pop
298+
#endif
280299
}
281300

282301
BOOST_AUTO_TEST_CASE( check_ONE )

src/wallet/walletdb.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,21 +1160,27 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
11601160

11611161
if (format == DatabaseFormat::SQLITE) {
11621162
#ifdef USE_SQLITE
1163-
return MakeSQLiteDatabase(path, options, status, error);
1164-
#else
1165-
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path)));
1166-
status = DatabaseStatus::FAILED_BAD_FORMAT;
1167-
return nullptr;
1163+
if constexpr (true) {
1164+
return MakeSQLiteDatabase(path, options, status, error);
1165+
} else
11681166
#endif
1167+
{
1168+
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path)));
1169+
status = DatabaseStatus::FAILED_BAD_FORMAT;
1170+
return nullptr;
1171+
}
11691172
}
11701173

11711174
#ifdef USE_BDB
1172-
return MakeBerkeleyDatabase(path, options, status, error);
1173-
#else
1174-
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
1175-
status = DatabaseStatus::FAILED_BAD_FORMAT;
1176-
return nullptr;
1175+
if constexpr (true) {
1176+
return MakeBerkeleyDatabase(path, options, status, error);
1177+
} else
11771178
#endif
1179+
{
1180+
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
1181+
status = DatabaseStatus::FAILED_BAD_FORMAT;
1182+
return nullptr;
1183+
}
11781184
}
11791185

11801186
/** Return object for accessing dummy database with no read/write capabilities. */

0 commit comments

Comments
 (0)