Skip to content

Commit db4a490

Browse files
committed
ProcessExecutor: make transferred back inline suppressions actually inline
1 parent 021dd10 commit db4a490

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

cli/processexecutor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ bool ProcessExecutor::handleRead(int rpipe, unsigned int &result, const std::str
240240
std::cerr << "#### ThreadExecutor::handleRead(" << filename << ") adding of inline suppression failed - insufficient data" << std::endl;
241241
std::exit(EXIT_FAILURE);
242242
}
243-
const std::string err = mSuppressions.addSuppressionLine(parts[0], parts[1] == "1", parts[2] == "1");
243+
const std::string err = mSuppressions.addSuppressionLine(parts[0], true, parts[1] == "1", parts[2] == "1");
244244
if (!err.empty()) {
245245
// TODO: make this non-fatal
246246
std::cerr << "#### ThreadExecutor::handleRead(" << filename << ") adding of inline suppression failed - " << err << std::endl;

lib/suppressions.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ std::vector<SuppressionList::Suppression> SuppressionList::parseMultiSuppressCom
204204
return suppressions;
205205
}
206206

207-
std::string SuppressionList::addSuppressionLine(const std::string &line, bool checked, bool matched)
207+
std::string SuppressionList::addSuppressionLine(const std::string &line, bool isInline, bool checked, bool matched)
208208
{
209209
std::istringstream lineStream;
210210
SuppressionList::Suppression suppression;
@@ -248,6 +248,7 @@ std::string SuppressionList::addSuppressionLine(const std::string &line, bool ch
248248
}
249249

250250
suppression.fileName = Path::simplifyPath(suppression.fileName);
251+
suppression.isInline = isInline;
251252
suppression.checked = checked;
252253
suppression.matched = matched;
253254

lib/suppressions.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,12 @@ class CPPCHECKLIB SuppressionList {
180180
/**
181181
* @brief Don't show the given error.
182182
* @param line Description of error to suppress (in id:file:line format).
183+
* @param isInline Indicates if it is an inline suppression.
183184
* @param checked The initial checked state.
184185
* @param matched The initial matched state.
185186
* @return error message. empty upon success
186187
*/
187-
std::string addSuppressionLine(const std::string &line, bool checked = false, bool matched = false);
188+
std::string addSuppressionLine(const std::string &line, bool isInline = false, bool checked = false, bool matched = false);
188189

189190
/**
190191
* @brief Don't show this error. File and/or line are optional. In which case

0 commit comments

Comments
 (0)