mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-02 17:30:24 +00:00
Make log_file_warning() use variadic templates.
This commit is contained in:
parent
9023b97e41
commit
f4b91ecaf0
2 changed files with 11 additions and 10 deletions
|
@ -309,15 +309,10 @@ void log_formatted_warning(std::string_view prefix, std::string message)
|
|||
}
|
||||
}
|
||||
|
||||
void log_file_warning(const std::string &filename, int lineno,
|
||||
const char *format, ...)
|
||||
void log_formatted_file_warning(std::string_view filename, int lineno, std::string str)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
std::string prefix = stringf("%s:%d: Warning: ",
|
||||
filename.c_str(), lineno);
|
||||
log_formatted_warning(prefix, vstringf(format, ap));
|
||||
va_end(ap);
|
||||
std::string prefix = stringf("%s:%d: Warning: ", filename, lineno);
|
||||
log_formatted_warning(prefix, std::move(str));
|
||||
}
|
||||
|
||||
void log_file_info(const std::string &filename, int lineno,
|
||||
|
|
10
kernel/log.h
10
kernel/log.h
|
@ -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);
|
||||
|
||||
// Log with filename to report a problem in a source file.
|
||||
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
||||
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));
|
||||
|
@ -169,6 +167,14 @@ inline void log_warning_noprefix(FmtString<TypeIdentity<Args>...> fmt, Args... a
|
|||
|
||||
void log_experimental(const std::string &str);
|
||||
|
||||
// Log with filename to report a problem in a source file.
|
||||
void log_formatted_file_warning(std::string_view filename, int lineno, std::string str);
|
||||
template <typename... Args>
|
||||
void log_file_warning(std::string_view filename, int lineno, FmtString<TypeIdentity<Args>...> fmt, Args... args)
|
||||
{
|
||||
log_formatted_file_warning(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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue