Deprecate gcc-4.8

This commit is contained in:
Miodrag Milanovic 2023-01-11 09:54:19 +01:00
parent 7b476996df
commit 5801152779
10 changed files with 58 additions and 127 deletions

View File

@ -1,21 +0,0 @@
name: Deprecated compilers
on: [push, pull_request]
jobs:
gcc48:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build GCC 4.8
run: |
docker run --rm -v $(pwd):/work yosyshq/deprecated-compilers:1.0 make config-gcc-4.8
docker run --rm -v $(pwd):/work yosyshq/deprecated-compilers:1.0 make -j8
clang39:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Clang 3.9
run: |
docker run --rm -v $(pwd):/work yosyshq/deprecated-compilers:1.0 make CC=clang-3.9 CXX=clang-3.9 LD=clang-3.9 -j8

View File

@ -1,7 +1,6 @@
CONFIG := clang
# CONFIG := gcc
# CONFIG := gcc-4.8
# CONFIG := afl-gcc
# CONFIG := emcc
# CONFIG := wasi
@ -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
@ -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)
@ -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
@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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;
};

View File

@ -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(){};
};
@ -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") {
@ -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());
}
@ -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');

View File

@ -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;
@ -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;
@ -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;
@ -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;

View File

@ -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;
@ -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());
}

View File

@ -154,67 +154,67 @@ struct QbfSolutionType {
}
void recover_solution() {
YS_REGEX_TYPE sat_regex = YS_REGEX_COMPILE("Status: PASSED");
YS_REGEX_TYPE unsat_regex = YS_REGEX_COMPILE("Solver Error.*model is not available");
YS_REGEX_TYPE unsat_regex2 = YS_REGEX_COMPILE("Status: FAILED");
YS_REGEX_TYPE timeout_regex = YS_REGEX_COMPILE("No solution found! \\(timeout\\)");
YS_REGEX_TYPE timeout_regex2 = YS_REGEX_COMPILE("No solution found! \\(interrupted\\)");
YS_REGEX_TYPE unknown_regex = YS_REGEX_COMPILE("No solution found! \\(unknown\\)");
YS_REGEX_TYPE unknown_regex2 = YS_REGEX_COMPILE("Unexpected EOF response from solver");
YS_REGEX_TYPE memout_regex = YS_REGEX_COMPILE("Solver Error:.*error \"out of memory\"");
YS_REGEX_TYPE hole_value_regex = YS_REGEX_COMPILE_WITH_SUBS("Value for anyconst in [a-zA-Z0-9_]* \\(([^:]*:[^\\)]*)\\): (.*)");
std::regex sat_regex = YS_REGEX_COMPILE("Status: PASSED");
std::regex unsat_regex = YS_REGEX_COMPILE("Solver Error.*model is not available");
std::regex unsat_regex2 = YS_REGEX_COMPILE("Status: FAILED");
std::regex timeout_regex = YS_REGEX_COMPILE("No solution found! \\(timeout\\)");
std::regex timeout_regex2 = YS_REGEX_COMPILE("No solution found! \\(interrupted\\)");
std::regex unknown_regex = YS_REGEX_COMPILE("No solution found! \\(unknown\\)");
std::regex unknown_regex2 = YS_REGEX_COMPILE("Unexpected EOF response from solver");
std::regex memout_regex = YS_REGEX_COMPILE("Solver Error:.*error \"out of memory\"");
std::regex hole_value_regex = YS_REGEX_COMPILE_WITH_SUBS("Value for anyconst in [a-zA-Z0-9_]* \\(([^:]*:[^\\)]*)\\): (.*)");
#ifndef NDEBUG
YS_REGEX_TYPE hole_loc_regex = YS_REGEX_COMPILE("[^:]*:[0-9]+.[0-9]+-[0-9]+.[0-9]+");
YS_REGEX_TYPE hole_val_regex = YS_REGEX_COMPILE("[0-9]+");
std::regex hole_loc_regex = YS_REGEX_COMPILE("[^:]*:[0-9]+.[0-9]+-[0-9]+.[0-9]+");
std::regex hole_val_regex = YS_REGEX_COMPILE("[0-9]+");
#endif
YS_REGEX_MATCH_TYPE m;
std::smatch m;
bool sat_regex_found = false;
bool unsat_regex_found = false;
dict<std::string, bool> hole_value_recovered;
for (const std::string &x : stdout_lines) {
if(YS_REGEX_NS::regex_search(x, m, hole_value_regex)) {
if(std::regex_search(x, m, hole_value_regex)) {
std::string loc = m[1].str();
std::string val = m[2].str();
#ifndef NDEBUG
log_assert(YS_REGEX_NS::regex_search(loc, hole_loc_regex));
log_assert(YS_REGEX_NS::regex_search(val, hole_val_regex));
log_assert(std::regex_search(loc, hole_loc_regex));
log_assert(std::regex_search(val, hole_val_regex));
#endif
auto locs = split_tokens(loc, "|");
pool<std::string> loc_pool(locs.begin(), locs.end());
hole_to_value[loc_pool] = val;
}
else if (YS_REGEX_NS::regex_search(x, sat_regex)) {
else if (std::regex_search(x, sat_regex)) {
sat_regex_found = true;
sat = true;
unknown = false;
}
else if (YS_REGEX_NS::regex_search(x, unsat_regex)) {
else if (std::regex_search(x, unsat_regex)) {
unsat_regex_found = true;
sat = false;
unknown = false;
}
else if (YS_REGEX_NS::regex_search(x, memout_regex)) {
else if (std::regex_search(x, memout_regex)) {
unknown = true;
log_warning("solver ran out of memory\n");
}
else if (YS_REGEX_NS::regex_search(x, timeout_regex)) {
else if (std::regex_search(x, timeout_regex)) {
unknown = true;
log_warning("solver timed out\n");
}
else if (YS_REGEX_NS::regex_search(x, timeout_regex2)) {
else if (std::regex_search(x, timeout_regex2)) {
unknown = true;
log_warning("solver timed out\n");
}
else if (YS_REGEX_NS::regex_search(x, unknown_regex)) {
else if (std::regex_search(x, unknown_regex)) {
unknown = true;
log_warning("solver returned \"unknown\"\n");
}
else if (YS_REGEX_NS::regex_search(x, unsat_regex2)) {
else if (std::regex_search(x, unsat_regex2)) {
unsat_regex_found = true;
sat = false;
unknown = false;
}
else if (YS_REGEX_NS::regex_search(x, unknown_regex2)) {
else if (std::regex_search(x, unknown_regex2)) {
unknown = true;
}
}