Skip to content

Commit

Permalink
Deprecate gcc-4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed Jan 11, 2023
1 parent 7b47699 commit 5801152
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 127 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/deprecated.yml

This file was deleted.

14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

CONFIG := clang
# CONFIG := gcc
# CONFIG := gcc-4.8
# CONFIG := afl-gcc
# CONFIG := emcc
# CONFIG := wasi
Expand Down Expand Up @@ -256,12 +255,6 @@ ifeq ($(DISABLE_ABC_THREADS),1)
ABCMKARGS += "ABC_USE_NO_PTHREADS=1"
endif

else ifeq ($(CONFIG),gcc-4.8)
CXX = gcc-4.8
LD = gcc-4.8
CXXFLAGS += -std=$(CXXSTD) -Os
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"

else ifeq ($(CONFIG),afl-gcc)
CXX = AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
LD = AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
Expand Down Expand Up @@ -379,7 +372,7 @@ ABCMKARGS += LIBS="-lpthread -s" ABC_USE_NO_READLINE=0 CC="x86_64-w64-mingw32-gc
EXE = .exe

else ifneq ($(CONFIG),none)
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.8, emcc, mxe, msys2-32, msys2-64)
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, emcc, mxe, msys2-32, msys2-64)
endif

ifeq ($(ENABLE_LIBYOSYS),1)
Expand Down Expand Up @@ -1053,9 +1046,6 @@ config-gcc-static: clean
echo 'ENABLE_READLINE := 0' >> Makefile.conf
echo 'ENABLE_TCL := 0' >> Makefile.conf

config-gcc-4.8: clean
echo 'CONFIG := gcc-4.8' > Makefile.conf

config-afl-gcc: clean
echo 'CONFIG := afl-gcc' > Makefile.conf

Expand Down Expand Up @@ -1119,4 +1109,4 @@ echo-abc-rev:
-include techlibs/*/*.d

.PHONY: all top-all abc test install install-abc docs clean mrproper qtcreator coverage vcxsrc mxebin
.PHONY: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-afl-gcc config-gprof config-sudo
.PHONY: config-clean config-clang config-gcc config-gcc-static config-afl-gcc config-gprof config-sudo
2 changes: 1 addition & 1 deletion guidelines/Checklists
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ And if a version of the verific library is currently available:
../../yosys test_navre.ys


Finally run all tests with "make config-{clang,gcc,gcc-4.8}":
Finally run all tests with "make config-{clang,gcc}":

cd ~yosys
make clean
Expand Down
3 changes: 1 addition & 2 deletions guidelines/CodingStyle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Formatting of code
C++ Language
-------------

Yosys is written in C++11. At the moment only constructs supported by
gcc 4.8 are allowed in Yosys code. This will change in future releases.
Yosys is written in C++11.

In general Yosys uses "int" instead of "size_t". To avoid compiler
warnings for implicit type casts, always use "GetSize(foobar)" instead
Expand Down
14 changes: 7 additions & 7 deletions kernel/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
59 changes: 11 additions & 48 deletions kernel/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
Expand Down
8 changes: 4 additions & 4 deletions passes/cmds/exec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct ExecPass : public Pass {
bool polarity; //true: this regex must match at least one line
//false: this regex must not match any line
std::string str;
YS_REGEX_TYPE re;
std::regex re;

expect_stdout_elem() : matched(false), polarity(true), str(), re(){};
};
Expand Down Expand Up @@ -121,7 +121,7 @@ struct ExecPass : public Pass {
x.str = args[argidx];
x.re = YS_REGEX_COMPILE(args[argidx]);
expect_stdout.push_back(x);
} catch (const YS_REGEX_NS::regex_error& e) {
} catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", args[argidx].c_str());
}
} else if (args[argidx] == "-not-expect-stdout") {
Expand All @@ -136,7 +136,7 @@ struct ExecPass : public Pass {
x.re = YS_REGEX_COMPILE(args[argidx]);
x.polarity = false;
expect_stdout.push_back(x);
} catch (const YS_REGEX_NS::regex_error& e) {
} catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", args[argidx].c_str());
}

Expand Down Expand Up @@ -171,7 +171,7 @@ struct ExecPass : public Pass {

if (flag_expect_stdout)
for(auto &x : expect_stdout)
if (YS_REGEX_NS::regex_search(line, x.re))
if (std::regex_search(line, x.re))
x.matched = true;

pos = linebuf.find('\n');
Expand Down
8 changes: 4 additions & 4 deletions passes/cmds/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct LoggerPass : public Pass {
log("Added regex '%s' for warnings to warn list.\n", pattern.c_str());
log_warn_regexes.push_back(YS_REGEX_COMPILE(pattern));
}
catch (const YS_REGEX_NS::regex_error& e) {
catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
}
continue;
Expand All @@ -116,7 +116,7 @@ struct LoggerPass : public Pass {
log("Added regex '%s' for warnings to nowarn list.\n", pattern.c_str());
log_nowarn_regexes.push_back(YS_REGEX_COMPILE(pattern));
}
catch (const YS_REGEX_NS::regex_error& e) {
catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
}
continue;
Expand All @@ -128,7 +128,7 @@ struct LoggerPass : public Pass {
log("Added regex '%s' for warnings to werror list.\n", pattern.c_str());
log_werror_regexes.push_back(YS_REGEX_COMPILE(pattern));
}
catch (const YS_REGEX_NS::regex_error& e) {
catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
}
continue;
Expand Down Expand Up @@ -172,7 +172,7 @@ struct LoggerPass : public Pass {
log_expect_log[pattern] = LogExpectedItem(YS_REGEX_COMPILE(pattern), count);
else log_abort();
}
catch (const YS_REGEX_NS::regex_error& e) {
catch (const std::regex_error& e) {
log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str());
}
continue;
Expand Down
10 changes: 5 additions & 5 deletions passes/sat/qbfsat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ pool<std::string> validate_design_and_get_inputs(RTLIL::Module *module, bool ass
}

void specialize_from_file(RTLIL::Module *module, const std::string &file) {
YS_REGEX_TYPE hole_bit_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) \\[([0-9]+)] = ([01])$");
YS_REGEX_TYPE hole_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) = ([01])$"); //if no index specified
YS_REGEX_MATCH_TYPE bit_m, m;
std::regex hole_bit_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) \\[([0-9]+)] = ([01])$");
std::regex hole_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) = ([01])$"); //if no index specified
std::smatch bit_m, m;
dict<pool<std::string>, RTLIL::Cell*> anyconst_loc_to_cell;
dict<RTLIL::SigBit, RTLIL::State> hole_assignments;

Expand All @@ -83,9 +83,9 @@ void specialize_from_file(RTLIL::Module *module, const std::string &file) {
std::string buf;
while (std::getline(fin, buf)) {
bool bit_assn = true;
if (!YS_REGEX_NS::regex_search(buf, bit_m, hole_bit_assn_regex)) {
if (!std::regex_search(buf, bit_m, hole_bit_assn_regex)) {
bit_assn = false;
if (!YS_REGEX_NS::regex_search(buf, m, hole_assn_regex))
if (!std::regex_search(buf, m, hole_assn_regex))
log_cmd_error("solution file is not formatted correctly: \"%s\"\n", buf.c_str());
}

Expand Down
Loading

0 comments on commit 5801152

Please sign in to comment.