mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Fix clang warnings
This commit is contained in:
committed by
Vinnie Falco
parent
8eddcfd3d5
commit
bb02112752
@@ -300,8 +300,16 @@ template <typename Type>
|
|||||||
inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept
|
inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept
|
||||||
{
|
{
|
||||||
#if BEAST_ATOMICS_MAC
|
#if BEAST_ATOMICS_MAC
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
|
||||||
|
# endif
|
||||||
return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||||
: (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
: (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
# endif
|
||||||
#elif BEAST_ATOMICS_WINDOWS
|
#elif BEAST_ATOMICS_WINDOWS
|
||||||
return sizeof (Type) == 4 ? (Type) (beast_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
|
return sizeof (Type) == 4 ? (Type) (beast_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
|
||||||
: (Type) (beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
|
: (Type) (beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
|
||||||
@@ -320,8 +328,16 @@ template <typename Type>
|
|||||||
inline Type Atomic<Type>::operator++() noexcept
|
inline Type Atomic<Type>::operator++() noexcept
|
||||||
{
|
{
|
||||||
#if BEAST_ATOMICS_MAC
|
#if BEAST_ATOMICS_MAC
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
|
||||||
|
# endif
|
||||||
return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||||
: (Type) OSAtomicIncrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
: (Type) OSAtomicIncrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
# endif
|
||||||
#elif BEAST_ATOMICS_WINDOWS
|
#elif BEAST_ATOMICS_WINDOWS
|
||||||
return sizeof (Type) == 4 ? (Type) beast_InterlockedIncrement ((volatile long*) &value)
|
return sizeof (Type) == 4 ? (Type) beast_InterlockedIncrement ((volatile long*) &value)
|
||||||
: (Type) beast_InterlockedIncrement64 ((volatile __int64*) &value);
|
: (Type) beast_InterlockedIncrement64 ((volatile __int64*) &value);
|
||||||
@@ -334,8 +350,16 @@ template <typename Type>
|
|||||||
inline Type Atomic<Type>::operator--() noexcept
|
inline Type Atomic<Type>::operator--() noexcept
|
||||||
{
|
{
|
||||||
#if BEAST_ATOMICS_MAC
|
#if BEAST_ATOMICS_MAC
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
|
||||||
|
# pragma clang diagnostic ignored "-Wint-to-pointer-cast"
|
||||||
|
# endif
|
||||||
return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||||
: (Type) OSAtomicDecrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
: (Type) OSAtomicDecrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||||
|
# ifdef __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
# endif
|
||||||
#elif BEAST_ATOMICS_WINDOWS
|
#elif BEAST_ATOMICS_WINDOWS
|
||||||
return sizeof (Type) == 4 ? (Type) beast_InterlockedDecrement ((volatile long*) &value)
|
return sizeof (Type) == 4 ? (Type) beast_InterlockedDecrement ((volatile long*) &value)
|
||||||
: (Type) beast_InterlockedDecrement64 ((volatile __int64*) &value);
|
: (Type) beast_InterlockedDecrement64 ((volatile __int64*) &value);
|
||||||
|
|||||||
@@ -1469,7 +1469,7 @@ operator[] (Key const& key)
|
|||||||
std::piecewise_construct, std::forward_as_tuple (key),
|
std::piecewise_construct, std::forward_as_tuple (key),
|
||||||
std::forward_as_tuple ()));
|
std::forward_as_tuple ()));
|
||||||
chronological.list.push_back (*p);
|
chronological.list.push_back (*p);
|
||||||
auto const iter (m_cont.insert_commit (*p, d));
|
m_cont.insert_commit (*p, d);
|
||||||
return p->value.second;
|
return p->value.second;
|
||||||
}
|
}
|
||||||
return result.first->value.second;
|
return result.first->value.second;
|
||||||
@@ -1492,7 +1492,7 @@ operator[] (Key&& key)
|
|||||||
std::forward_as_tuple (std::move (key)),
|
std::forward_as_tuple (std::move (key)),
|
||||||
std::forward_as_tuple ()));
|
std::forward_as_tuple ()));
|
||||||
chronological.list.push_back (*p);
|
chronological.list.push_back (*p);
|
||||||
auto const iter (m_cont.insert_commit (*p, d));
|
m_cont.insert_commit (*p, d);
|
||||||
return p->value.second;
|
return p->value.second;
|
||||||
}
|
}
|
||||||
return result.first->value.second;
|
return result.first->value.second;
|
||||||
|
|||||||
@@ -2077,7 +2077,7 @@ operator[] (Key const& key)
|
|||||||
std::forward_as_tuple (key),
|
std::forward_as_tuple (key),
|
||||||
std::forward_as_tuple ()));
|
std::forward_as_tuple ()));
|
||||||
chronological.list.push_back (*p);
|
chronological.list.push_back (*p);
|
||||||
auto const iter (m_cont.insert_commit (*p, d));
|
m_cont.insert_commit (*p, d);
|
||||||
return p->value.second;
|
return p->value.second;
|
||||||
}
|
}
|
||||||
return result.first->value.second;
|
return result.first->value.second;
|
||||||
@@ -2103,7 +2103,7 @@ operator[] (Key&& key)
|
|||||||
std::forward_as_tuple (std::move (key)),
|
std::forward_as_tuple (std::move (key)),
|
||||||
std::forward_as_tuple ()));
|
std::forward_as_tuple ()));
|
||||||
chronological.list.push_back (*p);
|
chronological.list.push_back (*p);
|
||||||
auto const iter (m_cont.insert_commit (*p, d));
|
m_cont.insert_commit (*p, d);
|
||||||
return p->value.second;
|
return p->value.second;
|
||||||
}
|
}
|
||||||
return result.first->value.second;
|
return result.first->value.second;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public:
|
|||||||
|
|
||||||
void log (std::vector <boost::asio::const_buffer> const& buffers)
|
void log (std::vector <boost::asio::const_buffer> const& buffers)
|
||||||
{
|
{
|
||||||
buffers;
|
(void)buffers;
|
||||||
#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED
|
#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
for (auto const& buffer : buffers)
|
for (auto const& buffer : buffers)
|
||||||
|
|||||||
@@ -343,9 +343,9 @@ public:
|
|||||||
const beast_wchar c = src.getAndAdvance();
|
const beast_wchar c = src.getAndAdvance();
|
||||||
const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c);
|
const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c);
|
||||||
|
|
||||||
maxBytes -= bytesNeeded;
|
if (c == 0 || maxBytes < bytesNeeded)
|
||||||
if (c == 0 || maxBytes < 0)
|
|
||||||
break;
|
break;
|
||||||
|
maxBytes -= bytesNeeded;
|
||||||
|
|
||||||
dest.write (c);
|
dest.write (c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ public:
|
|||||||
#pragma warning (push)
|
#pragma warning (push)
|
||||||
#pragma warning (disable: 4127) // conditional expression is constant
|
#pragma warning (disable: 4127) // conditional expression is constant
|
||||||
#pragma warning (disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
|
#pragma warning (disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||||
#endif
|
#endif
|
||||||
// pass in a pointer to the END of a buffer..
|
// pass in a pointer to the END of a buffer..
|
||||||
template <typename IntegerType>
|
template <typename IntegerType>
|
||||||
@@ -86,6 +89,8 @@ public:
|
|||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct StackArrayStream : public std::basic_streambuf <char, std::char_traits <char> >
|
struct StackArrayStream : public std::basic_streambuf <char, std::char_traits <char> >
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ protected:
|
|||||||
SharedHandler. A reference to the SharedHandler is maintained
|
SharedHandler. A reference to the SharedHandler is maintained
|
||||||
for the lifetime of the composed operation.
|
for the lifetime of the composed operation.
|
||||||
*/
|
*/
|
||||||
ComposedAsyncOperation (std::size_t size, SharedHandlerPtr const& ptr)
|
explicit ComposedAsyncOperation (SharedHandlerPtr const& ptr)
|
||||||
: m_size (size)
|
: m_ptr (ptr)
|
||||||
, m_ptr (ptr)
|
|
||||||
{
|
{
|
||||||
// Illegal to do anything with handler here, because
|
// Illegal to do anything with handler here, because
|
||||||
// usually it hasn't been assigned by the derived class yet.
|
// usually it hasn't been assigned by the derived class yet.
|
||||||
@@ -93,7 +92,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::size_t const m_size;
|
|
||||||
SharedHandlerPtr const m_ptr;
|
SharedHandlerPtr const m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ private:
|
|||||||
|
|
||||||
AsyncOp (HandshakeDetectLogicType <Logic>& logic, Stream& stream,
|
AsyncOp (HandshakeDetectLogicType <Logic>& logic, Stream& stream,
|
||||||
BuffersType& buffer, SharedHandlerPtr const& handler)
|
BuffersType& buffer, SharedHandlerPtr const& handler)
|
||||||
: ComposedAsyncOperation (sizeof (*this), handler)
|
: ComposedAsyncOperation (handler)
|
||||||
, m_logic (logic)
|
, m_logic (logic)
|
||||||
, m_stream (stream)
|
, m_stream (stream)
|
||||||
, m_buffer (buffer)
|
, m_buffer (buffer)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TestPeerDetails
|
|||||||
public:
|
public:
|
||||||
virtual ~TestPeerDetails () { }
|
virtual ~TestPeerDetails () { }
|
||||||
|
|
||||||
virtual String name () = 0;
|
virtual String name () const = 0;
|
||||||
|
|
||||||
virtual Socket& get_socket () = 0;
|
virtual Socket& get_socket () = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
return ".tcp?";
|
return ".tcp?";
|
||||||
}
|
}
|
||||||
|
|
||||||
String name ()
|
String name () const
|
||||||
{
|
{
|
||||||
return getArgName (m_protocol);
|
return getArgName (m_protocol);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user