Skip to content

Commit a5fa907

Browse files
committed
Merge bitcoin/bitcoin#30834: test: Work around boost compilation error
fa9d7d5 test: Work around boost compilation error (MarcoFalke) fa3ecdf Revert "build: work around issue with Boost <= 1.80 and Clang >= 18" (MarcoFalke) Pull request description: There seems to be an issue compiling the `chainstatemanager_rebalance_caches` test case with some specific versions of Boost in combination with some specific versions of Clang. For example, Boost 1.74 may fail in combination with Clang 18. [1] The error stems from a mixed-type closeness comparison. Given that the comparison is using floating point, and isn't meant to be exact, work around the compile error by ensuring both sides of the comparison are using the same type (`double`). This also allows to drop a previous workaround. [1] Error: ``` In file included from /usr/include/boost/mpl/integral_c.hpp:32: /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion] 73 | typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; | ^ /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST' 24 | # define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr) | ^ In file included from ../../../src/test/validation_chainstatemanager_tests.cpp:8: In file included from ../../../src/node/chainstatemanager_args.h:9: In file included from ../../../src/validation.h:28: In file included from ../../../src/txmempool.h:26: In file included from /usr/include/boost/multi_index/hashed_index.hpp:38: In file included from /usr/include/boost/multi_index/detail/node_handle.hpp:22: In file included from /usr/include/boost/multi_index_container_fwd.hpp:18: In file included from /usr/include/boost/multi_index/indexed_by.hpp:17: In file included from /usr/include/boost/mpl/vector.hpp:36: In file included from /usr/include/boost/mpl/vector/vector20.hpp:18: In file included from /usr/include/boost/mpl/vector/vector10.hpp:18: In file included from /usr/include/boost/mpl/vector/vector0.hpp:24: In file included from /usr/include/boost/mpl/vector/aux_/clear.hpp:18: In file included from /usr/include/boost/mpl/vector/aux_/vector0.hpp:22: In file included from /usr/include/boost/mpl/vector/aux_/iterator.hpp:19: In file included from /usr/include/boost/mpl/plus.hpp:19: In file included from /usr/include/boost/mpl/aux_/arithmetic_op.hpp:17: In file included from /usr/include/boost/mpl/integral_c.hpp:32: /usr/include/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'int_float_mixture_enum' [-Wenum-constexpr-conversion] /usr/include/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST' 24 | # define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr) | ^ 2 errors generated. ACKs for top commit: hebasto: ACK fa9d7d5. fanquake: ACK fa9d7d5 Tree-SHA512: 4964b23162f2351c7d3cf7e9efa7860d62f3b6717c3cc5be967d286f1ddb3539c2637247c79aa83123d36ff111ba77df22be2a25487ddd94dc1321d5e751dc70
2 parents bbf95c0 + fa9d7d5 commit a5fa907

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/test/validation_chainstatemanager_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_rebalance_caches, TestChain100Setup)
155155
manager.MaybeRebalanceCaches();
156156
}
157157

158-
BOOST_CHECK_CLOSE(c1.m_coinstip_cache_size_bytes, max_cache * 0.05, 1);
159-
BOOST_CHECK_CLOSE(c1.m_coinsdb_cache_size_bytes, max_cache * 0.05, 1);
160-
BOOST_CHECK_CLOSE(c2.m_coinstip_cache_size_bytes, max_cache * 0.95, 1);
161-
BOOST_CHECK_CLOSE(c2.m_coinsdb_cache_size_bytes, max_cache * 0.95, 1);
158+
BOOST_CHECK_CLOSE(double(c1.m_coinstip_cache_size_bytes), max_cache * 0.05, 1);
159+
BOOST_CHECK_CLOSE(double(c1.m_coinsdb_cache_size_bytes), max_cache * 0.05, 1);
160+
BOOST_CHECK_CLOSE(double(c2.m_coinstip_cache_size_bytes), max_cache * 0.95, 1);
161+
BOOST_CHECK_CLOSE(double(c2.m_coinsdb_cache_size_bytes), max_cache * 0.95, 1);
162162
}
163163

164164
struct SnapshotTestSetup : TestChain100Setup {

src/txmempool.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,7 @@
2323
#include <util/result.h>
2424
#include <util/feefrac.h>
2525

26-
// This works around a bug in Boost <= 1.80.0 when using Clang >=18.
27-
// See https://github.com/bitcoin/bitcoin/issues/30751.
28-
#if defined(__clang__)
29-
#pragma clang diagnostic push
30-
#pragma clang diagnostic ignored "-Wenum-constexpr-conversion"
31-
#endif
3226
#include <boost/multi_index/hashed_index.hpp>
33-
#if defined(__clang__)
34-
#pragma clang diagnostic pop
35-
#endif
36-
3727
#include <boost/multi_index/identity.hpp>
3828
#include <boost/multi_index/indexed_by.hpp>
3929
#include <boost/multi_index/ordered_index.hpp>

0 commit comments

Comments
 (0)