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:
Konstantinos Margaritis
2024-05-27 12:23:02 +03:00
committed by GitHub
parent a8e43a4c0b
commit 02fc8e3b1c
78 changed files with 204 additions and 131 deletions

View File

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