Build fix for --enable-debug.

This commit is contained in:
Gunnar Beutner 2013-08-28 16:49:58 +02:00
parent 1e637dbbd4
commit e0c452bb00
2 changed files with 10 additions and 4 deletions

View File

@ -24,14 +24,20 @@
#include <stdio.h>
#ifdef NDEBUG
# define ASSERT(expr) ((void)0)
# if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# define ASSERT(expr) __builtin_unreachable()
# else
# define ASSERT(expr) ((void)0)
# endif
#else /* NDEBUG */
# define ASSERT(expr) define ASSERT(expr) ((expr) ? 0 : icinga_assert_fail(#expr, __FILE__, __LINE__))
# 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)
int icinga_assert_fail(const char *expr, const char *file, int line) __attribute__((noreturn));
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();

View File

@ -21,12 +21,12 @@
#define OBJECT_H
#include "base/i2-base.h"
#include "base/debug.h"
#include <boost/thread/thread.hpp>
#ifndef _DEBUG
#include <boost/thread/mutex.hpp>
#else /* _DEBUG */
#include "base/utility.h"
#include <boost/thread/recursive_mutex.hpp>
#endif /* _DEBUG */