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/cost.h | 2 +- kernel/log.cc | 25 +++++++++++++++++++++++-- kernel/log.h | 4 +++- kernel/rtlil.cc | 6 +++--- 4 files changed, 30 insertions(+), 7 deletions(-) (limited to 'kernel') diff --git a/kernel/cost.h b/kernel/cost.h index 5e99df993..61a693b9c 100644 --- a/kernel/cost.h +++ b/kernel/cost.h @@ -70,7 +70,7 @@ int get_cell_cost(RTLIL::IdString type, const 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; } diff --git a/kernel/log.h b/kernel/log.h index 93e8144a0..b003aba22 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -51,10 +51,12 @@ extern int log_verbose_level; void logv(const char *format, va_list ap); void logv_header(const char *format, va_list ap); +void logv_warning(const char *format, va_list ap); +_NORETURN_ void logv_error(const char *format, va_list ap) __attribute__((noreturn)); -void logv_error(const char *format, va_list ap) __attribute__((noreturn)); void log(const char *format, ...) __attribute__((format(printf, 1, 2))); void log_header(const char *format, ...) __attribute__((format(printf, 1, 2))); +void log_warning(const char *format, ...) __attribute__((format(printf, 1, 2))); _NORETURN_ void log_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); _NORETURN_ void log_cmd_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 8cfc0c5f9..803d783af 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -440,7 +440,7 @@ std::vector RTLIL::Design::selected_whole_modules_warn() const if (selected_whole_module(it.first)) result.push_back(it.second); else if (selected_module(it.first)) - log("Warning: Ignoring partially selected module %s.\n", log_id(it.first)); + log_warning("Ignoring partially selected module %s.\n", log_id(it.first)); return result; } @@ -1062,14 +1062,14 @@ bool RTLIL::Module::has_processes() const bool RTLIL::Module::has_memories_warn() const { if (!memories.empty()) - log("Warning: Ignoring module %s because it contains memories (run 'memory' command first).\n", log_id(this)); + log_warning("Ignoring module %s because it contains memories (run 'memory' command first).\n", log_id(this)); return !memories.empty(); } bool RTLIL::Module::has_processes_warn() const { if (!processes.empty()) - log("Warning: Ignoring module %s because it contains processes (run 'proc' command first).\n", log_id(this)); + log_warning("Ignoring module %s because it contains processes (run 'proc' command first).\n", log_id(this)); return !processes.empty(); } -- cgit v1.2.3