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

Make log_file_info() use variadic templates.

This commit is contained in:
Robert O'Callahan 2025-07-22 04:15:30 +00:00
parent f4b91ecaf0
commit d173c2c51f
2 changed files with 11 additions and 17 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);
void log_file_info(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
[[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));
@ -175,6 +173,15 @@ void log_file_warning(std::string_view filename, int lineno, FmtString<TypeIdent
log_formatted_file_warning(filename, lineno, fmt.format(args...));
}
void log_formatted_file_info(std::string_view filename, int lineno, std::string str);
template <typename... Args>
void log_file_info(std::string_view filename, int lineno, FmtString<TypeIdentity<Args>...> fmt, Args... args)
{
if (log_make_debug && !ys_debug(1))
return;
log_formatted_file_info(filename, lineno, fmt.format(args...));
}
static inline void log_suppressed() {
if (log_debug_suppressed && !log_make_debug) {
log("<suppressed ~%d debug messages>\n", log_debug_suppressed);