aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2023-01-11 09:54:19 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2023-01-11 09:54:19 +0100
commit5801152779826481df6da6a2876d4b3aae5533cd (patch)
tree96dc79544fcd0c5ba311fdc1a76511c6e41ec434 /kernel
parent7b476996df962b63656152f643ff2181143f516e (diff)
downloadyosys-5801152779826481df6da6a2876d4b3aae5533cd.tar.gz
yosys-5801152779826481df6da6a2876d4b3aae5533cd.tar.bz2
yosys-5801152779826481df6da6a2876d4b3aae5533cd.zip
Deprecate gcc-4.8
Diffstat (limited to 'kernel')
-rw-r--r--kernel/log.cc14
-rw-r--r--kernel/log.h59
2 files changed, 18 insertions, 55 deletions
diff --git a/kernel/log.cc b/kernel/log.cc
index 25d198744..0092871f0 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -42,7 +42,7 @@ std::vector<FILE*> log_files;
std::vector<std::ostream*> log_streams;
std::vector<std::string> log_scratchpads;
std::map<std::string, std::set<std::string>> log_hdump;
-std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
+std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
dict<std::string, 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;
@@ -181,11 +181,11 @@ void logv(const char *format, va_list ap)
if (!linebuffer.empty() && linebuffer.back() == '\n') {
for (auto &re : log_warn_regexes)
- if (YS_REGEX_NS::regex_search(linebuffer, re))
+ if (std::regex_search(linebuffer, re))
log_warning("Found log message matching -W regex:\n%s", str.c_str());
for (auto &item : log_expect_log)
- if (YS_REGEX_NS::regex_search(linebuffer, item.second.pattern))
+ if (std::regex_search(linebuffer, item.second.pattern))
item.second.current_count++;
linebuffer.clear();
@@ -242,7 +242,7 @@ static void logv_warning_with_prefix(const char *prefix,
bool suppressed = false;
for (auto &re : log_nowarn_regexes)
- if (YS_REGEX_NS::regex_search(message, re))
+ if (std::regex_search(message, re))
suppressed = true;
if (suppressed)
@@ -255,12 +255,12 @@ static void logv_warning_with_prefix(const char *prefix,
log_make_debug = 0;
for (auto &re : log_werror_regexes)
- if (YS_REGEX_NS::regex_search(message, re))
+ if (std::regex_search(message, re))
log_error("%s", message.c_str());
bool warning_match = false;
for (auto &item : log_expect_warning)
- if (YS_REGEX_NS::regex_search(message, item.second.pattern)) {
+ if (std::regex_search(message, item.second.pattern)) {
item.second.current_count++;
warning_match = true;
}
@@ -349,7 +349,7 @@ static void logv_error_with_prefix(const char *prefix,
log_make_debug = bak_log_make_debug;
for (auto &item : log_expect_error)
- if (YS_REGEX_NS::regex_search(log_last_error, item.second.pattern))
+ if (std::regex_search(log_last_error, item.second.pattern))
item.second.current_count++;
log_check_expected();
diff --git a/kernel/log.h b/kernel/log.h
index 35368a683..3a6ec8758 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -24,51 +24,14 @@
#include <time.h>
-// In the libstdc++ headers that are provided by GCC 4.8, std::regex is not
-// working correctly. In order to make features using regular expressions
-// work, a replacement regex library is used. Just checking for GCC version
-// is not enough though, because at least on RHEL7/CentOS7 even when compiling
-// with Clang instead of GCC, the GCC 4.8 headers are still used for std::regex.
-// We have to check the version of the libstdc++ headers specifically, not the
-// compiler version. GCC headers of libstdc++ before version 3.4 define
-// __GLIBCPP__, later versions define __GLIBCXX__. GCC 7 and newer additionaly
-// define _GLIBCXX_RELEASE with a version number.
-// Include limits std C++ header, so we get the version macros defined:
-#if defined(__cplusplus)
-# include <limits>
-#endif
-// Check if libstdc++ is from GCC
-#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
-// Check if version could be 4.8 or lower (this also matches for some 4.9 and
-// 5.0 releases). See:
-// https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
-# if !defined(_GLIBCXX_RELEASE) && (defined(__GLIBCPP__) || __GLIBCXX__ <= 20150623)
-# define YS_HAS_BAD_STD_REGEX
-# endif
-#endif
-#if defined(YS_HAS_BAD_STD_REGEX)
- #include <boost/xpressive/xpressive.hpp>
- #define YS_REGEX_TYPE boost::xpressive::sregex
- #define YS_REGEX_MATCH_TYPE boost::xpressive::smatch
- #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)
- #define YS_REGEX_COMPILE_WITH_SUBS(param) boost::xpressive::sregex::compile(param, \
- boost::xpressive::regex_constants::optimize)
-# else
- #include <regex>
- #define YS_REGEX_TYPE std::regex
- #define YS_REGEX_MATCH_TYPE std::smatch
- #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)
- #define YS_REGEX_COMPILE_WITH_SUBS(param) std::regex(param, \
- std::regex_constants::optimize | \
- std::regex_constants::egrep)
-#endif
+#include <regex>
+#define YS_REGEX_COMPILE(param) std::regex(param, \
+ std::regex_constants::nosubs | \
+ std::regex_constants::optimize | \
+ std::regex_constants::egrep)
+#define YS_REGEX_COMPILE_WITH_SUBS(param) std::regex(param, \
+ std::regex_constants::optimize | \
+ std::regex_constants::egrep)
#if defined(_WIN32)
# include <intrin.h>
@@ -135,7 +98,7 @@ extern std::vector<FILE*> log_files;
extern std::vector<std::ostream*> log_streams;
extern std::vector<std::string> log_scratchpads;
extern std::map<std::string, std::set<std::string>> log_hdump;
-extern std::vector<YS_REGEX_TYPE> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
+extern std::vector<std::regex> 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;
@@ -224,11 +187,11 @@ void log_flush();
struct LogExpectedItem
{
- LogExpectedItem(const YS_REGEX_TYPE &pat, int expected) :
+ LogExpectedItem(const std::regex &pat, int expected) :
pattern(pat), expected_count(expected), current_count(0) {}
LogExpectedItem() : expected_count(0), current_count(0) {}
- YS_REGEX_TYPE pattern;
+ std::regex pattern;
int expected_count;
int current_count;
};