aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/log.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2020-02-22 10:52:46 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2020-02-22 10:52:46 +0100
commitd079ab9d19b7d18134f5b6f30da9a6666f30ad97 (patch)
treee8f4e5dc3355aeedb6e68437eaf85d99c5f5c082 /kernel/log.cc
parent596bb2d443a589df4deede4cc86783249e3bb09c (diff)
downloadyosys-d079ab9d19b7d18134f5b6f30da9a6666f30ad97.tar.gz
yosys-d079ab9d19b7d18134f5b6f30da9a6666f30ad97.tar.bz2
yosys-d079ab9d19b7d18134f5b6f30da9a6666f30ad97.zip
Handle expect no warnings together with expected
Diffstat (limited to 'kernel/log.cc')
-rw-r--r--kernel/log.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/log.cc b/kernel/log.cc
index 9e103855f..1785809e4 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -45,6 +45,7 @@ std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes
std::vector<std::pair<std::regex,LogExpectedItem>> log_expect_log, log_expect_warning, log_expect_error;
std::set<std::string> log_warnings, log_experimentals, log_experimentals_ignored;
int log_warnings_count = 0;
+int log_warnings_count_noexpect = 0;
bool log_expect_no_warnings = false;
bool log_hdump_all = false;
FILE *log_errfile = NULL;
@@ -253,9 +254,12 @@ static void logv_warning_with_prefix(const char *prefix,
if (std::regex_search(message, re))
log_error("%s", message.c_str());
+ bool warning_match = false;
for (auto &item : log_expect_warning)
- if (std::regex_search(message, item.first))
+ if (std::regex_search(message, item.first)) {
item.second.current_count++;
+ warning_match = true;
+ }
if (log_warnings.count(message))
{
@@ -276,6 +280,8 @@ static void logv_warning_with_prefix(const char *prefix,
log_warnings.insert(message);
}
+ if (!warning_match)
+ log_warnings_count_noexpect++;
log_warnings_count++;
log_make_debug = bak_log_make_debug;
}
@@ -661,7 +667,7 @@ void log_check_expected()
check_expected_logs = false;
for (auto &item : log_expect_warning) {
- if (item.second.current_count != item.second.expected_count) {
+ if (item.second.current_count == 0) {
log_error("Expected warning pattern '%s' not found !\n", item.second.pattern.c_str());
}
if (item.second.current_count != item.second.expected_count) {