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