diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2020-02-20 11:41:37 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2020-02-20 11:41:37 +0100 |
commit | 419e67c1706367a3a10feb70a1d7a2f9cafb591b (patch) | |
tree | 16b52fd8c7792e37f492b2767c9b32b7fe511900 /passes/cmds/logger.cc | |
parent | 70db8e92003fab959ec5d14b51ac2a9209d16b30 (diff) | |
download | yosys-419e67c1706367a3a10feb70a1d7a2f9cafb591b.tar.gz yosys-419e67c1706367a3a10feb70a1d7a2f9cafb591b.tar.bz2 yosys-419e67c1706367a3a10feb70a1d7a2f9cafb591b.zip |
check for regex errors
Diffstat (limited to 'passes/cmds/logger.cc')
-rw-r--r-- | passes/cmds/logger.cc | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc index 947b178c5..3abe4e93b 100644 --- a/passes/cmds/logger.cc +++ b/passes/cmds/logger.cc @@ -151,22 +151,26 @@ struct LoggerPass : public Pass { if (type=="error" && count!=1) 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()); - if (type=="error") - log_expect_error.push_back(std::make_pair(std::regex(pattern, - std::regex_constants::nosubs | - std::regex_constants::optimize | - std::regex_constants::egrep), LogExpectedItem(pattern, count))); - else if (type=="warning") - log_expect_warning.push_back(std::make_pair(std::regex(pattern, - std::regex_constants::nosubs | - std::regex_constants::optimize | - std::regex_constants::egrep), LogExpectedItem(pattern, count))); - else - log_expect_log.push_back(std::make_pair(std::regex(pattern, - std::regex_constants::nosubs | - std::regex_constants::optimize | - std::regex_constants::egrep), LogExpectedItem(pattern, count))); - + try { + if (type=="error") + log_expect_error.push_back(std::make_pair(std::regex(pattern, + std::regex_constants::nosubs | + std::regex_constants::optimize | + std::regex_constants::egrep), LogExpectedItem(pattern, count))); + else if (type=="warning") + log_expect_warning.push_back(std::make_pair(std::regex(pattern, + std::regex_constants::nosubs | + std::regex_constants::optimize | + std::regex_constants::egrep), LogExpectedItem(pattern, count))); + else + log_expect_log.push_back(std::make_pair(std::regex(pattern, + std::regex_constants::nosubs | + std::regex_constants::optimize | + std::regex_constants::egrep), LogExpectedItem(pattern, count))); + } + catch (const std::regex_error& e) { + log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str()); + } continue; } if (args[argidx] == "-expect-no-warnings") { |