Skip to content

Commit f42510f

Browse files
Merge pull request #9411 from Icinga/compiler-warnings
Fix compiler warnings
2 parents 5d46ca4 + d877e81 commit f42510f

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

lib/base/object-packer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,5 @@ String icinga::PackObject(const Value& value)
242242
std::string builder;
243243
PackAny(value, builder);
244244

245-
return std::move(builder);
245+
return builder;
246246
}

lib/base/tcpsocket.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
3232
{
3333
addrinfo hints;
3434
addrinfo *result;
35-
int error;
36-
const char *func;
35+
int error = 0;
36+
const char *func = nullptr;
3737

3838
memset(&hints, 0, sizeof(hints));
3939
hints.ai_family = family;
@@ -126,8 +126,8 @@ void TcpSocket::Connect(const String& node, const String& service)
126126
{
127127
addrinfo hints;
128128
addrinfo *result;
129-
int error;
130-
const char *func;
129+
int error = 0;
130+
const char *func = nullptr;
131131

132132
memset(&hints, 0, sizeof(hints));
133133
hints.ai_family = AF_UNSPEC;

lib/base/tcpsocket.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void Connect(Socket& socket, const String& node, const String& service)
5454
} catch (const std::exception& ex) {
5555
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
5656

57-
if (se && se->code() == boost::asio::error::operation_aborted || ++current == result.end()) {
57+
if ((se && se->code() == boost::asio::error::operation_aborted) || ++current == result.end()) {
5858
throw;
5959
}
6060

@@ -84,7 +84,7 @@ void Connect(Socket& socket, const String& node, const String& service, boost::a
8484
} catch (const std::exception& ex) {
8585
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
8686

87-
if (se && se->code() == boost::asio::error::operation_aborted || ++current == result.end()) {
87+
if ((se && se->code() == boost::asio::error::operation_aborted) || ++current == result.end()) {
8888
throw;
8989
}
9090

lib/base/workqueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ boost::thread_specific_ptr<WorkQueue *> l_ThreadWorkQueue;
1616

1717
WorkQueue::WorkQueue(size_t maxItems, int threadCount, LogSeverity statsLogLevel)
1818
: m_ID(m_NextID++), m_ThreadCount(threadCount), m_MaxItems(maxItems),
19-
m_TaskStats(15 * 60), m_StatsLogLevel(statsLogLevel)
19+
m_StatsLogLevel(statsLogLevel), m_TaskStats(15 * 60)
2020
{
2121
/* Initialize logger. */
2222
m_StatusTimerTimeout = Utility::GetTime();

lib/config/config_parser.yy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ std::unique_ptr<Expression> ConfigCompiler::Compile()
280280

281281
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(dlist))};
282282
expr->MakeInline();
283-
return std::move(expr);
283+
return expr;
284284
}
285285

286286
#define scanner (context->GetScanner())

lib/config/configcompiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ std::unique_ptr<Expression> ConfigCompiler::HandleInclude(const String& relative
146146

147147
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(expressions))};
148148
expr->MakeInline();
149-
return std::move(expr);
149+
return expr;
150150
}
151151

152152
/**
@@ -174,7 +174,7 @@ std::unique_ptr<Expression> ConfigCompiler::HandleIncludeRecursive(const String&
174174

175175
std::unique_ptr<DictExpression> dict{new DictExpression(std::move(expressions))};
176176
dict->MakeInline();
177-
return std::move(dict);
177+
return dict;
178178
}
179179

180180
void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector<std::unique_ptr<Expression> >& expressions)

lib/icinga/legacytimeperiod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St
541541
ProcessTimeRanges(timeranges, &iter, segments);
542542

543543
Dictionary::Ptr bestSegment;
544-
double bestBegin;
544+
double bestBegin = 0;
545545

546546
ObjectLock olock(segments);
547547
for (Dictionary::Ptr segment : segments) {

lib/icingadb/icingadb-objects.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,10 +1928,10 @@ unsigned short GetPreviousState(const Checkable::Ptr& checkable, const Service::
19281928
{
19291929
auto phs ((type == StateTypeHard ? checkable->GetLastHardStatesRaw() : checkable->GetLastSoftStatesRaw()) % 100u);
19301930

1931-
if (service) {
1931+
if (service || phs == 99) {
19321932
return phs;
19331933
} else {
1934-
return phs == 99 ? phs : Host::CalculateState(ServiceState(phs));
1934+
return Host::CalculateState(ServiceState(phs));
19351935
}
19361936
}
19371937

lib/icingadb/redisconnection.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ RedisConnection::RedisConnection(const String& host, int port, const String& pat
4141
RedisConnection::RedisConnection(boost::asio::io_context& io, String host, int port, String path, String username, String password,
4242
int db, bool useTls, bool insecure, String certPath, String keyPath, String caPath, String crlPath,
4343
String tlsProtocolmin, String cipherList, double connectTimeout, DebugInfo di, const RedisConnection::Ptr& parent)
44-
: m_Host(std::move(host)), m_Port(port), m_Path(std::move(path)), m_Username(std::move(username)), m_Password(std::move(password)),
44+
: m_Path(std::move(path)), m_Host(std::move(host)), m_Port(port), m_Username(std::move(username)), m_Password(std::move(password)),
4545
m_DbIndex(db), m_CertPath(std::move(certPath)), m_KeyPath(std::move(keyPath)), m_Insecure(insecure),
4646
m_CaPath(std::move(caPath)), m_CrlPath(std::move(crlPath)), m_TlsProtocolmin(std::move(tlsProtocolmin)),
47-
m_CipherList(std::move(cipherList)), m_ConnectTimeout(connectTimeout), m_DebugInfo(std::move(di)), m_Connecting(false), m_Connected(false),
48-
m_Started(false), m_Strand(io), m_QueuedWrites(io), m_QueuedReads(io), m_LogStatsTimer(io), m_Parent(parent)
47+
m_CipherList(std::move(cipherList)), m_ConnectTimeout(connectTimeout), m_DebugInfo(std::move(di)), m_Strand(io),
48+
m_Connecting(false), m_Connected(false), m_Started(false), m_QueuedWrites(io), m_QueuedReads(io), m_LogStatsTimer(io), m_Parent(parent)
4949
{
5050
if (useTls && m_Path.IsEmpty()) {
5151
UpdateTLSContext();
@@ -224,7 +224,7 @@ void RedisConnection::EnqueueCallback(const std::function<void(boost::asio::yiel
224224
auto ctime (Utility::GetTime());
225225

226226
asio::post(m_Strand, [this, callback, priority, ctime]() {
227-
m_Queues.Writes[priority].emplace(WriteQueueItem{nullptr, nullptr, nullptr, nullptr, callback, ctime});
227+
m_Queues.Writes[priority].emplace(WriteQueueItem{nullptr, nullptr, nullptr, nullptr, callback, ctime, QueryAffects{}});
228228
m_QueuedWrites.Set();
229229
});
230230
}

tools/mkclass/class_lexer.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ do { \
2626
} while (0)
2727

2828
struct lex_buf {
29-
char *buf;
30-
size_t size;
29+
char *buf = NULL;
30+
size_t size = 0;
3131
};
3232

3333
static void lb_init(lex_buf *lb)

0 commit comments

Comments
 (0)