diff --git a/beast/Atomic.h b/beast/Atomic.h index 97b271b8e3..e64debf0b3 100644 --- a/beast/Atomic.h +++ b/beast/Atomic.h @@ -300,8 +300,16 @@ template inline Type Atomic::operator+= (const Type amountToAdd) noexcept { #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) : (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value); +# ifdef __clang__ +# pragma clang diagnostic pop +# endif #elif BEAST_ATOMICS_WINDOWS return sizeof (Type) == 4 ? (Type) (beast_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd) : (Type) (beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd); @@ -320,8 +328,16 @@ template inline Type Atomic::operator++() noexcept { #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) : (Type) OSAtomicIncrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value); +# ifdef __clang__ +# pragma clang diagnostic pop +# endif #elif BEAST_ATOMICS_WINDOWS return sizeof (Type) == 4 ? (Type) beast_InterlockedIncrement ((volatile long*) &value) : (Type) beast_InterlockedIncrement64 ((volatile __int64*) &value); @@ -334,8 +350,16 @@ template inline Type Atomic::operator--() noexcept { #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) : (Type) OSAtomicDecrement64Barrier ((BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value); +# ifdef __clang__ +# pragma clang diagnostic pop +# endif #elif BEAST_ATOMICS_WINDOWS return sizeof (Type) == 4 ? (Type) beast_InterlockedDecrement ((volatile long*) &value) : (Type) beast_InterlockedDecrement64 ((volatile __int64*) &value); diff --git a/beast/container/detail/aged_ordered_container.h b/beast/container/detail/aged_ordered_container.h index 2759fd5b01..7c933d60d9 100644 --- a/beast/container/detail/aged_ordered_container.h +++ b/beast/container/detail/aged_ordered_container.h @@ -1469,7 +1469,7 @@ operator[] (Key const& key) std::piecewise_construct, std::forward_as_tuple (key), std::forward_as_tuple ())); 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 result.first->value.second; @@ -1492,7 +1492,7 @@ operator[] (Key&& key) std::forward_as_tuple (std::move (key)), std::forward_as_tuple ())); 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 result.first->value.second; diff --git a/beast/container/detail/aged_unordered_container.h b/beast/container/detail/aged_unordered_container.h index f5e3ec3dec..23af08bbac 100644 --- a/beast/container/detail/aged_unordered_container.h +++ b/beast/container/detail/aged_unordered_container.h @@ -2077,7 +2077,7 @@ operator[] (Key const& key) std::forward_as_tuple (key), std::forward_as_tuple ())); 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 result.first->value.second; @@ -2103,7 +2103,7 @@ operator[] (Key&& key) std::forward_as_tuple (std::move (key)), std::forward_as_tuple ())); 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 result.first->value.second; diff --git a/beast/insight/impl/StatsDCollector.cpp b/beast/insight/impl/StatsDCollector.cpp index 4625bc1180..85271097c4 100644 --- a/beast/insight/impl/StatsDCollector.cpp +++ b/beast/insight/impl/StatsDCollector.cpp @@ -335,7 +335,7 @@ public: void log (std::vector const& buffers) { - buffers; + (void)buffers; #if BEAST_STATSDCOLLECTOR_TRACING_ENABLED std::stringstream ss; for (auto const& buffer : buffers) diff --git a/beast/strings/CharacterFunctions.h b/beast/strings/CharacterFunctions.h index 4c17e44633..f369544129 100644 --- a/beast/strings/CharacterFunctions.h +++ b/beast/strings/CharacterFunctions.h @@ -343,9 +343,9 @@ public: const beast_wchar c = src.getAndAdvance(); const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c); - maxBytes -= bytesNeeded; - if (c == 0 || maxBytes < 0) + if (c == 0 || maxBytes < bytesNeeded) break; + maxBytes -= bytesNeeded; dest.write (c); } diff --git a/beast/strings/StringFromNumber.h b/beast/strings/StringFromNumber.h index 3534f27b02..b50a989e2b 100644 --- a/beast/strings/StringFromNumber.h +++ b/beast/strings/StringFromNumber.h @@ -64,6 +64,9 @@ public: #pragma warning (push) #pragma warning (disable: 4127) // conditional expression is constant #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 // pass in a pointer to the END of a buffer.. template @@ -86,6 +89,8 @@ public: } #ifdef _MSC_VER #pragma warning (pop) +#elif defined(__clang__) +#pragma clang diagnostic pop #endif struct StackArrayStream : public std::basic_streambuf > diff --git a/modules/beast_asio/async/ComposedAsyncOperation.h b/modules/beast_asio/async/ComposedAsyncOperation.h index a5884ccb16..e158371243 100644 --- a/modules/beast_asio/async/ComposedAsyncOperation.h +++ b/modules/beast_asio/async/ComposedAsyncOperation.h @@ -33,9 +33,8 @@ protected: SharedHandler. A reference to the SharedHandler is maintained for the lifetime of the composed operation. */ - ComposedAsyncOperation (std::size_t size, SharedHandlerPtr const& ptr) - : m_size (size) - , m_ptr (ptr) + explicit ComposedAsyncOperation (SharedHandlerPtr const& ptr) + : m_ptr (ptr) { // Illegal to do anything with handler here, because // usually it hasn't been assigned by the derived class yet. @@ -93,7 +92,6 @@ protected: } private: - std::size_t const m_size; SharedHandlerPtr const m_ptr; }; diff --git a/modules/beast_asio/protocol/HandshakeDetector.h b/modules/beast_asio/protocol/HandshakeDetector.h index d1ec84c14a..e4d734f5c9 100644 --- a/modules/beast_asio/protocol/HandshakeDetector.h +++ b/modules/beast_asio/protocol/HandshakeDetector.h @@ -129,7 +129,7 @@ private: AsyncOp (HandshakeDetectLogicType & logic, Stream& stream, BuffersType& buffer, SharedHandlerPtr const& handler) - : ComposedAsyncOperation (sizeof (*this), handler) + : ComposedAsyncOperation (handler) , m_logic (logic) , m_stream (stream) , m_buffer (buffer) diff --git a/modules/beast_asio/tests/TestPeerDetails.h b/modules/beast_asio/tests/TestPeerDetails.h index 8ad8b92840..d8b69202b6 100644 --- a/modules/beast_asio/tests/TestPeerDetails.h +++ b/modules/beast_asio/tests/TestPeerDetails.h @@ -27,7 +27,7 @@ class TestPeerDetails public: virtual ~TestPeerDetails () { } - virtual String name () = 0; + virtual String name () const = 0; virtual Socket& get_socket () = 0; diff --git a/modules/beast_asio/tests/TestPeerDetailsTcp.h b/modules/beast_asio/tests/TestPeerDetailsTcp.h index 8e64ca49c5..11fdbde840 100644 --- a/modules/beast_asio/tests/TestPeerDetailsTcp.h +++ b/modules/beast_asio/tests/TestPeerDetailsTcp.h @@ -54,7 +54,7 @@ public: return ".tcp?"; } - String name () + String name () const { return getArgName (m_protocol); }