From: Clifford Wolf Date: Sat, 24 Jan 2015 10:49:34 +0000 (+0100) Subject: Added #ifdef NDEBUG for log_assert() X-Git-Tag: yosys-0.5~66 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8fe9ab50e51204e5709eaad0fbf2ffb5397a0194;p=yosys.git Added #ifdef NDEBUG for log_assert() --- diff --git a/kernel/log.h b/kernel/log.h index e61d19b62..8b3d8a3ad 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -79,12 +79,16 @@ template static inline const char *log_id(T *obj) { void log_cell(RTLIL::Cell *cell, std::string indent = ""); +#ifndef NDEBUG static inline void log_assert_worker(bool cond, const char *expr, const char *file, int line) { if (!cond) log_error("Assert `%s' failed in %s:%d.\n", expr, file, line); } +# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__) +#else +# define log_assert(_assert_expr_) +#endif #define log_abort() YOSYS_NAMESPACE_PREFIX log_error("Abort in %s:%d.\n", __FILE__, __LINE__) -#define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__) #define log_ping() YOSYS_NAMESPACE_PREFIX log("-- %s:%d %s --\n", __FILE__, __LINE__, __PRETTY_FUNCTION__)