From 1b5373de0d4137c671c298cbf6e5530178a10ab8 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 23 Aug 2025 18:21:33 +1200 Subject: [PATCH] Move log_assert_worker()'s call to log_error() into an out-of-line non-varags function --- kernel/log.cc | 5 +++++ kernel/log.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/log.cc b/kernel/log.cc index 27d58b45b..1e95ea5c5 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -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; diff --git a/kernel/log.h b/kernel/log.h index c3cbbc04a..40e1f02ff 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -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