Add log_warning_noprefix() API, Use for Verific warnings and errors

This commit is contained in:
Clifford Wolf 2017-07-27 12:17:04 +02:00
parent d9641621d9
commit 2336d5508b
3 changed files with 37 additions and 1 deletions

View File

@ -77,7 +77,7 @@ void msg_func(msg_type_t msg_type, const char *message_id, linefile_type linefil
message += vstringf(msg, args);
if (msg_type == VERIFIC_ERROR || msg_type == VERIFIC_WARNING || msg_type == VERIFIC_PROGRAM_ERROR)
log_warning("%s\n", message.c_str());
log_warning_noprefix("%s\n", message.c_str());
else
log("%s\n", message.c_str());
}

View File

@ -227,6 +227,32 @@ void logv_warning(const char *format, va_list ap)
}
}
void logv_warning_noprefix(const char *format, va_list ap)
{
std::string message = vstringf(format, ap);
bool suppressed = false;
for (auto &re : log_nowarn_regexes)
if (std::regex_search(message, re))
suppressed = true;
if (suppressed)
{
log("%s", message.c_str());
}
else
{
if (log_errfile != NULL && !log_quiet_warnings)
log_files.push_back(log_errfile);
log("%s", message.c_str());
log_flush();
if (log_errfile != NULL && !log_quiet_warnings)
log_files.pop_back();
}
}
void logv_error(const char *format, va_list ap)
{
#ifdef EMSCRIPTEN
@ -282,6 +308,14 @@ void log_warning(const char *format, ...)
va_end(ap);
}
void log_warning_noprefix(const char *format, ...)
{
va_list ap;
va_start(ap, format);
logv_warning_noprefix(format, ap);
va_end(ap);
}
void log_error(const char *format, ...)
{
va_list ap;

View File

@ -65,11 +65,13 @@ extern void (*log_error_atexit)();
void logv(const char *format, va_list ap);
void logv_header(RTLIL::Design *design, const char *format, va_list ap);
void logv_warning(const char *format, va_list ap);
void logv_warning_noprefix(const char *format, va_list ap);
YS_NORETURN void logv_error(const char *format, va_list ap) YS_ATTRIBUTE(noreturn);
void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
void log_warning_noprefix(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
YS_NORETURN void log_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn);
YS_NORETURN void log_cmd_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn);