mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6999 from Icinga/bugfix/compiler-warnings
Suppress or fix compiler warnings
This commit is contained in:
commit
804c00ece5
|
@ -924,6 +924,8 @@ int main(int argc, char **argv)
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
std::cerr << "Closed FD " << i << " which we inherited from our parent process." << std::endl;
|
std::cerr << "Closed FD " << i << " which we inherited from our parent process." << std::endl;
|
||||||
|
#else /* I2_DEBUG */
|
||||||
|
(void)rc;
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_DEBUG */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void Application::SetResourceLimits()
|
||||||
rlim_t fileLimit = Configuration::RLimitFiles;
|
rlim_t fileLimit = Configuration::RLimitFiles;
|
||||||
|
|
||||||
if (fileLimit != 0) {
|
if (fileLimit != 0) {
|
||||||
if (fileLimit < GetDefaultRLimitFiles()) {
|
if (fileLimit < (rlim_t)GetDefaultRLimitFiles()) {
|
||||||
Log(LogWarning, "Application")
|
Log(LogWarning, "Application")
|
||||||
<< "The user-specified value for RLimitFiles cannot be smaller than the default value (" << GetDefaultRLimitFiles() << "). Using the default value instead.";
|
<< "The user-specified value for RLimitFiles cannot be smaller than the default value (" << GetDefaultRLimitFiles() << "). Using the default value instead.";
|
||||||
fileLimit = GetDefaultRLimitFiles();
|
fileLimit = GetDefaultRLimitFiles();
|
||||||
|
@ -183,7 +183,7 @@ void Application::SetResourceLimits()
|
||||||
rlim_t processLimit = Configuration::RLimitProcesses;
|
rlim_t processLimit = Configuration::RLimitProcesses;
|
||||||
|
|
||||||
if (processLimit != 0) {
|
if (processLimit != 0) {
|
||||||
if (processLimit < GetDefaultRLimitProcesses()) {
|
if (processLimit < (rlim_t)GetDefaultRLimitProcesses()) {
|
||||||
Log(LogWarning, "Application")
|
Log(LogWarning, "Application")
|
||||||
<< "The user-specified value for RLimitProcesses cannot be smaller than the default value (" << GetDefaultRLimitProcesses() << "). Using the default value instead.";
|
<< "The user-specified value for RLimitProcesses cannot be smaller than the default value (" << GetDefaultRLimitProcesses() << "). Using the default value instead.";
|
||||||
processLimit = GetDefaultRLimitProcesses();
|
processLimit = GetDefaultRLimitProcesses();
|
||||||
|
@ -222,7 +222,7 @@ void Application::SetResourceLimits()
|
||||||
stackLimit = Configuration::RLimitStack;
|
stackLimit = Configuration::RLimitStack;
|
||||||
|
|
||||||
if (stackLimit != 0) {
|
if (stackLimit != 0) {
|
||||||
if (stackLimit < GetDefaultRLimitStack()) {
|
if (stackLimit < (rlim_t)GetDefaultRLimitStack()) {
|
||||||
Log(LogWarning, "Application")
|
Log(LogWarning, "Application")
|
||||||
<< "The user-specified value for RLimitStack cannot be smaller than the default value (" << GetDefaultRLimitStack() << "). Using the default value instead.";
|
<< "The user-specified value for RLimitStack cannot be smaller than the default value (" << GetDefaultRLimitStack() << "). Using the default value instead.";
|
||||||
stackLimit = GetDefaultRLimitStack();
|
stackLimit = GetDefaultRLimitStack();
|
||||||
|
|
|
@ -68,7 +68,7 @@ StreamReadStatus NetString::ReadStringFromStream(const Stream::Ptr& stream, Stri
|
||||||
/* read the whole message */
|
/* read the whole message */
|
||||||
size_t data_length = len + 1;
|
size_t data_length = len + 1;
|
||||||
|
|
||||||
if (maxMessageLength >= 0 && data_length > maxMessageLength) {
|
if (maxMessageLength >= 0 && data_length > (size_t)maxMessageLength) {
|
||||||
std::stringstream errorMessage;
|
std::stringstream errorMessage;
|
||||||
errorMessage << "Max data length exceeded: " << (maxMessageLength / 1024) << " KB";
|
errorMessage << "Max data length exceeded: " << (maxMessageLength / 1024) << " KB";
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,11 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
|
||||||
(void)close(fds[2]);
|
(void)close(fds[2]);
|
||||||
|
|
||||||
#ifdef HAVE_NICE
|
#ifdef HAVE_NICE
|
||||||
if (adjustPriority)
|
if (adjustPriority) {
|
||||||
(void)nice(5);
|
// Cheating the compiler on "warning: ignoring return value of 'int nice(int)', declared with attribute warn_unused_result [-Wunused-result]".
|
||||||
|
auto x (nice(5));
|
||||||
|
(void)x;
|
||||||
|
}
|
||||||
#endif /* HAVE_NICE */
|
#endif /* HAVE_NICE */
|
||||||
|
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
|
|
@ -73,6 +73,10 @@ ScriptFrame::~ScriptFrame()
|
||||||
{
|
{
|
||||||
ScriptFrame *frame = PopFrame();
|
ScriptFrame *frame = PopFrame();
|
||||||
ASSERT(frame == this);
|
ASSERT(frame == this);
|
||||||
|
|
||||||
|
#ifndef I2_DEBUG
|
||||||
|
(void)frame;
|
||||||
|
#endif /* I2_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFrame::IncreaseStackDepth()
|
void ScriptFrame::IncreaseStackDepth()
|
||||||
|
|
|
@ -459,15 +459,15 @@ incomplete:
|
||||||
|
|
||||||
std::vector<String> ulines = text.Split("\n");
|
std::vector<String> ulines = text.Split("\n");
|
||||||
|
|
||||||
for (int i = 1; i <= ulines.size(); i++) {
|
for (decltype(ulines.size()) i = 1; i <= ulines.size(); i++) {
|
||||||
int start, len;
|
int start, len;
|
||||||
|
|
||||||
if (i == di.FirstLine)
|
if (i == (decltype(i))di.FirstLine)
|
||||||
start = di.FirstColumn;
|
start = di.FirstColumn;
|
||||||
else
|
else
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
||||||
if (i == di.LastLine)
|
if (i == (decltype(i))di.LastLine)
|
||||||
len = di.LastColumn - di.FirstColumn + 1;
|
len = di.LastColumn - di.FirstColumn + 1;
|
||||||
else
|
else
|
||||||
len = ulines[i - 1].GetLength();
|
len = ulines[i - 1].GetLength();
|
||||||
|
@ -480,7 +480,7 @@ incomplete:
|
||||||
} else
|
} else
|
||||||
offset = 4;
|
offset = 4;
|
||||||
|
|
||||||
if (i >= di.FirstLine && i <= di.LastLine) {
|
if (i >= (decltype(i))di.FirstLine && i <= (decltype(i))di.LastLine) {
|
||||||
std::cout << String(di.Path.GetLength() + offset, ' ');
|
std::cout << String(di.Path.GetLength() + offset, ' ');
|
||||||
std::cout << String(start, ' ') << String(len, '^') << "\n";
|
std::cout << String(start, ' ') << String(len, '^') << "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
|
||||||
if (vm.count("global_zones"))
|
if (vm.count("global_zones"))
|
||||||
setupGlobalZones = vm["global_zones"].as<std::vector<std::string> >();
|
setupGlobalZones = vm["global_zones"].as<std::vector<std::string> >();
|
||||||
|
|
||||||
for (int i = 0; i < setupGlobalZones.size(); i++) {
|
for (decltype(setupGlobalZones.size()) i = 0; i < setupGlobalZones.size(); i++) {
|
||||||
if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) {
|
if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) {
|
||||||
Log(LogCritical, "cli")
|
Log(LogCritical, "cli")
|
||||||
<< "The global zone '" << setupGlobalZones[i] << "' is already specified.";
|
<< "The global zone '" << setupGlobalZones[i] << "' is already specified.";
|
||||||
|
@ -505,7 +505,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
|
||||||
if (vm.count("global_zones"))
|
if (vm.count("global_zones"))
|
||||||
setupGlobalZones = vm["global_zones"].as<std::vector<std::string> >();
|
setupGlobalZones = vm["global_zones"].as<std::vector<std::string> >();
|
||||||
|
|
||||||
for (int i = 0; i < setupGlobalZones.size(); i++) {
|
for (decltype(setupGlobalZones.size()) i = 0; i < setupGlobalZones.size(); i++) {
|
||||||
if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) {
|
if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) {
|
||||||
Log(LogCritical, "cli")
|
Log(LogCritical, "cli")
|
||||||
<< "The global zone '" << setupGlobalZones[i] << "' is already specified.";
|
<< "The global zone '" << setupGlobalZones[i] << "' is already specified.";
|
||||||
|
|
|
@ -391,7 +391,7 @@ Dictionary::Ptr LegacyTimePeriod::FindRunningSegment(const String& daydef, const
|
||||||
ProcessTimeRanges(timeranges, &iter, segments);
|
ProcessTimeRanges(timeranges, &iter, segments);
|
||||||
|
|
||||||
Dictionary::Ptr bestSegment;
|
Dictionary::Ptr bestSegment;
|
||||||
double bestEnd;
|
double bestEnd = 0.0;
|
||||||
|
|
||||||
ObjectLock olock(segments);
|
ObjectLock olock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (const Dictionary::Ptr& segment : segments) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ std::pair<double, double> ScheduledDowntime::FindRunningSegment(double minEnd)
|
||||||
Array::Ptr segments = new Array();
|
Array::Ptr segments = new Array();
|
||||||
|
|
||||||
Dictionary::Ptr bestSegment;
|
Dictionary::Ptr bestSegment;
|
||||||
double bestBegin, bestEnd;
|
double bestBegin = 0.0, bestEnd = 0.0;
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
ObjectLock olock(ranges);
|
ObjectLock olock(ranges);
|
||||||
|
@ -179,7 +179,7 @@ std::pair<double, double> ScheduledDowntime::FindNextSegment()
|
||||||
Array::Ptr segments = new Array();
|
Array::Ptr segments = new Array();
|
||||||
|
|
||||||
Dictionary::Ptr bestSegment;
|
Dictionary::Ptr bestSegment;
|
||||||
double bestBegin, bestEnd;
|
double bestBegin = 0.0, bestEnd = 0.0;
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
ObjectLock olock(ranges);
|
ObjectLock olock(ranges);
|
||||||
|
|
|
@ -1408,7 +1408,7 @@ bool ApiListener::AddAnonymousClient(const JsonRpcConnection::Ptr& aclient)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_AnonymousClientsLock);
|
boost::mutex::scoped_lock lock(m_AnonymousClientsLock);
|
||||||
|
|
||||||
if (GetMaxAnonymousClients() >= 0 && m_AnonymousClients.size() + 1 > GetMaxAnonymousClients())
|
if (GetMaxAnonymousClients() >= 0 && (long)m_AnonymousClients.size() + 1 > (long)GetMaxAnonymousClients())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_AnonymousClients.insert(aclient);
|
m_AnonymousClients.insert(aclient);
|
||||||
|
|
|
@ -48,6 +48,10 @@ void EventQueue::AddClient(void *client)
|
||||||
|
|
||||||
auto result = m_Events.insert(std::make_pair(client, std::deque<Dictionary::Ptr>()));
|
auto result = m_Events.insert(std::make_pair(client, std::deque<Dictionary::Ptr>()));
|
||||||
ASSERT(result.second);
|
ASSERT(result.second);
|
||||||
|
|
||||||
|
#ifndef I2_DEBUG
|
||||||
|
(void)result;
|
||||||
|
#endif /* I2_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventQueue::RemoveClient(void *client)
|
void EventQueue::RemoveClient(void *client)
|
||||||
|
|
Loading…
Reference in New Issue