diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver.cc | 6 | ||||
-rw-r--r-- | kernel/log.cc | 16 | ||||
-rw-r--r-- | kernel/log.h | 21 |
3 files changed, 23 insertions, 20 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 8c0cc7021..5f0959776 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -413,13 +413,13 @@ int main(int argc, char **argv) scriptfile_tcl = true; break; case 'W': - log_warn_regexes.push_back(REGEX_COMPILE(optarg)); + log_warn_regexes.push_back(YS_REGEX_COMPILE(optarg)); break; case 'w': - log_nowarn_regexes.push_back(REGEX_COMPILE(optarg)); + log_nowarn_regexes.push_back(YS_REGEX_COMPILE(optarg)); break; case 'e': - log_werror_regexes.push_back(REGEX_COMPILE(optarg)); + log_werror_regexes.push_back(YS_REGEX_COMPILE(optarg)); break; case 'D': vlog_defines.push_back(optarg); diff --git a/kernel/log.cc b/kernel/log.cc index d28a44eb4..d84a4381e 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -41,8 +41,8 @@ YOSYS_NAMESPACE_BEGIN std::vector<FILE*> log_files; std::vector<std::ostream*> log_streams; std::map<std::string, std::set<std::string>> log_hdump; -std::vector<REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes; -std::vector<std::pair<REGEX_TYPE,LogExpectedItem>> log_expect_log, log_expect_warning, log_expect_error; +std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes; +std::vector<std::pair<YS_REGEX_TYPE,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; @@ -177,11 +177,11 @@ void logv(const char *format, va_list ap) if (!linebuffer.empty() && linebuffer.back() == '\n') { for (auto &re : log_warn_regexes) - if (REGEX_NS::regex_search(linebuffer, re)) + if (YS_REGEX_NS::regex_search(linebuffer, re)) log_warning("Found log message matching -W regex:\n%s", str.c_str()); for (auto &item : log_expect_log) - if (REGEX_NS::regex_search(linebuffer, item.first)) + if (YS_REGEX_NS::regex_search(linebuffer, item.first)) item.second.current_count++; linebuffer.clear(); @@ -238,7 +238,7 @@ static void logv_warning_with_prefix(const char *prefix, bool suppressed = false; for (auto &re : log_nowarn_regexes) - if (REGEX_NS::regex_search(message, re)) + if (YS_REGEX_NS::regex_search(message, re)) suppressed = true; if (suppressed) @@ -251,12 +251,12 @@ static void logv_warning_with_prefix(const char *prefix, log_make_debug = 0; for (auto &re : log_werror_regexes) - if (REGEX_NS::regex_search(message, re)) + if (YS_REGEX_NS::regex_search(message, re)) log_error("%s", message.c_str()); bool warning_match = false; for (auto &item : log_expect_warning) - if (REGEX_NS::regex_search(message, item.first)) { + if (YS_REGEX_NS::regex_search(message, item.first)) { item.second.current_count++; warning_match = true; } @@ -349,7 +349,7 @@ static void logv_error_with_prefix(const char *prefix, log_error_atexit(); for (auto &item : log_expect_error) - if (REGEX_NS::regex_search(log_last_error, item.first)) + if (YS_REGEX_NS::regex_search(log_last_error, item.first)) item.second.current_count++; if (check_expected_logs) diff --git a/kernel/log.h b/kernel/log.h index 3ec10c95d..61cc246e7 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -23,18 +23,21 @@ #define LOG_H #include <time.h> -#if defined(__GNUC__) && ( __GNUC__ == 4 && __GNUC_MINOR__ == 8) + +// In GCC 4.8 std::regex is not working correctlty, in order to make features +// using regular expressions to work replacement regex library is used +#if defined(__GNUC__) && ( __GNUC__ == 4 && __GNUC_MINOR__ <= 8) #include <boost/xpressive/xpressive.hpp> - #define REGEX_TYPE boost::xpressive::sregex - #define REGEX_NS boost::xpressive - #define REGEX_COMPILE(param) boost::xpressive::sregex::compile(param, \ + #define YS_REGEX_TYPE boost::xpressive::sregex + #define YS_REGEX_NS boost::xpressive + #define YS_REGEX_COMPILE(param) boost::xpressive::sregex::compile(param, \ boost::xpressive::regex_constants::nosubs | \ boost::xpressive::regex_constants::optimize) # else #include <regex> - #define REGEX_TYPE std::regex - #define REGEX_NS std - #define REGEX_COMPILE(param) std::regex(param, \ + #define YS_REGEX_TYPE std::regex + #define YS_REGEX_NS std + #define YS_REGEX_COMPILE(param) std::regex(param, \ std::regex_constants::nosubs | \ std::regex_constants::optimize | \ std::regex_constants::egrep) @@ -64,7 +67,7 @@ struct log_cmd_error_exception { }; extern std::vector<FILE*> log_files; extern std::vector<std::ostream*> log_streams; extern std::map<std::string, std::set<std::string>> log_hdump; -extern std::vector<REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes; +extern std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes; extern std::set<std::string> log_warnings, log_experimentals, log_experimentals_ignored; extern int log_warnings_count; extern int log_warnings_count_noexpect; @@ -166,7 +169,7 @@ struct LogExpectedItem std::string pattern; }; -extern std::vector<std::pair<REGEX_TYPE,LogExpectedItem>> log_expect_log, log_expect_warning, log_expect_error; +extern std::vector<std::pair<YS_REGEX_TYPE,LogExpectedItem>> log_expect_log, log_expect_warning, log_expect_error; void log_check_expected(); const char *log_signal(const RTLIL::SigSpec &sig, bool autoint = true); |