mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-30 16:05:51 +00:00
Allow rippled to compile with C++17:
Many of the warnings on Windows were not resolved, just silenced with _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS. They need to be resolved in a future commit.
This commit is contained in:
committed by
Mike Ellery
parent
63e167b7a3
commit
a999894dae
@@ -275,6 +275,8 @@ if (MSVC)
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
WIN32_CONSOLE
|
||||
NOMINMAX
|
||||
# TODO: Resolve these warnings, don't just silence them
|
||||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>)
|
||||
target_link_libraries (common
|
||||
INTERFACE
|
||||
@@ -369,7 +371,6 @@ add_library (opts INTERFACE)
|
||||
add_library (Ripple::opts ALIAS opts)
|
||||
target_compile_definitions (opts
|
||||
INTERFACE
|
||||
BOOST_NO_AUTO_PTR
|
||||
BOOST_ASIO_HAS_STD_ARRAY
|
||||
BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||
$<$<BOOL:${boost_show_deprecated}>:
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include <ripple/protocol/IOUAmount.h>
|
||||
#include <ripple/protocol/XRPAmount.h>
|
||||
|
||||
#include <boost/range/adaptors.hpp>
|
||||
#include <boost/range/algorithm.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
|
||||
@@ -209,7 +207,7 @@ toStrandV1 (
|
||||
// Note that for offer crossing (only) we do use an offer book even if
|
||||
// all that is changing is the Issue.account.
|
||||
STPathElement const* const lastCurrency =
|
||||
*boost::find_if (boost::adaptors::reverse (pes), hasCurrency);
|
||||
*std::find_if (pes.rbegin(), pes.rend(), hasCurrency);
|
||||
if ((lastCurrency->getCurrency() != deliver.currency) ||
|
||||
(offerCrossing && lastCurrency->getIssuerID() != deliver.account))
|
||||
{
|
||||
@@ -472,7 +470,7 @@ toStrandV2 (
|
||||
// Note that for offer crossing (only) we do use an offer book
|
||||
// even if all that is changing is the Issue.account.
|
||||
STPathElement const& lastCurrency =
|
||||
*boost::find_if (boost::adaptors::reverse (normPath),
|
||||
*std::find_if (normPath.rbegin(), normPath.rend(),
|
||||
hasCurrency);
|
||||
if ((lastCurrency.getCurrency() != deliver.currency) ||
|
||||
(offerCrossing &&
|
||||
@@ -731,7 +729,8 @@ toStrands (
|
||||
// Insert the strand into result if it is not already part of the vector
|
||||
auto insert = [&](Strand s)
|
||||
{
|
||||
bool const hasStrand = boost::find (result, s) != result.end ();
|
||||
bool const hasStrand =
|
||||
std::find (result.begin(), result.end(), s) != result.end ();
|
||||
|
||||
if (!hasStrand)
|
||||
result.emplace_back (std::move (s));
|
||||
|
||||
@@ -163,9 +163,17 @@ private:
|
||||
// VFALCO TODO This should only be enabled for maps.
|
||||
class pair_value_compare
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <value_type, value_type, bool>
|
||||
#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
|
||||
{
|
||||
return this->member() (lhs.first, rhs.first);
|
||||
@@ -193,9 +201,17 @@ private:
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueCompare
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <Key, element, bool>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifndef _LIBCPP_VERSION
|
||||
using first_argument = Key;
|
||||
using second_argument = element;
|
||||
using result_type = bool;
|
||||
#endif
|
||||
|
||||
KeyValueCompare () = default;
|
||||
|
||||
KeyValueCompare (Compare const& compare)
|
||||
|
||||
@@ -164,9 +164,16 @@ private:
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class ValueHash
|
||||
: private boost::beast::detail::empty_base_optimization <Hash>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::unary_function <element, std::size_t>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifndef _LIBCPP_VERSION
|
||||
using argument_type = element;
|
||||
using result_type = size_t;
|
||||
#endif
|
||||
|
||||
ValueHash ()
|
||||
{
|
||||
}
|
||||
@@ -196,9 +203,17 @@ private:
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueEqual
|
||||
: private boost::beast::detail::empty_base_optimization <KeyEqual>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <Key, element, bool>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifndef _LIBCPP_VERSION
|
||||
using first_argument_type = Key;
|
||||
using second_argument_type = element;
|
||||
using result_type = bool;
|
||||
#endif
|
||||
|
||||
KeyValueEqual ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,11 +28,19 @@ namespace std {
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
||||
template<class...>
|
||||
using void_t = void;
|
||||
#if ! __cpp_lib_void_t
|
||||
|
||||
template<bool B>
|
||||
using bool_constant = std::integral_constant<bool, B>;
|
||||
template<class...>
|
||||
using void_t = void;
|
||||
|
||||
#endif // ! __cpp_lib_void_t
|
||||
|
||||
#if ! __cpp_lib_bool_constant
|
||||
|
||||
template<bool B>
|
||||
using bool_constant = std::integral_constant<bool, B>;
|
||||
|
||||
#endif // ! __cpp_lib_bool_constant
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -263,11 +263,12 @@ getCashFlow (ReadView const& view, CashFilter f, ApplyStateTable const& table)
|
||||
auto each = [&result, &filters](uint256 const& key, bool isDelete,
|
||||
std::shared_ptr<SLE const> const& before,
|
||||
std::shared_ptr<SLE const> const& after) {
|
||||
|
||||
auto discarded =
|
||||
std::find_if (filters.begin(), filters.end(),
|
||||
[&result, isDelete, &before, &after] (FuncType func) {
|
||||
return func (result, isDelete, before, after);
|
||||
});
|
||||
(void) discarded;
|
||||
};
|
||||
|
||||
table.visit (view, each);
|
||||
|
||||
@@ -84,10 +84,18 @@ private:
|
||||
using map_type = boost::bimap <left_t, right_t>;
|
||||
using value_type = map_type::value_type;
|
||||
|
||||
struct Transform : std::unary_function <
|
||||
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;
|
||||
|
||||
beast::IP::Endpoint const& operator() (
|
||||
|
||||
@@ -71,8 +71,15 @@ public:
|
||||
public:
|
||||
// Iterator transformation to extract the endpoint from Element
|
||||
struct Transform
|
||||
: public std::unary_function <Element, Endpoint>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
: public std::unary_function<Element, Endpoint>
|
||||
#endif
|
||||
{
|
||||
#ifndef _LIBCPP_VERSION
|
||||
using first_argument = Element;
|
||||
using result_type = Endpoint;
|
||||
#endif
|
||||
|
||||
explicit Transform() = default;
|
||||
|
||||
Endpoint const& operator() (Element const& e) const
|
||||
@@ -227,9 +234,15 @@ public:
|
||||
|
||||
template <bool IsConst>
|
||||
struct Transform
|
||||
: public std::unary_function <
|
||||
typename lists_type::value_type, Hop <IsConst>>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
: public std::unary_function<typename lists_type::value_type, Hop<IsConst>>
|
||||
#endif
|
||||
{
|
||||
#ifndef _LIBCPP_VERSION
|
||||
using first_argument = typename lists_type::value_type;
|
||||
using result_type = Hop <IsConst>;
|
||||
#endif
|
||||
|
||||
explicit Transform() = default;
|
||||
|
||||
Hop <IsConst> operator() (typename beast::maybe_const <
|
||||
|
||||
@@ -897,7 +897,7 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
false,
|
||||
env.app().logs().journal("Flow"));
|
||||
BEAST_EXPECT(r.first == expTer);
|
||||
if (sizeof...(expSteps))
|
||||
if (sizeof...(expSteps) !=0 )
|
||||
BEAST_EXPECT(equal(
|
||||
r.second, std::forward<decltype(expSteps)>(expSteps)...));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user