mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-05 08:48:03 +00:00
Fix Clang compile and link errors
This commit is contained in:
@@ -130,9 +130,6 @@ extern std::size_t hash_value (beast::URL const& url);
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename T>
|
||||
struct hash;
|
||||
|
||||
template <>
|
||||
struct hash <beast::URL>
|
||||
{
|
||||
|
||||
@@ -26,16 +26,6 @@
|
||||
|
||||
#include "../CStdInt.h"
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename T>
|
||||
struct hash;
|
||||
|
||||
//template <>
|
||||
//struct hash <beast::IPAddress>;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace beast {
|
||||
@@ -400,9 +390,6 @@ inline bool IPAddress::EqualWithoutPort::operator() (
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename T>
|
||||
struct hash;
|
||||
|
||||
template <>
|
||||
struct hash <beast::IPAddress>
|
||||
{
|
||||
|
||||
@@ -437,10 +437,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static int const callsPerThread = 10000;
|
||||
static std::size_t const totalCalls = 10000;
|
||||
|
||||
void testThreads (std::size_t n)
|
||||
{
|
||||
std::size_t const callsPerThread (totalCalls / n);
|
||||
beginTestCase (String::fromNumber (n) + " threads");
|
||||
ServiceQueue service (n);
|
||||
std::vector <ScopedPointer <ServiceThread> > threads;
|
||||
|
||||
@@ -27,11 +27,7 @@
|
||||
|
||||
// Include this to get all the basic includes included, to prevent errors
|
||||
#include "../beast/modules/beast_core/beast_core.h"
|
||||
|
||||
// Mac builds use ripple_beastobjc.mm
|
||||
#ifndef BEAST_MAC
|
||||
# include "../beast/modules/beast_core/beast_core.cpp"
|
||||
#endif
|
||||
#include "../beast/modules/beast_core/beast_core.cpp"
|
||||
|
||||
#include "../beast/modules/beast_asio/beast_asio.cpp"
|
||||
#include "../beast/modules/beast_sqdb/beast_sqdb.cpp"
|
||||
|
||||
@@ -127,6 +127,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <std::size_t Size, uint8 Token, bool Checked>
|
||||
typename CryptoIdentifier <Size, Token, Checked>::size_type
|
||||
const CryptoIdentifier <Size, Token, Checked>::size;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -220,9 +220,6 @@ std::istream& operator>> (std::istream& is,
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename>
|
||||
struct hash;
|
||||
|
||||
/** Specialization for hash. */
|
||||
template <class Traits>
|
||||
struct hash <ripple::IdentifierType <Traits> >
|
||||
@@ -254,9 +251,6 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <typename>
|
||||
struct equal_to;
|
||||
|
||||
/** Specialization for equal_to. */
|
||||
template <class Traits>
|
||||
struct equal_to <ripple::IdentifierType <Traits> >
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef RIPPLE_TYPES_RIPPLEASSETS_H_INCLUDED
|
||||
#define RIPPLE_TYPES_RIPPLEASSETS_H_INCLUDED
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -194,9 +194,6 @@ extern std::size_t hash_value (const uint160&);
|
||||
|
||||
namespace std {
|
||||
|
||||
template <class>
|
||||
struct hash;
|
||||
|
||||
template <>
|
||||
struct hash <ripple::uint160> : ripple::uint160::hasher
|
||||
{
|
||||
@@ -210,9 +207,6 @@ struct hash <ripple::uint160> : ripple::uint160::hasher
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class>
|
||||
struct hash;
|
||||
|
||||
template <>
|
||||
struct hash <ripple::uint160> : ripple::uint160::hasher
|
||||
{
|
||||
|
||||
@@ -531,9 +531,6 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <typename>
|
||||
struct equal_to;
|
||||
|
||||
/** Specialization for equal_to. */
|
||||
template <unsigned int BITS>
|
||||
struct equal_to <ripple::base_uint <BITS> >
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
# include <windows.h>
|
||||
# include <wincrypt.h>
|
||||
#endif
|
||||
#if BEAST_LINUX || BEAST_BSD
|
||||
#if BEAST_LINUX || BEAST_BSD || BEAST_MAC || BEAST_IOS
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <time.h>
|
||||
|
||||
@@ -28,6 +28,16 @@
|
||||
# define STL_SET_HAS_EMPLACE 0
|
||||
#endif
|
||||
|
||||
#ifndef RIPPLE_ASSETS_ENABLE_STD_HASH
|
||||
# if BEAST_MAC || BEAST_IOS
|
||||
# define RIPPLE_ASSETS_ENABLE_STD_HASH 0
|
||||
# else
|
||||
# define RIPPLE_ASSETS_ENABLE_STD_HASH 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class RippleAssetTests : public UnitTest
|
||||
@@ -50,7 +60,7 @@ public:
|
||||
expect (u3 >= u2);
|
||||
expect (u3 > u2);
|
||||
|
||||
std::hash <Unsigned> const hash;
|
||||
std::hash <Unsigned> hash;
|
||||
|
||||
expect (hash (u1) == hash (u1));
|
||||
expect (hash (u2) == hash (u2));
|
||||
@@ -87,7 +97,7 @@ public:
|
||||
expect (Asset (c1, i3) >= Asset (c1, i2));
|
||||
expect (Asset (c1, i3) > Asset (c1, i2));
|
||||
|
||||
std::hash <Asset> const hash;
|
||||
std::hash <Asset> hash;
|
||||
|
||||
expect (hash (Asset (c1, i1)) == hash (Asset (c1, i1)));
|
||||
expect (hash (Asset (c1, i2)) == hash (Asset (c1, i2)));
|
||||
@@ -201,11 +211,13 @@ public:
|
||||
beginTestCase ("std::set <RippleAssetRef>");
|
||||
testAssetSet <std::set <RippleAssetRef>> ();
|
||||
|
||||
#if RIPPLE_ASSETS_ENABLE_STD_HASH
|
||||
beginTestCase ("std::unordered_set <RippleAsset>");
|
||||
testAssetSet <std::unordered_set <RippleAsset>> ();
|
||||
|
||||
beginTestCase ("std::unordered_set <RippleAssetRef>");
|
||||
testAssetSet <std::unordered_set <RippleAssetRef>> ();
|
||||
#endif
|
||||
|
||||
beginTestCase ("boost::unordered_set <RippleAsset>");
|
||||
testAssetSet <boost::unordered_set <RippleAsset>> ();
|
||||
@@ -222,6 +234,7 @@ public:
|
||||
beginTestCase ("std::map <RippleAssetRef, int>");
|
||||
testAssetMap <std::map <RippleAssetRef, int>> ();
|
||||
|
||||
#if RIPPLE_ASSETS_ENABLE_STD_HASH
|
||||
beginTestCase ("std::unordered_map <RippleAsset, int>");
|
||||
testAssetMap <std::unordered_map <RippleAsset, int>> ();
|
||||
|
||||
@@ -233,6 +246,8 @@ public:
|
||||
|
||||
beginTestCase ("boost::unordered_map <RippleAssetRef, int>");
|
||||
testAssetMap <boost::unordered_map <RippleAssetRef, int>> ();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -259,7 +274,7 @@ public:
|
||||
expect (Book (a3, a4) >= Book (a2, a3));
|
||||
expect (Book (a3, a4) > Book (a2, a3));
|
||||
|
||||
std::hash <Book> const hash;
|
||||
std::hash <Book> hash;
|
||||
|
||||
expect (hash (Book (a1, a2)) == hash (Book (a1, a2)));
|
||||
expect (hash (Book (a1, a3)) == hash (Book (a1, a3)));
|
||||
@@ -381,11 +396,13 @@ public:
|
||||
beginTestCase ("std::set <RippleBookRef>");
|
||||
testBookSet <std::set <RippleBookRef>> ();
|
||||
|
||||
#if RIPPLE_ASSETS_ENABLE_STD_HASH
|
||||
beginTestCase ("std::unordered_set <RippleBook>");
|
||||
testBookSet <std::unordered_set <RippleBook>> ();
|
||||
|
||||
beginTestCase ("std::unordered_set <RippleBookRef>");
|
||||
testBookSet <std::unordered_set <RippleBookRef>> ();
|
||||
#endif
|
||||
|
||||
beginTestCase ("boost::unordered_set <RippleBook>");
|
||||
testBookSet <boost::unordered_set <RippleBook>> ();
|
||||
@@ -402,6 +419,7 @@ public:
|
||||
beginTestCase ("std::map <RippleBookRef, int>");
|
||||
testBookMap <std::map <RippleBookRef, int>> ();
|
||||
|
||||
#if RIPPLE_ASSETS_ENABLE_STD_HASH
|
||||
beginTestCase ("std::unordered_map <RippleBook, int>");
|
||||
testBookMap <std::unordered_map <RippleBook, int>> ();
|
||||
|
||||
@@ -413,6 +431,7 @@ public:
|
||||
|
||||
beginTestCase ("boost::unordered_map <RippleBookRef, int>");
|
||||
testBookMap <boost::unordered_map <RippleBookRef, int>> ();
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -47,3 +47,5 @@
|
||||
#include "impl/RippleIdentifierTests.cpp"
|
||||
#include "impl/RippleAssets.cpp"
|
||||
#include "impl/JsonPropertyStream.cpp"
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ using namespace beast;
|
||||
# include "api/ByteOrder.h"
|
||||
# include "api/strHex.h"
|
||||
# include "api/UInt128.h"
|
||||
# include "api/UInt160.h"
|
||||
# include "api/UInt256.h"
|
||||
# include "api/UInt160.h"
|
||||
# include "api/RandomNumbers.h"
|
||||
#include "api/HashMaps.h"
|
||||
|
||||
|
||||
@@ -1906,6 +1906,10 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
LedgerConsensus::~LedgerConsensus ()
|
||||
{
|
||||
}
|
||||
|
||||
boost::shared_ptr <LedgerConsensus> LedgerConsensus::New(LedgerHash const & prevLCLHash,
|
||||
Ledger::ref previousLedger, uint32 closeTime)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
LedgerHash const & prevLCLHash, Ledger::ref previousLedger,
|
||||
uint32 closeTime);
|
||||
|
||||
virtual ~LedgerConsensus () = 0;
|
||||
|
||||
virtual int startup () = 0;
|
||||
|
||||
virtual Json::Value getJson (bool full) = 0;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO TODO Reduce these boost dependencies. Make more interfaces
|
||||
@@ -76,13 +77,13 @@ namespace ripple {
|
||||
// VFALCO NOTE Have to step outside the ripple namespace to
|
||||
// get the specialization for std::hash, et. al.
|
||||
#include "shamap/SHAMapNode.h"
|
||||
|
||||
namespace ripple {
|
||||
#include "shamap/SHAMapTreeNode.h"
|
||||
#include "shamap/SHAMapMissingNode.h"
|
||||
#include "shamap/SHAMapSyncFilter.h"
|
||||
#include "shamap/SHAMapAddNode.h"
|
||||
#include "shamap/SHAMap.h"
|
||||
|
||||
namespace ripple {
|
||||
#include "misc/SerializedTransaction.h"
|
||||
#include "misc/SerializedLedger.h"
|
||||
#include "tx/TransactionMeta.h"
|
||||
|
||||
@@ -29,6 +29,30 @@ enum SHAMapState
|
||||
smsInvalid = 4, // Map is known not to be valid (usually synching a corrupt ledger)
|
||||
};
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash <ripple::SHAMapNode>
|
||||
{
|
||||
std::size_t operator() (ripple::SHAMapNode const& value) const
|
||||
{
|
||||
return value.getMHash ();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <>
|
||||
struct hash <ripple::SHAMapNode> : std::hash <ripple::SHAMapNode>
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class SHAMap
|
||||
: public CountedObject <SHAMap>
|
||||
{
|
||||
@@ -290,4 +314,6 @@ private:
|
||||
MissingNodeHandler m_missing_node_handler;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_SHAMAPADDNODE_H
|
||||
#define RIPPLE_SHAMAPADDNODE_H
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// results of adding nodes
|
||||
class SHAMapAddNode
|
||||
{
|
||||
@@ -131,4 +133,6 @@ private:
|
||||
int mDuplicate;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,8 @@ enum SHAMapType
|
||||
smtFREE = 3, // A tree not part of a ledger
|
||||
};
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class SHAMapMissingNode : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
@@ -95,4 +97,6 @@ private:
|
||||
|
||||
extern std::ostream& operator<< (std::ostream&, SHAMapMissingNode const&);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -135,6 +135,7 @@ inline std::ostream& operator<< (std::ostream& out, const SHAMapNode& node)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
@@ -147,9 +148,11 @@ struct hash <ripple::SHAMapNode>
|
||||
};
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
namespace boost {
|
||||
|
||||
template <>
|
||||
@@ -158,5 +161,6 @@ struct hash <ripple::SHAMapNode> : std::hash <ripple::SHAMapNode>
|
||||
};
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
/** Callback for filtering SHAMap during sync.
|
||||
*/
|
||||
namespace ripple {
|
||||
|
||||
class SHAMapSyncFilter
|
||||
{
|
||||
public:
|
||||
@@ -39,4 +41,6 @@ public:
|
||||
Blob& nodeData) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,8 @@ enum SHANodeFormat
|
||||
snfHASH = 3, // just the hash
|
||||
};
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class SHAMapTreeNode
|
||||
: public SHAMapNode
|
||||
, public CountedObject <SHAMapTreeNode>
|
||||
@@ -183,4 +185,6 @@ private:
|
||||
bool updateHash ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -86,7 +86,6 @@ public:
|
||||
static Journal::Severity convertLogSeverity (LogSeverity level);
|
||||
/** @} */
|
||||
|
||||
private:
|
||||
/** Retrieve the name for a log partition. */
|
||||
template <class Key>
|
||||
static char const* getPartitionName ();
|
||||
@@ -100,19 +99,30 @@ private:
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class Key>
|
||||
struct LogPartitionType : LogPartition
|
||||
{
|
||||
LogPartitionType () : LogPartition (getPartitionName <Key> ())
|
||||
{ }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class Key>
|
||||
LogPartition& LogPartition::get ()
|
||||
{
|
||||
struct LogPartitionType : LogPartition
|
||||
{
|
||||
LogPartitionType () : LogPartition (getPartitionName <Key> ())
|
||||
{ }
|
||||
};
|
||||
|
||||
// Each LogPartition is a singleton.
|
||||
return *SharedSingleton <LogPartitionType>::getInstance();
|
||||
return *SharedSingleton <
|
||||
detail::LogPartitionType <Key>>::getInstance();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO These macros are deprecated. Use the Journal class instead.
|
||||
|
||||
#define SETUP_LOG(Class) \
|
||||
template <> char const* LogPartition::getPartitionName <Class> () { return #Class; } \
|
||||
struct Class##Instantiator { Class##Instantiator () { LogPartition::get <Class> (); } }; \
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace websocketpp {
|
||||
|
||||
typedef boost::asio::buffers_iterator<boost::asio::streambuf::const_buffers_type> bufIterator;
|
||||
|
||||
static std::pair<bufIterator, bool> match_header(boost::shared_ptr<std::string> string,
|
||||
static inline std::pair<bufIterator, bool> match_header(boost::shared_ptr<std::string> string,
|
||||
bufIterator nBegin, bufIterator nEnd)
|
||||
{
|
||||
if (nBegin == nEnd)
|
||||
|
||||
Reference in New Issue
Block a user