3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-04 10:20:24 +00:00

Make log_error() use variadic templates.

This commit is contained in:
Robert O'Callahan 2025-07-22 04:28:32 +00:00
parent d173c2c51f
commit c368ce99c1
2 changed files with 15 additions and 18 deletions

View file

@ -124,7 +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_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
[[noreturn]] void log_file_error(const string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
[[noreturn]] void log_cmd_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
@ -182,6 +181,13 @@ void log_file_info(std::string_view filename, int lineno, FmtString<TypeIdentity
log_formatted_file_info(filename, lineno, fmt.format(args...));
}
[[noreturn]] void log_formatted_error(std::string str);
template <typename... Args>
[[noreturn]] void log_error(FmtString<TypeIdentity<Args>...> fmt, Args... args)
{
log_formatted_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);