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:
parent
ea2bb5b79a
commit
1b5373de0d
2 changed files with 8 additions and 1 deletions
|
@ -410,6 +410,11 @@ void log_error(const char *format, ...)
|
||||||
logv_error(format, ap);
|
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, ...)
|
void log_cmd_error(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -252,9 +252,11 @@ void log_module(RTLIL::Module *module, std::string indent = "");
|
||||||
void log_cell(RTLIL::Cell *cell, std::string indent = "");
|
void log_cell(RTLIL::Cell *cell, std::string indent = "");
|
||||||
void log_wire(RTLIL::Wire *wire, 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
|
#ifndef NDEBUG
|
||||||
static inline void log_assert_worker(bool cond, const char *expr, const char *file, int line) {
|
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__)
|
# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue