Fix build problems with Oracle Solaris Studio

refs #6896
This commit is contained in:
Gunnar Beutner 2014-09-02 13:02:22 +02:00
parent c55bd29eda
commit 6f2ea6bc08
58 changed files with 132 additions and 125 deletions

View File

@ -116,6 +116,7 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PAT
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFileCXX)
check_symbol_exists(__COUNTER__ "" HAVE_COUNTER_MACRO)
@ -129,6 +130,7 @@ check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
check_function_exists(pipe2 HAVE_PIPE2)
check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR)
check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO)
check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)
if(HAVE_LIBEXECINFO)
set(HAVE_BACKTRACE_SYMBOLS TRUE)

View File

@ -40,7 +40,7 @@ Value CheckerComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perf
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjects<CheckerComponent>()) {
BOOST_FOREACH(const CheckerComponent::Ptr& checker, DynamicType::GetObjectsByType<CheckerComponent>()) {
unsigned long idle = checker->GetIdleCheckables();
unsigned long pending = checker->GetPendingCheckables();

View File

@ -42,7 +42,7 @@ Value CheckResultReader::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjects<CheckResultReader>()) {
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, DynamicType::GetObjectsByType<CheckResultReader>()) {
nodes->Set(checkresultreader->GetName(), 1); //add more stats
}

View File

@ -49,7 +49,7 @@ Value CompatLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjects<CompatLogger>()) {
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, DynamicType::GetObjectsByType<CompatLogger>()) {
nodes->Set(compat_logger->GetName(), 1); //add more stats
}
@ -450,7 +450,7 @@ void CompatLogger::ReopenFile(bool rotate)
WriteLine("LOG ROTATION: " + GetRotationMethod());
WriteLine("LOG VERSION: 2.0");
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
String output;
CheckResult::Ptr cr = host->GetLastCheckResult();
@ -468,7 +468,7 @@ void CompatLogger::ReopenFile(bool rotate)
WriteLine(msgbuf.str());
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
Host::Ptr host = service->GetHost();
String output;

View File

@ -35,7 +35,7 @@ Value ExternalCommandListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Pt
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjects<ExternalCommandListener>()) {
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, DynamicType::GetObjectsByType<ExternalCommandListener>()) {
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
}

View File

@ -52,7 +52,7 @@ Value StatusDataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjects<StatusDataWriter>()) {
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, DynamicType::GetObjectsByType<StatusDataWriter>()) {
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
}
@ -543,7 +543,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
"# This file is auto-generated. Do not modify this file." "\n"
"\n";
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
DumpHostObject(tempobjectfp, host);
@ -557,7 +557,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
}
}
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects<HostGroup>()) {
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -588,7 +588,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects<ServiceGroup>()) {
BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -629,7 +629,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects<User>()) {
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -657,7 +657,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjects<UserGroup>()) {
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -673,23 +673,23 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects<CheckCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<CheckCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects<NotificationCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<NotificationCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjects<EventCommand>()) {
BOOST_FOREACH(const Command::Ptr& command, DynamicType::GetObjectsByType<EventCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
DumpTimePeriod(objectfp, tp);
}
BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjects<Dependency>()) {
BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjectsByType<Dependency>()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
@ -813,7 +813,7 @@ void StatusDataWriter::StatusTimerHandler(void)
statusfp << "\t" "}" "\n"
"\n";
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
std::ostringstream tempstatusfp;
tempstatusfp << std::fixed;
DumpHostStatus(tempstatusfp, host);

View File

@ -42,7 +42,7 @@ Value IdoMysqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjects<IdoMysqlConnection>()) {
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, DynamicType::GetObjectsByType<IdoMysqlConnection>()) {
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
Dictionary::Ptr stats = make_shared<Dictionary>();

View File

@ -44,7 +44,7 @@ Value IdoPgsqlConnection::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjects<IdoPgsqlConnection>()) {
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, DynamicType::GetObjectsByType<IdoPgsqlConnection>()) {
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
Dictionary::Ptr stats = make_shared<Dictionary>();

View File

@ -60,13 +60,13 @@ String CommandsTable::GetPrefix(void) const
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<CheckCommand>()) {
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<CheckCommand>()) {
addRowFn(object);
}
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<EventCommand>()) {
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<EventCommand>()) {
addRowFn(object);
}
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects<NotificationCommand>()) {
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjectsByType<NotificationCommand>()) {
addRowFn(object);
}
}

View File

@ -62,7 +62,7 @@ String CommentsTable::GetPrefix(void) const
void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
Dictionary::Ptr comments = host->GetComments();
ObjectLock olock(comments);
@ -74,7 +74,7 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
}
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
Dictionary::Ptr comments = service->GetComments();
ObjectLock olock(comments);

View File

@ -49,7 +49,7 @@ String ContactGroupsTable::GetPrefix(void) const
void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjects<UserGroup>()) {
BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
addRowFn(ug);
}
}

View File

@ -67,7 +67,7 @@ String ContactsTable::GetPrefix(void) const
void ContactsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects<User>()) {
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
addRowFn(user);
}
}

View File

@ -62,7 +62,7 @@ String DowntimesTable::GetPrefix(void) const
void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
Dictionary::Ptr downtimes = service->GetDowntimes();
ObjectLock olock(downtimes);

View File

@ -60,7 +60,7 @@ String EndpointsTable::GetPrefix(void) const
void EndpointsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
addRowFn(endpoint);
}
}

View File

@ -73,7 +73,7 @@ String HostGroupsTable::GetPrefix(void) const
void HostGroupsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjects<HostGroup>()) {
BOOST_FOREACH(const HostGroup::Ptr& hg, DynamicType::GetObjectsByType<HostGroup>()) {
addRowFn(hg);
}
}

View File

@ -174,7 +174,7 @@ String HostsTable::GetPrefix(void) const
void HostsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
addRowFn(host);
}
}

View File

@ -47,7 +47,7 @@ Value LivestatusListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjects<LivestatusListener>()) {
BOOST_FOREACH(const LivestatusListener::Ptr& livestatuslistener, DynamicType::GetObjectsByType<LivestatusListener>()) {
Dictionary::Ptr stats = make_shared<Dictionary>();
stats->Set("connections", l_Connections);

View File

@ -64,7 +64,7 @@ String ServiceGroupsTable::GetPrefix(void) const
void ServiceGroupsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjects<ServiceGroup>()) {
BOOST_FOREACH(const ServiceGroup::Ptr& sg, DynamicType::GetObjectsByType<ServiceGroup>()) {
addRowFn(sg);
}
}

View File

@ -145,7 +145,7 @@ String ServicesTable::GetPrefix(void) const
void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
addRowFn(service);
}
}

View File

@ -207,12 +207,12 @@ Value StatusTable::ProgramStartAccessor(const Value&)
Value StatusTable::NumHostsAccessor(const Value&)
{
return std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second);
return std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second);
}
Value StatusTable::NumServicesAccessor(const Value&)
{
return std::distance(DynamicType::GetObjects<Service>().first, DynamicType::GetObjects<Service>().second);
return std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second);
}
Value StatusTable::ProgramVersionAccessor(const Value&)

View File

@ -54,7 +54,7 @@ String TimePeriodsTable::GetPrefix(void) const
void TimePeriodsTable::FetchRows(const AddRowFunction& addRowFn)
{
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
addRowFn(tp);
}
}

View File

@ -38,7 +38,7 @@ Value NotificationComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjects<NotificationComponent>()) {
BOOST_FOREACH(const NotificationComponent::Ptr& notification_component, DynamicType::GetObjectsByType<NotificationComponent>()) {
nodes->Set(notification_component->GetName(), 1); //add more stats
}
@ -72,7 +72,7 @@ void NotificationComponent::NotificationTimerHandler(void)
{
double now = Utility::GetTime();
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjectsByType<Notification>()) {
Checkable::Ptr checkable = notification->GetCheckable();
if (checkable->IsPaused() && GetEnableHA())

View File

@ -50,7 +50,7 @@ Value GraphiteWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjects<GraphiteWriter>()) {
BOOST_FOREACH(const GraphiteWriter::Ptr& graphitewriter, DynamicType::GetObjectsByType<GraphiteWriter>()) {
nodes->Set(graphitewriter->GetName(), 1); //add more stats
}

View File

@ -40,7 +40,7 @@ Value PerfdataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjects<PerfdataWriter>()) {
BOOST_FOREACH(const PerfdataWriter::Ptr& perfdatawriter, DynamicType::GetObjectsByType<PerfdataWriter>()) {
nodes->Set(perfdatawriter->GetName(), 1); //add more stats
}

View File

@ -7,6 +7,7 @@
#cmakedefine HAVE_VFORK
#cmakedefine HAVE_DLADDR
#cmakedefine HAVE_LIBEXECINFO
#cmakedefine HAVE_CXXABI_H
#cmakedefine ICINGA2_UNITY_BUILD

View File

@ -52,7 +52,7 @@ NORETURNPRE int icinga_assert_fail(const char *expr, const char *file, int line)
inline int icinga_assert_fail(const char *expr, const char *file, int line)
{
fprintf(stderr, "%s:%d: assertion failed: %s\n", file, line, expr);
abort();
std::abort();
#if !defined(__GNUC__) && !defined(_MSC_VER)
return 0;

View File

@ -53,7 +53,7 @@ public:
std::pair<DynamicTypeIterator<DynamicObject>, DynamicTypeIterator<DynamicObject> > GetObjects(void);
template<typename T>
static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjects(void)
static std::pair<DynamicTypeIterator<T>, DynamicTypeIterator<T> > GetObjectsByType(void)
{
DynamicType::Ptr type = GetByName(T::GetTypeName());
return std::make_pair(

View File

@ -20,24 +20,23 @@
#include "base/exception.hpp"
#include <boost/thread/tss.hpp>
#ifndef _MSC_VER
#ifdef HAVE_CXXABI_H
# include <cxxabi.h>
#endif /* _MSC_VER */
#endif /* HAVE_CXXABI_H */
using namespace icinga;
static boost::thread_specific_ptr<StackTrace> l_LastExceptionStack;
static boost::thread_specific_ptr<ContextTrace> l_LastExceptionContext;
#ifndef _MSC_VER
#ifdef HAVE_CXXABI_H
# if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 3)
# define TYPEINFO_TYPE std::type_info
# else
# define TYPEINFO_TYPE void
# endif
#endif /* _MSC_VER */
#if !defined(__GLIBCXX__) && !defined(_WIN32)
# if !defined(__GLIBCXX__) && !defined(_WIN32)
static boost::thread_specific_ptr<void *> l_LastExceptionObj;
static boost::thread_specific_ptr<TYPEINFO_TYPE *> l_LastExceptionPvtInfo;
@ -46,18 +45,19 @@ static boost::thread_specific_ptr<DestCallback> l_LastExceptionDest;
extern "C" void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *));
extern "C" void __cxa_rethrow_primary_exception(void* thrown_object);
#endif /* !__GLIBCXX__ && !_WIN32 */
# endif /* !__GLIBCXX__ && !_WIN32 */
#endif /* HAVE_CXXABI_H */
void icinga::RethrowUncaughtException(void)
{
#if defined(__GLIBCXX__) || defined(_WIN32)
#if defined(__GLIBCXX__) || !defined(HAVE_CXXABI_H)
throw;
#else /* __GLIBCXX__ || _WIN32 */
__cxa_throw(*l_LastExceptionObj.get(), *l_LastExceptionPvtInfo.get(), *l_LastExceptionDest.get());
#endif /* __GLIBCXX__ || _WIN32 */
}
#ifndef _MSC_VER
#ifdef HAVE_CXXABI_H
extern "C"
void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *))
{
@ -108,7 +108,7 @@ void __cxa_throw(void *obj, TYPEINFO_TYPE *pvtinfo, void (*dest)(void *))
real_cxa_throw(obj, tinfo, dest);
}
#endif /* _MSC_VER */
#endif /* HAVE_CXXABI_H */
StackTrace *icinga::GetLastExceptionStack(void)
{

View File

@ -68,7 +68,7 @@ void FIFO::ResizeBuffer(size_t newSize, bool decrease)
void FIFO::Optimize(void)
{
if (m_DataSize < m_Offset) {
memcpy(m_Buffer, m_Buffer + m_Offset, m_DataSize);
std::memcpy(m_Buffer, m_Buffer + m_Offset, m_DataSize);
m_Offset = 0;
if (m_DataSize > 0)
@ -87,7 +87,7 @@ size_t FIFO::Read(void *buffer, size_t count)
count = m_DataSize;
if (buffer != NULL)
memcpy(buffer, m_Buffer + m_Offset, count);
std::memcpy(buffer, m_Buffer + m_Offset, count);
m_DataSize -= count;
m_Offset += count;
@ -103,7 +103,7 @@ size_t FIFO::Read(void *buffer, size_t count)
void FIFO::Write(const void *buffer, size_t count)
{
ResizeBuffer(m_Offset + m_DataSize + count, false);
memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count);
std::memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count);
m_DataSize += count;
}

View File

@ -33,7 +33,7 @@ Value FileLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjects<FileLogger>()) {
BOOST_FOREACH(const FileLogger::Ptr& filelogger, DynamicType::GetObjectsByType<FileLogger>()) {
nodes->Set(filelogger->GetName(), 1); //add more stats
}

View File

@ -271,7 +271,7 @@ boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(
template<typename TR>
boost::function<TR (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(const std::vector<Value>&))
{
return boost::bind(function, _1);
return boost::bind<TR>(function, _1);
}
inline boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(const std::vector<Value>&))

View File

@ -139,7 +139,7 @@ void StackTrace::Print(std::ostream& fp, int ignoreFrames) const
fp << "\t(" << i - ignoreFrames - 1 << ") " << message << std::endl;
}
free(messages);
std::free(messages);
fp << std::endl;
# else /* HAVE_BACKTRACE_SYMBOLS */

View File

@ -32,7 +32,7 @@ Value SyslogLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjects<SyslogLogger>()) {
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, DynamicType::GetObjectsByType<SyslogLogger>()) {
nodes->Set(sysloglogger->GetName(), 1); //add more stats
}

View File

@ -268,7 +268,7 @@ void ThreadPool::ManagerThreadProc(void)
avg_latency = 0;
if (utilization < 60 || utilization > 80 || alive < 8) {
double wthreads = ceil((utilization * alive) / 80.0);
double wthreads = std::ceil((utilization * alive) / 80.0);
int tthreads = wthreads - alive;

View File

@ -35,9 +35,9 @@
# include <pthread_np.h>
#endif /* __FreeBSD__ */
#ifndef _MSC_VER
#ifdef HAVE_CXXABI_H
# include <cxxabi.h>
#endif /* _MSC_VER */
#endif /* HAVE_CXXABI_H */
using namespace icinga;
@ -56,7 +56,7 @@ String Utility::DemangleSymbolName(const String& sym)
{
String result = sym;
#ifndef _MSC_VER
#ifdef HAVE_CXXABI_H
int status;
char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status);
@ -64,11 +64,13 @@ String Utility::DemangleSymbolName(const String& sym)
result = String(realname);
free(realname);
}
#else /* _MSC_VER */
#elif defined(_MSC_VER) /* HAVE_CXXABI_H */
CHAR output[256];
if (UnDecorateSymbolName(sym.CStr(), output, sizeof(output), UNDNAME_COMPLETE) > 0)
result = output;
#else /* _MSC_VER */
/* We're pretty much out of options here. */
#endif /* _MSC_VER */
return result;
@ -705,7 +707,7 @@ String Utility::NaturalJoin(const std::vector<String>& tokens)
return result;
}
String Utility::FormatDuration(int duration)
String Utility::FormatDuration(double duration)
{
std::vector<String> tokens;
String result;
@ -713,19 +715,19 @@ String Utility::FormatDuration(int duration)
if (duration >= 86400) {
int days = duration / 86400;
tokens.push_back(Convert::ToString(days) + (days != 1 ? " days" : " day"));
duration %= 86400;
duration = static_cast<int>(duration) % 86400;
}
if (duration >= 3600) {
int hours = duration / 3600;
tokens.push_back(Convert::ToString(hours) + (hours != 1 ? " hours" : " hour"));
duration %= 3600;
duration = static_cast<int>(duration) % 3600;
}
if (duration >= 60) {
int minutes = duration / 60;
tokens.push_back(Convert::ToString(minutes) + (minutes != 1 ? " minutes" : " minute"));
duration %= 60;
duration = static_cast<int>(duration) % 60;
}
if (duration >= 1) {
@ -734,7 +736,7 @@ String Utility::FormatDuration(int duration)
}
if (tokens.size() == 0) {
int milliseconds = floor(duration * 1000);
int milliseconds = std::floor(duration * 1000);
if (milliseconds >= 1)
tokens.push_back(Convert::ToString(milliseconds) + (milliseconds != 1 ? " milliseconds" : " millisecond"));
else

View File

@ -95,7 +95,7 @@ public:
static String NaturalJoin(const std::vector<String>& tokens);
static String FormatDuration(int duration);
static String FormatDuration(double duration);
static String FormatDateTime(const char *format, double ts);
static String FormatErrorNumber(int code);

View File

@ -49,7 +49,7 @@ Value::operator String(void) const
case ValueEmpty:
return String();
case ValueNumber:
fractional = modf(boost::get<double>(m_Value), &integral);
fractional = std::modf(boost::get<double>(m_Value), &integral);
if (fractional != 0)
return boost::lexical_cast<std::string>(m_Value);

View File

@ -143,10 +143,10 @@ void DbConnection::ProgramStatusHandler(void)
query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
DbObject::OnQuery(query3);
InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjects<Service>().first, DynamicType::GetObjects<Service>().second));
InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjects<Service>().first, DynamicType::GetObjects<Service>().second));
InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second));
InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjects<Host>().first, DynamicType::GetObjects<Host>().second));
InsertRuntimeVariable("total_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_scheduled_services", std::distance(DynamicType::GetObjectsByType<Service>().first, DynamicType::GetObjectsByType<Service>().second));
InsertRuntimeVariable("total_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
InsertRuntimeVariable("total_scheduled_hosts", std::distance(DynamicType::GetObjectsByType<Host>().first, DynamicType::GetObjectsByType<Host>().second));
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();

View File

@ -1403,7 +1403,7 @@ void ApiEvents::RepositoryTimerHandler(void)
Dictionary::Ptr repository = make_shared<Dictionary>();
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
Array::Ptr services = make_shared<Array>();
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {

View File

@ -234,11 +234,11 @@ void Checkable::RemoveExpiredComments(void)
void Checkable::CommentsExpireTimerHandler(void)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
host->RemoveExpiredComments();
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
service->RemoveExpiredComments();
}
}

View File

@ -295,11 +295,11 @@ void Checkable::RemoveExpiredDowntimes(void)
void Checkable::DowntimesExpireTimerHandler(void)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
host->RemoveExpiredDowntimes();
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
service->RemoveExpiredDowntimes();
}
}

View File

@ -80,7 +80,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void)
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
int count_execution_time = 0;
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
CheckResult::Ptr cr = host->GetLastCheckResult();
@ -129,7 +129,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void)
double min_execution_time = -1, max_execution_time = 0, sum_execution_time = 0;
int count_execution_time = 0;
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
ObjectLock olock(service);
CheckResult::Ptr cr = service->GetLastCheckResult();
@ -175,7 +175,7 @@ ServiceStatistics CIB::CalculateServiceStats(void)
{
ServiceStatistics ss = {0};
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
ObjectLock olock(service);
CheckResult::Ptr cr = service->GetLastCheckResult();
@ -209,7 +209,7 @@ HostStatistics CIB::CalculateHostStats(void)
{
HostStatistics hs = {0};
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
if (host->IsReachable()) {

View File

@ -112,7 +112,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule)
if (rule.GetTargetType() == "Host") {
apply_count = 0;
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
if (EvaluateApplyRuleOne(host, rule))
@ -125,7 +125,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule)
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
if (EvaluateApplyRuleOne(service, rule))

View File

@ -74,7 +74,7 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& r
void HostGroup::EvaluateObjectRule(const ObjectRule& rule)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for host '" + host->GetName() + "'");
EvaluateObjectRuleOne(host, rule);

View File

@ -67,7 +67,7 @@ Value IcingaApplication::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& per
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjects<IcingaApplication>()) {
BOOST_FOREACH(const IcingaApplication::Ptr& icingaapplication, DynamicType::GetObjectsByType<IcingaApplication>()) {
Dictionary::Ptr stats = make_shared<Dictionary>();
stats->Set("node_name", icingaapplication->GetNodeName());
stats->Set("enable_notifications", icingaapplication->GetEnableNotifications());

View File

@ -38,7 +38,7 @@ Value IcingaStatusWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& pe
{
Dictionary::Ptr nodes = make_shared<Dictionary>();
BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjects<IcingaStatusWriter>()) {
BOOST_FOREACH(const IcingaStatusWriter::Ptr& icingastatuswriter, DynamicType::GetObjectsByType<IcingaStatusWriter>()) {
nodes->Set(icingastatuswriter->GetName(), 1); //add more stats
}

View File

@ -107,7 +107,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule)
if (rule.GetTargetType() == "Host") {
apply_count = 0;
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
if (EvaluateApplyRuleOne(host, rule))
@ -120,7 +120,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule)
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
if (EvaluateApplyRuleOne(service, rule))

View File

@ -107,7 +107,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
if (rule.GetTargetType() == "Host") {
apply_count = 0;
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
if (EvaluateApplyRule(host, rule))
@ -120,7 +120,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
if(EvaluateApplyRule(service, rule))

View File

@ -71,7 +71,7 @@ void ScheduledDowntime::Start(void)
void ScheduledDowntime::TimerProc(void)
{
BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjects<ScheduledDowntime>()) {
BOOST_FOREACH(const ScheduledDowntime::Ptr& sd, DynamicType::GetObjectsByType<ScheduledDowntime>()) {
sd->CreateNextDowntime();
}
}

View File

@ -94,7 +94,7 @@ void Service::EvaluateApplyRule(const ApplyRule& rule)
{
int apply_count = 0;
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjectsByType<Host>()) {
CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
if (EvaluateApplyRuleOne(host, rule))

View File

@ -77,7 +77,7 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr& service, const Obje
void ServiceGroup::EvaluateObjectRule(const ObjectRule& rule)
{
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjectsByType<Service>()) {
CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for service '" + service->GetName() + "'");
EvaluateObjectRuleOne(service, rule);

View File

@ -256,7 +256,7 @@ void TimePeriod::UpdateTimerHandler(void)
{
double now = Utility::GetTime();
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjects<TimePeriod>()) {
BOOST_FOREACH(const TimePeriod::Ptr& tp, DynamicType::GetObjectsByType<TimePeriod>()) {
double valid_end;
{

View File

@ -74,7 +74,7 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& r
void UserGroup::EvaluateObjectRule(const ObjectRule& rule)
{
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjects<User>()) {
BOOST_FOREACH(const User::Ptr& user, DynamicType::GetObjectsByType<User>()) {
CONTEXT("Evaluating group membership in '" + rule.GetName() + "' for user '" + user->GetName() + "'");
EvaluateObjectRuleOne(user, rule);

View File

@ -129,7 +129,7 @@ void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const
void ApiListener::SyncZoneDirs(void) const
{
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects<Zone>()) {
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
if (!IsConfigMaster(zone))
continue;
@ -157,7 +157,7 @@ void ApiListener::SendConfigUpdate(const ApiClient::Ptr& aclient)
String zonesDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones";
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects<Zone>()) {
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
String zoneDir = zonesDir + "/" + zone->GetName();
if (!zone->IsChildOf(azone) && !zone->IsGlobal()) {

View File

@ -88,7 +88,7 @@ void ApiListener::OnConfigLoaded(void)
*/
void ApiListener::Start(void)
{
if (std::distance(DynamicType::GetObjects<ApiListener>().first, DynamicType::GetObjects<ApiListener>().second) > 1) {
if (std::distance(DynamicType::GetObjectsByType<ApiListener>().first, DynamicType::GetObjectsByType<ApiListener>().second) > 1) {
Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed.");
return;
}
@ -118,7 +118,7 @@ void ApiListener::Start(void)
ApiListener::Ptr ApiListener::GetInstance(void)
{
BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjects<ApiListener>())
BOOST_FOREACH(const ApiListener::Ptr& listener, DynamicType::GetObjectsByType<ApiListener>())
return listener;
return ApiListener::Ptr();
@ -332,7 +332,7 @@ void ApiListener::ApiTimerHandler(void)
BOOST_FOREACH(int ts, files) {
bool need = false;
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
if (endpoint->GetName() == GetIdentity())
continue;
@ -355,7 +355,7 @@ void ApiListener::ApiTimerHandler(void)
if (IsMaster()) {
Zone::Ptr my_zone = Zone::GetLocalZone();
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects<Zone>()) {
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
/* only connect to endpoints in a) the same zone b) our parent zone c) immediate child zones */
if (my_zone != zone && my_zone != zone->GetParent() && zone != my_zone->GetParent())
continue;
@ -391,7 +391,7 @@ void ApiListener::ApiTimerHandler(void)
}
}
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
if (!endpoint->IsConnected())
continue;
@ -421,7 +421,7 @@ void ApiListener::ApiTimerHandler(void)
Log(LogNotice, "ApiListener", "Current zone master: " + master->GetName());
std::vector<String> names;
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>())
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>())
if (endpoint->IsConnected())
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
@ -483,7 +483,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin& origin, const DynamicObj
std::vector<Endpoint::Ptr> skippedEndpoints;
std::set<Zone::Ptr> finishedZones;
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
/* don't relay messages to ourselves or disconnected endpoints */
if (endpoint->GetName() == GetIdentity() || !endpoint->IsConnected())
continue;
@ -744,7 +744,7 @@ std::pair<Dictionary::Ptr, Dictionary::Ptr> ApiListener::GetStatus(void)
Array::Ptr not_connected_endpoints = make_shared<Array>();
Array::Ptr connected_endpoints = make_shared<Array>();
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjectsByType<Endpoint>()) {
if (endpoint->GetName() == GetIdentity())
continue;

View File

@ -38,7 +38,7 @@ void Endpoint::OnConfigLoaded(void)
{
DynamicObject::OnConfigLoaded();
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjects<Zone>()) {
BOOST_FOREACH(const Zone::Ptr& zone, DynamicType::GetObjectsByType<Zone>()) {
const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
if (members.empty())

View File

@ -17,16 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifdef __linux__
#include <alloca.h>
#endif /* __linux */
#include <unistd.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <paths.h>
#include "execvpe.h"
#if !defined(_MSC_VER) && !defined(HAVE_EXECVPE)
@ -37,7 +34,7 @@ static void
scripts_argv (const char *file, char *const argv[], int argc, char **new_argv)
{
/* Construct an argument list for the shell. */
new_argv[0] = (char *) _PATH_BSHELL;
new_argv[0] = (char *) "/bin/sh";
new_argv[1] = (char *) file;
while (argc > 1)
{

View File

@ -21,6 +21,11 @@
#include "classcompiler.hpp"
#include <iostream>
#include <vector>
#include <cstring>
using std::malloc;
using std::free;
using std::exit;
using namespace icinga;
@ -92,7 +97,7 @@ void yyerror(YYLTYPE *locp, ClassCompiler *, const char *err)
std::cerr << "in " << locp->path << " at " << locp->first_line << ":" << locp->first_column << "-" << locp->last_line << ":" << locp->last_column << ": "
<< err
<< std::endl;
exit(1);
std::exit(1);
}
int yyparse(ClassCompiler *context);
@ -119,12 +124,12 @@ statements: /* empty */
statement: include
{
context->HandleInclude($1, yylloc);
free($1);
std::free($1);
}
| angle_include
{
context->HandleAngleInclude($1, yylloc);
free($1);
std::free($1);
}
| class
{
@ -135,7 +140,7 @@ statement: include
| code
{
context->HandleCode($1, yylloc);
free($1);
std::free($1);
}
;
@ -154,7 +159,7 @@ angle_include: T_INCLUDE T_ANGLE_STRING
namespace: T_NAMESPACE identifier '{'
{
context->HandleNamespaceBegin($2, yylloc);
free($2);
std::free($2);
}
statements '}'
{
@ -173,16 +178,16 @@ class: class_attribute_list T_CLASS T_IDENTIFIER inherits_specifier type_base_sp
$$ = new Klass();
$$->Name = $3;
free($3);
std::free($3);
if ($4) {
$$->Parent = $4;
free($4);
std::free($4);
}
if ($5) {
$$->TypeBase = $5;
free($5);
std::free($5);
}
$$->Attributes = $1;
@ -243,14 +248,14 @@ class_field: field_attribute_list identifier identifier alternative_name_specifi
field->Attributes = $1;
field->Type = $2;
free($2);
std::free($2);
field->Name = $3;
free($3);
std::free($3);
if ($4) {
field->AlternativeName = $4;
free($4);
std::free($4);
}
std::vector<FieldAccessor>::const_iterator it;
@ -333,7 +338,7 @@ field_accessors: /* empty */
field_accessor: T_FIELD_ACCESSOR_TYPE T_STRING
{
$$ = new FieldAccessor(static_cast<FieldAccessorType>($1), $2);
free($2);
std::free($2);
}
;