mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
Fix/Suppress remaining Cppcheck warnings (#291)
Fix/suppress the following cppcheck warnings: * arithOperationsOnVoidPointer * uninitMember * const* * shadowVariable * assignmentIntegerToAddress * containerOutOfBounds * pointer-related warnings in Ragel source * missingOverride * memleak * knownConditionTrueFalse * noExplicitConstructor * invalidPrintfArgType_sint * useStlAlgorithm * cstyleCast * clarifyCondition * VSX-related cstyleCast * unsignedLessThanZero Furthermore, we added a suppression list to be used, which also includes the following: * missingIncludeSystem * missingInclude * unmatchedSuppression
This commit is contained in:
committed by
GitHub
parent
cebc6541c1
commit
c837925087
@@ -55,7 +55,7 @@ struct CompileCHStats {
|
||||
class EngineCHContext : public EngineContext{
|
||||
public:
|
||||
explicit EngineCHContext(const ch_database_t *db);
|
||||
~EngineCHContext();
|
||||
virtual ~EngineCHContext() override;
|
||||
|
||||
ch_scratch_t *scratch = nullptr;
|
||||
};
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
class EngineChimera : public Engine {
|
||||
public:
|
||||
explicit EngineChimera(ch_database_t *db, CompileCHStats cs);
|
||||
~EngineChimera();
|
||||
virtual ~EngineChimera() override;
|
||||
|
||||
std::unique_ptr<EngineContext> makeContext() const override;
|
||||
|
||||
|
@@ -56,7 +56,7 @@ struct CompileHSStats {
|
||||
class EngineHSContext : public EngineContext {
|
||||
public:
|
||||
explicit EngineHSContext(const hs_database_t *db);
|
||||
~EngineHSContext();
|
||||
virtual ~EngineHSContext() override;
|
||||
|
||||
hs_scratch_t *scratch = nullptr;
|
||||
};
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
/** Streaming mode scans have persistent stream state associated with them. */
|
||||
class EngineHSStream : public EngineStream {
|
||||
public:
|
||||
~EngineHSStream();
|
||||
virtual ~EngineHSStream() override;
|
||||
hs_stream_t *id = nullptr;
|
||||
EngineHSContext *ctx = nullptr;
|
||||
};
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
class EngineHyperscan : public Engine {
|
||||
public:
|
||||
explicit EngineHyperscan(hs_database_t *db, CompileHSStats cs);
|
||||
~EngineHyperscan();
|
||||
virtual ~EngineHyperscan() override;
|
||||
|
||||
std::unique_ptr<EngineContext> makeContext() const override;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ struct CompilePCREStats {
|
||||
class EnginePCREContext : public EngineContext{
|
||||
public:
|
||||
explicit EnginePCREContext(int capture_cnt);
|
||||
~EnginePCREContext();
|
||||
virtual ~EnginePCREContext() override;
|
||||
|
||||
int *ovec = nullptr;
|
||||
};
|
||||
@@ -72,7 +72,7 @@ class EnginePCRE : public Engine {
|
||||
public:
|
||||
explicit EnginePCRE(std::vector<std::unique_ptr<PcreDB>> dbs_in,
|
||||
CompilePCREStats cs, int capture_cnt_in);
|
||||
~EnginePCRE();
|
||||
virtual ~EnginePCRE() override;
|
||||
|
||||
std::unique_ptr<EngineContext> makeContext() const override;
|
||||
|
||||
|
@@ -759,11 +759,9 @@ void displayResults(const vector<unique_ptr<ThreadContext>> &threads,
|
||||
|
||||
// Sanity check: all of our results should have the same match count.
|
||||
for (const auto &t : threads) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
if (!all_of(begin(t->results), end(t->results),
|
||||
[&matchesPerRun](const ResultEntry &e) {
|
||||
if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
|
||||
return e.matches == matchesPerRun;
|
||||
})) {
|
||||
})) { // cppcheck-suppress useStlAlgorithm
|
||||
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
|
||||
break;
|
||||
}
|
||||
@@ -816,11 +814,9 @@ void displayCsvResults(const vector<unique_ptr<ThreadContext>> &threads,
|
||||
|
||||
// Sanity check: all of our results should have the same match count.
|
||||
for (const auto &t : threads) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
if (!all_of(begin(t->results), end(t->results),
|
||||
[&matchesPerRun](const ResultEntry &e) {
|
||||
if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
|
||||
return e.matches == matchesPerRun;
|
||||
})) {
|
||||
})) { // cppcheck-suppress useStlAlgorithm
|
||||
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
|
||||
break;
|
||||
}
|
||||
@@ -871,11 +867,9 @@ void sqlResults(const vector<unique_ptr<ThreadContext>> &threads,
|
||||
|
||||
// Sanity check: all of our results should have the same match count.
|
||||
for (const auto &t : threads) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
if (!all_of(begin(t->results), end(t->results),
|
||||
[&matchesPerRun](const ResultEntry &e) {
|
||||
if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
|
||||
return e.matches == matchesPerRun;
|
||||
})) {
|
||||
})) { // cppcheck-suppress useStlAlgorithm
|
||||
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
|
||||
break;
|
||||
}
|
||||
@@ -963,6 +957,7 @@ void runBenchmark(const Engine &db,
|
||||
|
||||
for (unsigned i = 0; i < numThreads; i++) {
|
||||
auto t = makeThreadContext(db, corpus_blocks, i, sync_barrier);
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
int core = useAffinity ? (int)threadCores[i] : -1;
|
||||
if (!t->start(core)) {
|
||||
printf("Unable to start processing thread %u\n", i);
|
||||
|
Reference in New Issue
Block a user