From a0607aceffc717ddc7a3881bf98fa2b10c6745bb Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 22 Feb 2022 17:47:54 +0100 Subject: [PATCH] Fix compiler warnings don't move local variables --- lib/base/netstring.cpp | 4 ++-- lib/base/perfdatavalue.cpp | 4 ++-- lib/base/tlsutility.cpp | 2 +- lib/cli/consolecommand.cpp | 2 +- lib/icinga/checkable-comment.cpp | 2 +- lib/icingadb/icingadb-objects.cpp | 6 +++--- lib/icingadb/redisconnection.hpp | 2 +- lib/perfdata/elasticsearchwriter.cpp | 2 +- lib/perfdata/influxdb2writer.cpp | 4 ++-- lib/perfdata/influxdbcommonwriter.cpp | 6 +++--- lib/perfdata/influxdbwriter.cpp | 4 ++-- lib/remote/configobjectutility.cpp | 2 +- lib/remote/eventqueue.cpp | 2 +- lib/remote/jsonrpc.cpp | 4 ++-- plugins/check_nscp_api.cpp | 4 ++-- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/base/netstring.cpp b/lib/base/netstring.cpp index fb8098a65..60f08c265 100644 --- a/lib/base/netstring.cpp +++ b/lib/base/netstring.cpp @@ -194,7 +194,7 @@ String NetString::ReadStringFromStream(const Shared::Ptr& stream, BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid NetString (missing ,)")); } - return std::move(payload); + return payload; } /** @@ -273,7 +273,7 @@ String NetString::ReadStringFromStream(const Shared::Ptr& stream, BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid NetString (missing ,)")); } - return std::move(payload); + return payload; } /** diff --git a/lib/base/perfdatavalue.cpp b/lib/base/perfdatavalue.cpp index 6268ac1bb..60a39e4e8 100644 --- a/lib/base/perfdatavalue.cpp +++ b/lib/base/perfdatavalue.cpp @@ -154,7 +154,7 @@ static const UoMs l_CsUoMs (([]() -> UoMs { } } - return std::move(uniqUoms); + return uniqUoms; })()); static const UoMs l_CiUoMs (([]() -> UoMs { @@ -208,7 +208,7 @@ static const UoMs l_CiUoMs (([]() -> UoMs { } } - return std::move(uniqUoms); + return uniqUoms; })()); PerfdataValue::PerfdataValue(const String& label, double value, bool counter, diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index 7032c7a3a..54f8a865f 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -298,7 +298,7 @@ Shared::Ptr SetupSslContext(String certPath, String k } } - return std::move(context); + return context; } /** diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index b54966e7b..78906bb2a 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -557,7 +557,7 @@ Shared::Ptr ConsoleCommand::Connect() throw; } - return std::move(stream); + return stream; } /** diff --git a/lib/icinga/checkable-comment.cpp b/lib/icinga/checkable-comment.cpp index bb26a6d3c..135f35520 100644 --- a/lib/icinga/checkable-comment.cpp +++ b/lib/icinga/checkable-comment.cpp @@ -54,7 +54,7 @@ Comment::Ptr Checkable::GetLastComment() const } } - return std::move(lastComment); + return lastComment; } void Checkable::RegisterComment(const Comment::Ptr& comment) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index e075db183..233cf9bda 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -554,7 +554,7 @@ std::vector>> IcingaDB::ChunkObjects(std chunks.emplace_back(offset, end); } - return std::move(chunks); + return chunks; } void IcingaDB::DeleteKeys(const RedisConnection::Ptr& conn, const std::vector& keys, RedisConnection::QueryPriority priority) { @@ -591,7 +591,7 @@ std::vector IcingaDB::GetTypeOverwriteKeys(const String& type) keys.emplace_back(m_PrefixConfigCheckSum + type + ":argument"); } - return std::move(keys); + return keys; } std::vector IcingaDB::GetTypeDumpSignalKeys(const Type::Ptr& type) @@ -621,7 +621,7 @@ std::vector IcingaDB::GetTypeDumpSignalKeys(const Type::Ptr& type) keys.emplace_back(m_PrefixConfigObject + lcType + ":argument"); } - return std::move(keys); + return keys; } template diff --git a/lib/icingadb/redisconnection.hpp b/lib/icingadb/redisconnection.hpp index 0a9bfd61d..fb9d1e584 100644 --- a/lib/icingadb/redisconnection.hpp +++ b/lib/icingadb/redisconnection.hpp @@ -598,7 +598,7 @@ std::vector RedisConnection::ReadLine(AsyncReadStream& stream, boost::asio if (next == '\r') { asio::async_read(stream, buf, yc); - return std::move(line); + return line; } line.emplace_back(next); diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 477616b23..f18a494b5 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -646,7 +646,7 @@ OptionalTlsStream ElasticsearchWriter::Connect() } } - return std::move(stream); + return stream; } void ElasticsearchWriter::AssertOnWorkQueue() diff --git a/lib/perfdata/influxdb2writer.cpp b/lib/perfdata/influxdb2writer.cpp index 57fc94e23..c92d7d406 100644 --- a/lib/perfdata/influxdb2writer.cpp +++ b/lib/perfdata/influxdb2writer.cpp @@ -27,7 +27,7 @@ boost::beast::http::request Influxdb2Writer::As request.set(boost::beast::http::field::authorization, "Token " + GetAuthToken()); - return std::move(request); + return request; } Url::Ptr Influxdb2Writer::AssembleUrl() @@ -40,5 +40,5 @@ Url::Ptr Influxdb2Writer::AssembleUrl() url->AddQueryElement("org", GetOrganization()); url->AddQueryElement("bucket", GetBucket()); - return std::move(url); + return url; } diff --git a/lib/perfdata/influxdbcommonwriter.cpp b/lib/perfdata/influxdbcommonwriter.cpp index 98eb453b7..220841001 100644 --- a/lib/perfdata/influxdbcommonwriter.cpp +++ b/lib/perfdata/influxdbcommonwriter.cpp @@ -192,7 +192,7 @@ OptionalTlsStream InfluxdbCommonWriter::Connect() } } - return std::move(stream); + return stream; } void InfluxdbCommonWriter::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) @@ -540,7 +540,7 @@ boost::beast::http::request InfluxdbCommonWrite request.body() = std::move(body); request.content_length(request.body().size()); - return std::move(request); + return request; } Url::Ptr InfluxdbCommonWriter::AssembleBaseUrl() @@ -552,7 +552,7 @@ Url::Ptr InfluxdbCommonWriter::AssembleBaseUrl() url->SetPort(GetPort()); url->AddQueryElement("precision", "s"); - return std::move(url); + return url; } void InfluxdbCommonWriter::ValidateHostTemplate(const Lazy& lvalue, const ValidationUtils& utils) diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index 30240f7f4..4bc992d60 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -34,7 +34,7 @@ boost::beast::http::request InfluxdbWriter::Ass ); } - return std::move(request); + return request; } Url::Ptr InfluxdbWriter::AssembleUrl() @@ -52,5 +52,5 @@ Url::Ptr InfluxdbWriter::AssembleUrl() if (!GetPassword().IsEmpty()) url->AddQueryElement("p", GetPassword()); - return std::move(url); + return url; } diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 1faeb9a07..b4fa9ac5c 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -53,7 +53,7 @@ String ConfigObjectUtility::GetObjectConfigPath(const Type::Ptr& type, const Str * creation early so that configuration inconsistencies throughout the cluster are avoided. */ if ((type->GetName() != "Comment" && type->GetName() != "Downtime") || Utility::PathExists(longPath)) { - return std::move(longPath); + return longPath; } /* Maximum length 80 bytes object name + 3 bytes "..." + 40 bytes SHA1 (hex-encoded) */ diff --git a/lib/remote/eventqueue.cpp b/lib/remote/eventqueue.cpp index fd911f0f8..d79b61589 100644 --- a/lib/remote/eventqueue.cpp +++ b/lib/remote/eventqueue.cpp @@ -231,7 +231,7 @@ Dictionary::Ptr EventsInbox::Shift(boost::asio::yield_context yc, double timeout auto event (std::move(m_Queue.front())); m_Queue.pop(); - return std::move(event); + return event; } EventsSubscriber::EventsSubscriber(std::set types, String filter, const String& filterSource) diff --git a/lib/remote/jsonrpc.cpp b/lib/remote/jsonrpc.cpp index 58288001c..d4d3d3cb3 100644 --- a/lib/remote/jsonrpc.cpp +++ b/lib/remote/jsonrpc.cpp @@ -113,7 +113,7 @@ String JsonRpc::ReadMessage(const Shared::Ptr& stream, ssize_t ma std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n"; #endif /* I2_DEBUG */ - return std::move(jsonString); + return jsonString; } /** @@ -134,7 +134,7 @@ String JsonRpc::ReadMessage(const Shared::Ptr& stream, boost::asi std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n"; #endif /* I2_DEBUG */ - return std::move(jsonString); + return jsonString; } /** diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index 3f6843ec2..aef43fb98 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -206,7 +206,7 @@ static Shared::Ptr Connect(const String& host, const String& port throw; } - return std::move(stream); + return stream; } static const char l_ReasonToInject[2] = {' ', 'X'}; @@ -223,7 +223,7 @@ boost::asio::mutable_buffer GetFirstNonZeroBuffer(const MutableBufferSequence& m asio::mutable_buffer buf (*current); if (buf.size() > 0u) { - return std::move(buf); + return buf; } }