aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2020-02-22 10:31:56 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2020-02-22 10:31:56 +0100
commit596bb2d443a589df4deede4cc86783249e3bb09c (patch)
tree0f340fc2a4bcf1458e50a8271b969d35c491060d /passes
parent419e67c1706367a3a10feb70a1d7a2f9cafb591b (diff)
downloadyosys-596bb2d443a589df4deede4cc86783249e3bb09c.tar.gz
yosys-596bb2d443a589df4deede4cc86783249e3bb09c.tar.bz2
yosys-596bb2d443a589df4deede4cc86783249e3bb09c.zip
Check other regex parameters
Diffstat (limited to 'passes')
-rw-r--r--passes/cmds/logger.cc45
1 files changed, 30 insertions, 15 deletions
diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc
index 3abe4e93b..018a3e6cf 100644
--- a/passes/cmds/logger.cc
+++ b/passes/cmds/logger.cc
@@ -94,31 +94,46 @@ struct LoggerPass : public Pass {
if (args[argidx] == "-warn" && argidx+1 < args.size()) {
std::string pattern = args[++argidx];
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
- log("Added regex '%s' for warnings to warn list.", pattern.c_str());
- log_warn_regexes.push_back(std::regex(pattern,
- std::regex_constants::nosubs |
- std::regex_constants::optimize |
- std::regex_constants::egrep));
+ try {
+ log("Added regex '%s' for warnings to warn list.", pattern.c_str());
+ log_warn_regexes.push_back(std::regex(pattern,
+ std::regex_constants::nosubs |
+ std::regex_constants::optimize |
+ std::regex_constants::egrep));
+ }
+ catch (const std::regex_error& e) {
+ log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
+ }
continue;
}
if (args[argidx] == "-nowarn" && argidx+1 < args.size()) {
std::string pattern = args[++argidx];
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
- log("Added regex '%s' for warnings to nowarn list.", pattern.c_str());
- log_nowarn_regexes.push_back(std::regex(pattern,
- std::regex_constants::nosubs |
- std::regex_constants::optimize |
- std::regex_constants::egrep));
+ try {
+ log("Added regex '%s' for warnings to nowarn list.", pattern.c_str());
+ log_nowarn_regexes.push_back(std::regex(pattern,
+ std::regex_constants::nosubs |
+ std::regex_constants::optimize |
+ std::regex_constants::egrep));
+ }
+ catch (const std::regex_error& e) {
+ log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
+ }
continue;
}
if (args[argidx] == "-werror" && argidx+1 < args.size()) {
std::string pattern = args[++argidx];
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
- log("Added regex '%s' for warnings to werror list.", pattern.c_str());
- log_werror_regexes.push_back(std::regex(pattern,
- std::regex_constants::nosubs |
- std::regex_constants::optimize |
- std::regex_constants::egrep));
+ try {
+ log("Added regex '%s' for warnings to werror list.", pattern.c_str());
+ log_werror_regexes.push_back(std::regex(pattern,
+ std::regex_constants::nosubs |
+ std::regex_constants::optimize |
+ std::regex_constants::egrep));
+ }
+ catch (const std::regex_error& e) {
+ log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
+ }
continue;
}
if (args[argidx] == "-debug") {