From 08b511cd08336c065dcdb52c84e5e4aac2cb0bc2 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 15 Aug 2020 16:41:51 +0100 Subject: [PATCH] Warning fix on gcc 9.3.0 with logging disabled --- include/restc-cpp/restc-cpp.h | 4 ++-- src/ChunkedReaderImpl.cpp | 7 +++++++ src/IoWriterImpl.cpp | 8 ++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/restc-cpp/restc-cpp.h b/include/restc-cpp/restc-cpp.h index 4ea1b55..1043a09 100644 --- a/include/restc-cpp/restc-cpp.h +++ b/include/restc-cpp/restc-cpp.h @@ -145,7 +145,7 @@ class Request { class Properties { public: using ptr_t = std::shared_ptr; - using redirect_fn_t = std::function; int maxRedirects = 3; @@ -382,7 +382,7 @@ class RestClient { done_handler.reset(); }); - return move(future); + return future; } diff --git a/src/ChunkedReaderImpl.cpp b/src/ChunkedReaderImpl.cpp index 1f5ae5d..fc01c92 100644 --- a/src/ChunkedReaderImpl.cpp +++ b/src/ChunkedReaderImpl.cpp @@ -46,8 +46,15 @@ class ChunkedReaderImpl : public DataReader { } void Log(const boost::asio::const_buffers_1 buffers, const char *tag) { +#if __cplusplus >= 201703L + [[maybe_unused]] +#endif const auto buf_len = boost::asio::buffer_size(*buffers.begin()); +#if __cplusplus < 201703L + static_cast(buf_len); +#endif + // At the time of the implementation, there are never multiple buffers. RESTC_CPP_LOG_TRACE_(tag << ' ' << "# " << buf_len << " bytes: " diff --git a/src/IoWriterImpl.cpp b/src/IoWriterImpl.cpp index 256c287..e0f52b7 100644 --- a/src/IoWriterImpl.cpp +++ b/src/IoWriterImpl.cpp @@ -33,9 +33,7 @@ class IoWriterImpl : public DataWriter { connection_->GetSocket().AsyncWrite(buffers, ctx_.GetYield()); } - const auto bytes = boost::asio::buffer_size(buffers); - - RESTC_CPP_LOG_TRACE_("Wrote #" << bytes + RESTC_CPP_LOG_TRACE_("Wrote #" << boost::asio::buffer_size(buffers) << " bytes to " << connection_); } @@ -49,9 +47,7 @@ class IoWriterImpl : public DataWriter { connection_->GetSocket().AsyncWrite(buffers, ctx_.GetYield()); } - const auto bytes = boost::asio::buffer_size(buffers); - - RESTC_CPP_LOG_TRACE_("Wrote #" << bytes + RESTC_CPP_LOG_TRACE_("Wrote #" << boost::asio::buffer_size(buffers) << " bytes to " << connection_); }