mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
logger: fix for multiple calls with same pattern
This commit is contained in:
parent
5bcde7ccc3
commit
65395168a0
|
@ -158,12 +158,40 @@ struct LoggerPass : public Pass {
|
||||||
log_cmd_error("Expected error message occurrences must be 1 !\n");
|
log_cmd_error("Expected error message occurrences must be 1 !\n");
|
||||||
log("Added regex '%s' for warnings to expected %s list.\n", pattern.c_str(), type.c_str());
|
log("Added regex '%s' for warnings to expected %s list.\n", pattern.c_str(), type.c_str());
|
||||||
try {
|
try {
|
||||||
if (type=="error")
|
if (type=="error") {
|
||||||
log_expect_error.push_back(std::make_pair(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count)));
|
auto it = log_expect_error.begin();
|
||||||
else if (type=="warning")
|
auto ie = log_expect_error.end();
|
||||||
log_expect_warning.push_back(std::make_pair(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count)));
|
for (; it != ie; it++)
|
||||||
else
|
if (it->second.pattern == pattern) {
|
||||||
log_expect_log.push_back(std::make_pair(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count)));
|
it->second.expected_count = count;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (it == ie)
|
||||||
|
log_expect_error.emplace_back(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count));
|
||||||
|
}
|
||||||
|
else if (type=="warning") {
|
||||||
|
auto it = log_expect_warning.begin();
|
||||||
|
auto ie = log_expect_warning.end();
|
||||||
|
for (; it != ie; it++)
|
||||||
|
if (it->second.pattern == pattern) {
|
||||||
|
it->second.expected_count = count;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (it == ie)
|
||||||
|
log_expect_warning.emplace_back(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count));
|
||||||
|
}
|
||||||
|
else if (type=="log") {
|
||||||
|
auto it = log_expect_log.begin();
|
||||||
|
auto ie = log_expect_log.end();
|
||||||
|
for (; it != ie; it++)
|
||||||
|
if (it->second.pattern == pattern) {
|
||||||
|
it->second.expected_count = count;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (it == ie)
|
||||||
|
log_expect_log.emplace_back(YS_REGEX_COMPILE(pattern), LogExpectedItem(pattern, count));
|
||||||
|
}
|
||||||
|
else log_abort();
|
||||||
}
|
}
|
||||||
catch (const YS_REGEX_NS::regex_error& e) {
|
catch (const YS_REGEX_NS::regex_error& e) {
|
||||||
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
|
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
|
||||||
|
|
Loading…
Reference in a new issue