From fe829bdbdc436f425e082ab1cc8c3d276f168945 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 9 Nov 2014 10:44:23 +0100 Subject: Added log_warning() API --- kernel/log.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'kernel/log.cc') diff --git a/kernel/log.cc b/kernel/log.cc index 9f5f03b2f..9f9c4db9f 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -152,6 +152,19 @@ void logv_header(const char *format, va_list ap) log_files.pop_back(); } +void logv_warning(const char *format, va_list ap) +{ + if (log_errfile != NULL) + log_files.push_back(log_errfile); + + log("Warning: "); + logv(format, ap); + log_flush(); + + if (log_errfile != NULL) + log_files.pop_back(); +} + void logv_error(const char *format, va_list ap) { if (log_errfile != NULL) @@ -179,6 +192,14 @@ void log_header(const char *format, ...) va_end(ap); } +void log_warning(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + logv_warning(format, ap); + va_end(ap); +} + void log_error(const char *format, ...) { va_list ap; @@ -304,14 +325,14 @@ std::map> get_coverage_data() for (auto &it : extra_coverage_data) { if (coverage_data.count(it.first)) - log("WARNING: found duplicate coverage id \"%s\".\n", it.first.c_str()); + log_warning("found duplicate coverage id \"%s\".\n", it.first.c_str()); coverage_data[it.first].first = it.second.first; coverage_data[it.first].second += it.second.second; } for (CoverData *p = __start_yosys_cover_list; p != __stop_yosys_cover_list; p++) { if (coverage_data.count(p->id)) - log("WARNING: found duplicate coverage id \"%s\".\n", p->id); + log_warning("found duplicate coverage id \"%s\".\n", p->id); coverage_data[p->id].first = stringf("%s:%d:%s", p->file, p->line, p->func); coverage_data[p->id].second += p->counter; } -- cgit v1.2.3