3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-10 19:51:27 +00:00

Move log_assert_worker()'s call to log_error() into an out-of-line non-varags function

This commit is contained in:
Robert O'Callahan 2025-08-23 18:21:33 +12:00 committed by Jannis Harder
parent ea2bb5b79a
commit 1b5373de0d
2 changed files with 8 additions and 1 deletions

View file

@ -410,6 +410,11 @@ void log_error(const char *format, ...)
logv_error(format, ap);
}
void log_assert_failure(const char *expr, const char *file, int line)
{
log_error("Assert `%s' failed in %s:%d.\n", expr, file, line);
}
void log_cmd_error(const char *format, ...)
{
va_list ap;

View file

@ -252,9 +252,11 @@ void log_module(RTLIL::Module *module, std::string indent = "");
void log_cell(RTLIL::Cell *cell, std::string indent = "");
void log_wire(RTLIL::Wire *wire, std::string indent = "");
[[noreturn]]
void log_assert_failure(const char *expr, const char *file, int line);
#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);
if (!cond) log_assert_failure(expr, file, line);
}
# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
#else