]> granicus.if.org Git - icinga2/commitdiff
Build fix for --enable-debug.
authorGunnar Beutner <gunnar@beutner.name>
Wed, 28 Aug 2013 14:49:58 +0000 (16:49 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 28 Aug 2013 14:49:58 +0000 (16:49 +0200)
lib/base/debug.h
lib/base/object.h

index 88d1d87dcba724f00c42efb31139603865dc270a..9587f47f08e400229c93060ca8cc3e46a7d310b3 100644 (file)
 #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();
index 2fe2c37be304563cd9ad5dcb8b0b16c0adb7400d..00fc8b41459338362ec789b7c0404fbba41bbc7b 100644 (file)
 #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 */