Skip to content

Commit 880d4aa

Browse files
committed
build: use BOOST_NO_CXX98_FUNCTION_BASE to suppress warnings
Boost conatiner_hash (included via functional -> multi_index) uses std::unary_function, which was deprecated in C++11, and "removed" in C++17. It's use causes wanrings with newer compilers, i.e GCC 12.1. ```bash /bitcoin/depends/aarch64-unknown-linux-gnu/include/boost/container_hash/hash.hpp:131:33: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 131 | struct hash_base : std::unary_function<T, std::size_t> {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/12/bits/unique_ptr.h:37, from /usr/include/c++/12/memory:76, from ./init.h:10, from init.cpp:10: /usr/include/c++/12/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function ``` Use the MACRO outlined in boostorg/container_hash#22, to prevent it's use. BOOST_NO_CXX98_FUNCTION_BASE: > The standard library no longer supports std::unary_function and std::binary_function. > They were deprecated in C++11 and is removed from C++14. See: boostorg/config#430 https://en.cppreference.com/w/cpp/utility/functional/unary_function https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html
1 parent 1bdbbbd commit 880d4aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,11 @@ if test "$use_boost" = "yes"; then
14611461
dnl we don't use multi_index serialization
14621462
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION"
14631463

1464+
dnl Prevent use of std::unary_function, which was removed in C++17,
1465+
dnl and will generate warnings with newer compilers.
1466+
dnl See: https://github.com/boostorg/container_hash/issues/22.
1467+
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"
1468+
14641469
if test "$enable_debug" = "yes" || test "$enable_fuzz" = "yes"; then
14651470
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE"
14661471
fi

0 commit comments

Comments
 (0)