3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-04 18:30:25 +00:00

Make log_cmd_error() use variadic templates.

This commit is contained in:
Robert O'Callahan 2025-07-22 04:42:43 +00:00
parent 5951d9d303
commit 7f45715fec
2 changed files with 11 additions and 9 deletions

View file

@ -124,8 +124,6 @@ extern int log_debug_suppressed;
void set_verific_logging(void (*cb)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg));
extern void (*log_verific_callback)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg);
[[noreturn]] void log_cmd_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
#ifndef NDEBUG
static inline bool ys_debug(int n = 0) { if (log_force_debug) return true; log_debug_suppressed += n; return false; }
#else
@ -194,6 +192,13 @@ template <typename... Args>
log_formatted_file_error(filename, lineno, fmt.format(args...));
}
[[noreturn]] void log_formatted_cmd_error(std::string str);
template <typename... Args>
[[noreturn]] void log_cmd_error(FmtString<TypeIdentity<Args>...> fmt, Args... args)
{
log_formatted_cmd_error(fmt.format(args...));
}
static inline void log_suppressed() {
if (log_debug_suppressed && !log_make_debug) {
log("<suppressed ~%d debug messages>\n", log_debug_suppressed);