From 88fb82f2310a429539eedeaddc681e3017880563 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 3 Apr 2023 14:17:36 -0400 Subject: [PATCH 1/3] Suppress warnings with latest Apple clang/libc++. There is a bad interaction between our empty_base_optimization and libc++'s obsolete implementation of std::equal_to. This involves the deprecated functions std::binary_function and std::unary_function. This commit suppresses the warnings for the use of these functions on libc++, but has to call libc++-specific api (on libc++ only). --- .../beast/container/detail/aged_ordered_container.h | 8 ++------ .../beast/container/detail/aged_unordered_container.h | 8 ++------ src/ripple/peerfinder/impl/Bootcache.h | 7 ------- src/ripple/peerfinder/impl/Livecache.h | 11 ----------- src/ripple/shamap/impl/SHAMapInnerNode.cpp | 1 + 5 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/ripple/beast/container/detail/aged_ordered_container.h b/src/ripple/beast/container/detail/aged_ordered_container.h index 23534a26bb3..3f1fefa2969 100644 --- a/src/ripple/beast/container/detail/aged_ordered_container.h +++ b/src/ripple/beast/container/detail/aged_ordered_container.h @@ -149,15 +149,13 @@ class aged_ordered_container : public beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION , - public std::binary_function + public std::__binary_function #endif { public: -#ifndef _LIBCPP_VERSION using first_argument = value_type; using second_argument = value_type; using result_type = bool; -#endif bool operator()(value_type const& lhs, value_type const& rhs) const @@ -189,15 +187,13 @@ class aged_ordered_container : public beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION , - public std::binary_function + public std::__binary_function #endif { public: -#ifndef _LIBCPP_VERSION using first_argument = Key; using second_argument = element; using result_type = bool; -#endif KeyValueCompare() = default; diff --git a/src/ripple/beast/container/detail/aged_unordered_container.h b/src/ripple/beast/container/detail/aged_unordered_container.h index 920e6196bb9..e6b98d1994f 100644 --- a/src/ripple/beast/container/detail/aged_unordered_container.h +++ b/src/ripple/beast/container/detail/aged_unordered_container.h @@ -151,14 +151,12 @@ class aged_unordered_container class ValueHash : private beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION , - public std::unary_function + public std::__unary_function #endif { public: -#ifndef _LIBCPP_VERSION using argument_type = element; using result_type = size_t; -#endif ValueHash() { @@ -194,15 +192,13 @@ class aged_unordered_container : private beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION , - public std::binary_function + public std::__binary_function #endif { public: -#ifndef _LIBCPP_VERSION using first_argument_type = Key; using second_argument_type = element; using result_type = bool; -#endif KeyValueEqual() { diff --git a/src/ripple/peerfinder/impl/Bootcache.h b/src/ripple/peerfinder/impl/Bootcache.h index eb6455879c0..b48f248ae40 100644 --- a/src/ripple/peerfinder/impl/Bootcache.h +++ b/src/ripple/peerfinder/impl/Bootcache.h @@ -91,17 +91,10 @@ class Bootcache using value_type = map_type::value_type; struct Transform -#ifdef _LIBCPP_VERSION - : std::unary_function< - map_type::right_map::const_iterator::value_type const&, - beast::IP::Endpoint const&> -#endif { -#ifndef _LIBCPP_VERSION using first_argument_type = map_type::right_map::const_iterator::value_type const&; using result_type = beast::IP::Endpoint const&; -#endif explicit Transform() = default; diff --git a/src/ripple/peerfinder/impl/Livecache.h b/src/ripple/peerfinder/impl/Livecache.h index 12e2373faaf..8ecd68e845e 100644 --- a/src/ripple/peerfinder/impl/Livecache.h +++ b/src/ripple/peerfinder/impl/Livecache.h @@ -69,14 +69,9 @@ class LivecacheBase public: // Iterator transformation to extract the endpoint from Element struct Transform -#ifdef _LIBCPP_VERSION - : public std::unary_function -#endif { -#ifndef _LIBCPP_VERSION using first_argument = Element; using result_type = Endpoint; -#endif explicit Transform() = default; @@ -239,15 +234,9 @@ class Livecache : protected detail::LivecacheBase template struct Transform -#ifdef _LIBCPP_VERSION - : public std:: - unary_function> -#endif { -#ifndef _LIBCPP_VERSION using first_argument = typename lists_type::value_type; using result_type = Hop; -#endif explicit Transform() = default; diff --git a/src/ripple/shamap/impl/SHAMapInnerNode.cpp b/src/ripple/shamap/impl/SHAMapInnerNode.cpp index 6ea6f47eb37..43b39405415 100644 --- a/src/ripple/shamap/impl/SHAMapInnerNode.cpp +++ b/src/ripple/shamap/impl/SHAMapInnerNode.cpp @@ -431,6 +431,7 @@ SHAMapInnerNode::invariants(bool is_root) const } } + (void)count; if (!is_root) { assert(hash_.isNonZero()); From 4491097354f71272ccc297aabb600fe5075946de Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 13 Apr 2023 17:46:56 -0400 Subject: [PATCH 2/3] [FOLD] It turns out that the libc++ hack used in this commit is new. Include a transition from pre-hack to post-hack. --- .../beast/container/detail/aged_unordered_container.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ripple/beast/container/detail/aged_unordered_container.h b/src/ripple/beast/container/detail/aged_unordered_container.h index e6b98d1994f..79ef90094b7 100644 --- a/src/ripple/beast/container/detail/aged_unordered_container.h +++ b/src/ripple/beast/container/detail/aged_unordered_container.h @@ -150,8 +150,13 @@ class aged_unordered_container // VFALCO TODO hoist to remove template argument dependencies class ValueHash : private beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION +#if _LIBCPP_VERSION >= 15006 , public std::__unary_function +#else + , + public std::unary_function +#endif #endif { public: @@ -191,8 +196,13 @@ class aged_unordered_container class KeyValueEqual : private beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION +#if _LIBCPP_VERSION >= 15006 , public std::__binary_function +#else + , + public std::binary_function +#endif #endif { public: From e55fc30e5ac0fb96ff2a93901604f37a50ed67ca Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 13 Apr 2023 20:06:37 -0400 Subject: [PATCH 3/3] [FOLD] Missed one! --- .../beast/container/detail/aged_ordered_container.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ripple/beast/container/detail/aged_ordered_container.h b/src/ripple/beast/container/detail/aged_ordered_container.h index 3f1fefa2969..879886c3275 100644 --- a/src/ripple/beast/container/detail/aged_ordered_container.h +++ b/src/ripple/beast/container/detail/aged_ordered_container.h @@ -148,8 +148,13 @@ class aged_ordered_container class pair_value_compare : public beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION +#if _LIBCPP_VERSION >= 15006 , public std::__binary_function +#else + , + public std::binary_function +#endif #endif { public: @@ -186,8 +191,13 @@ class aged_ordered_container class KeyValueCompare : public beast::detail::empty_base_optimization #ifdef _LIBCPP_VERSION +#if _LIBCPP_VERSION >= 15006 , public std::__binary_function +#else + , + public std::binary_function +#endif #endif { public: