mirror of https://github.com/Icinga/icinga2.git
Refactor ASSERT macro.
This commit is contained in:
parent
6f61ed761b
commit
f39f69d390
|
@ -31,7 +31,7 @@
|
|||
#include "livestatus/orfilter.h"
|
||||
#include "livestatus/andfilter.h"
|
||||
#include "icinga/externalcommandprocessor.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/logger_fwd.h"
|
||||
|
|
|
@ -15,6 +15,7 @@ libbase_la_SOURCES = \
|
|||
consolelogger.h \
|
||||
convert.cpp \
|
||||
convert.h \
|
||||
debug.h \
|
||||
dictionary.cpp \
|
||||
dictionary.h \
|
||||
dynamicobject.cpp \
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "base/exception.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <sstream>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "base/array.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <cJSON.h>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef NDEBUG
|
||||
# define ASSERT(expr) ((void)0)
|
||||
#else /* NDEBUG */
|
||||
# define ASSERT(expr) define ASSERT(expr) ((expr) ? 0 : icinga_assert_fail(#expr, __FILE__, __LINE__))
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#define VERIFY(expr) ((expr) ? 0 : icinga_assert_fail(#expr, __FILE__, __LINE__))
|
||||
|
||||
inline void icinga_assert_fail(const char *expr, const char *file, int line)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: assertion failed: %s\n", file, line, expr);
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif /* DEBUG_H */
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "base/dictionary.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <cJSON.h>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "base/netstring.h"
|
||||
#include "base/registry.h"
|
||||
#include "base/stdiostream.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/exception.h"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/dynamictype.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/objectlock.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "base/i2-base.h"
|
||||
#include "base/registry.h"
|
||||
#include "base/dynamicobject.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <boost/function.hpp>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/netstring.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <sstream>
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "base/dynamictype.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -74,4 +74,4 @@ void Script::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
|
|||
m_Language = bag->Get("language");
|
||||
m_Code = bag->Get("code");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "base/threadpool.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/utility.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "base/timer.h"
|
||||
#include "base/application.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "base/tlsstream.h"
|
||||
#include "base/stream_bio.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/exception.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
|
|
@ -89,11 +89,4 @@ private:
|
|||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
# include <cassert>
|
||||
# define ASSERT(expr) assert(expr)
|
||||
#else /* _DEBUG */
|
||||
# define ASSERT(expr) __builtin_unreachable()
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#endif /* UTILITY_H */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "base/dynamictype.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <sstream>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "config/expression.h"
|
||||
#include "config/expressionlist.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/array.h"
|
||||
#include <sstream>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "icinga/eventcommand.h"
|
||||
#include "base/dynamictype.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "base/timer.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/scriptfunction.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include "config/configitembuilder.h"
|
||||
#include "config/configcompilercontext.h"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "base/logger_fwd.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/timer.h"
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "base/exception.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "ido/dbtype.h"
|
||||
#include "ido/dbconnection.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/debug.h"
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
Loading…
Reference in New Issue