Skip to content

Commit c6ad565

Browse files
committed
update state of inline suppressions if they already exist
1 parent 9fb0966 commit c6ad565

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Diff for: cli/processexecutor.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ bool ProcessExecutor::handleRead(int rpipe, unsigned int &result, const std::str
244244
suppr.isInline = true;
245245
suppr.checked = parts[1] == "1";
246246
suppr.matched = parts[2] == "1";
247-
const std::string err = mSuppressions.addSuppression(std::move(suppr));
247+
const std::string err = mSuppressions.addSuppression(suppr);
248248
if (!err.empty()) {
249+
// TODO: only update state if it doesn't exist - otherwise propagate error
250+
mSuppressions.updateSuppressionState(suppr); // TODO: check result
249251
// TODO: make this non-fatal
250-
std::cerr << "#### ThreadExecutor::handleRead(" << filename << ") adding of inline suppression failed - " << err << std::endl;
251-
std::exit(EXIT_FAILURE);
252+
//std::cerr << "#### ThreadExecutor::handleRead(" << filename << ") adding of inline suppression failed - " << err << std::endl;
253+
//std::exit(EXIT_FAILURE);
252254
}
253255
}
254256
} else if (type == PipeWriter::CHILD_END) {

Diff for: cli/threadexecutor.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ class ThreadData
130130
for (const auto& suppr : fileChecker.settings().supprs.nomsg.getSuppressions()) {
131131
// need to transfer all inline suppressions because these are used later on
132132
if (suppr.isInline) {
133-
mSuppressions.addSuppression(suppr); // TODO: check result
133+
const std::string err = mSuppressions.addSuppression(suppr);
134+
if (!err.empty()) {
135+
// TODO: only update state if it doesn't exist - otherwise propagate error
136+
mSuppressions.updateSuppressionState(suppr); // TODO: check result
137+
}
134138
continue;
135139
}
136140

Diff for: lib/cppcheck.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,11 @@ unsigned int CppCheck::check(const FileSettings &fs)
812812
{
813813
if (suppr.isInline) {
814814
// need to transfer all inline suppressions because these are used later on
815-
mSettings.supprs.nomsg.addSuppression(suppr); // TODO: check result
815+
const std::string err = mSettings.supprs.nomsg.addSuppression(suppr);
816+
if (!err.empty()) {
817+
// TODO: only update state if it doesn't exist - otherwise propagate error
818+
mSettings.supprs.nomsg.updateSuppressionState(suppr); // TODO: check result
819+
}
816820
continue;
817821
}
818822

0 commit comments

Comments
 (0)