mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2026-01-01 14:15:43 +03:00
Merge branch 'develop' into wip-cppcheck271-part2
This commit is contained in:
@@ -176,7 +176,8 @@ void replaceAssertVertex(NGHolder &g, NFAVertex t, const ExpressionInfo &expr,
|
||||
auto ecit = edge_cache.find(cache_key);
|
||||
if (ecit == edge_cache.end()) {
|
||||
DEBUG_PRINTF("adding edge %zu %zu\n", g[u].index, g[v].index);
|
||||
NFAEdge e = add_edge(u, v, g);
|
||||
NFAEdge e;
|
||||
std::tie(e, std::ignore) = add_edge(u, v, g);
|
||||
edge_cache.emplace(cache_key, e);
|
||||
g[e].assert_flags = flags;
|
||||
if (++assert_edge_count > MAX_ASSERT_EDGES) {
|
||||
@@ -229,11 +230,12 @@ void checkForMultilineStart(ReportManager &rm, NGHolder &g,
|
||||
|
||||
/* we need to interpose a dummy dot vertex between v and accept if
|
||||
* required so that ^ doesn't match trailing \n */
|
||||
for (const auto &e : out_edges_range(v, g)) {
|
||||
if (target(e, g) == g.accept) {
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
auto deads = [&g=g](const NFAEdge &e) {
|
||||
return (target(e, g) == g.accept);
|
||||
};
|
||||
const auto &er = out_edges_range(v, g);
|
||||
std::copy_if(begin(er), end(er), std::back_inserter(dead), deads);
|
||||
|
||||
/* assert has been resolved; clear flag */
|
||||
g[v].assert_flags &= ~POS_FLAG_MULTILINE_START;
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ bytecode_ptr<RoseEngine> generateRoseEngine(NG &ng) {
|
||||
if (!rose) {
|
||||
DEBUG_PRINTF("error building rose\n");
|
||||
assert(0);
|
||||
return nullptr;
|
||||
return bytecode_ptr<RoseEngine>(nullptr);
|
||||
}
|
||||
|
||||
dumpReportManager(ng.rm, ng.cc.grey);
|
||||
@@ -478,7 +478,7 @@ hs_database_t *dbCreate(const char *in_bytecode, size_t len, u64a platform) {
|
||||
DEBUG_PRINTF("db size %zu\n", db_len);
|
||||
DEBUG_PRINTF("db platform %llx\n", platform);
|
||||
|
||||
struct hs_database *db = (struct hs_database *)hs_database_alloc(db_len);
|
||||
struct hs_database *db = static_cast<struct hs_database *>(hs_database_alloc(db_len));
|
||||
if (hs_check_alloc(db) != HS_SUCCESS) {
|
||||
hs_database_free(db);
|
||||
return nullptr;
|
||||
@@ -492,7 +492,7 @@ hs_database_t *dbCreate(const char *in_bytecode, size_t len, u64a platform) {
|
||||
DEBUG_PRINTF("shift is %zu\n", shift);
|
||||
|
||||
db->bytecode = offsetof(struct hs_database, bytes) - shift;
|
||||
char *bytecode = (char *)db + db->bytecode;
|
||||
char *bytecode = reinterpret_cast<char *>(db) + db->bytecode;
|
||||
assert(ISALIGNED_CL(bytecode));
|
||||
|
||||
db->magic = HS_DB_MAGIC;
|
||||
@@ -525,7 +525,7 @@ struct hs_database *build(NG &ng, unsigned int *length, u8 pureFlag) {
|
||||
throw CompileError("Internal error.");
|
||||
}
|
||||
|
||||
const char *bytecode = (const char *)(rose.get());
|
||||
const char *bytecode = reinterpret_cast<const char *>(rose.get());
|
||||
const platform_t p = target_to_platform(ng.cc.target_info);
|
||||
struct hs_database *db = dbCreate(bytecode, *length, p);
|
||||
if (!db) {
|
||||
|
||||
@@ -57,15 +57,14 @@ extern const hs_compile_error_t hs_badalloc = {
|
||||
namespace ue2 {
|
||||
|
||||
hs_compile_error_t *generateCompileError(const string &err, int expression) {
|
||||
hs_compile_error_t *ret =
|
||||
(struct hs_compile_error *)hs_misc_alloc(sizeof(hs_compile_error_t));
|
||||
hs_compile_error_t *ret = static_cast<struct hs_compile_error *>(hs_misc_alloc(sizeof(hs_compile_error_t)));
|
||||
if (ret) {
|
||||
hs_error_t e = hs_check_alloc(ret);
|
||||
if (e != HS_SUCCESS) {
|
||||
hs_misc_free(ret);
|
||||
return const_cast<hs_compile_error_t *>(&hs_badalloc);
|
||||
}
|
||||
char *msg = (char *)hs_misc_alloc(err.size() + 1);
|
||||
char *msg = static_cast<char *>(hs_misc_alloc(err.size() + 1));
|
||||
if (msg) {
|
||||
e = hs_check_alloc(msg);
|
||||
if (e != HS_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user