void log(unsigned int cat, const char *msg, ...) __attribute__((format(printf,2,3)));
void die(byte *, ...) NONRET;
-void assert_failed(char *assertion, char *file, int line) NONRET;
void log_init(byte *);
void log_file(byte *);
void log_fork(void);
#ifdef DEBUG
+void assert_failed(char *assertion, char *file, int line) NONRET;
#define ASSERT(x) do { if (!(x)) assert_failed(#x, __FILE__, __LINE__); } while(0)
#else
-#define ASSERT(x) do { } while(0)
+void assert_failed(void) NONRET;
+#define ASSERT(x) do { if (__builtin_constant_p(x) && !(x)) assert_failed(); } while(0)
#endif
#ifdef LOCAL_DEBUG
exit(1);
}
+#ifdef DEBUG
void
assert_failed(char *assertion, char *file, int line)
{
log(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line);
abort();
}
+#else
+void
+assert_failed(void)
+{
+ die("Internal error: Assertion failed.");
+}
+#endif
static byte *
log_basename(byte *n)