Skip to content

removed SuppressionList::Suppression::NO_LINE#8429

Open
firewave wants to merge 1 commit into
cppcheck-opensource:mainfrom
firewave:suppr-no-line
Open

removed SuppressionList::Suppression::NO_LINE#8429
firewave wants to merge 1 commit into
cppcheck-opensource:mainfrom
firewave:suppr-no-line

Conversation

@firewave

@firewave firewave commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

The suppressions were using -1 as indication that no line is used but in simplecpp 0 is used for that.

@firewave

firewave commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

This is mostly likely the reason why lines are signed in Cppcheck but unsigned in simplecpp. This will be resolved in a follow-up.

@firewave firewave force-pushed the suppr-no-line branch 5 times, most recently from 0e43d67 to c6cd63b Compare April 9, 2026 07:24
@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2026

Copy link
Copy Markdown

@firewave firewave marked this pull request as ready for review May 1, 2026 11:48
The suppressions were using `-1` as indication that no line is used but in simplecpp `0` was used for that.
Comment thread cli/cppcheckexecutor.cpp
if (s2.errorId == "unmatchedSuppression") { // TODO: handle unmatchedPolyspaceSuppression?
if ((s2.fileName.empty() || s2.fileName == "*" || s2.fileName == s.fileName) &&
(s2.lineNumber == SuppressionList::Suppression::NO_LINE || s2.lineNumber == s.lineNumber)) {
(s2.lineNumber == 0 || s2.lineNumber == s.lineNumber)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel that we should have magic number 0 to mean "NO LINE".
A constant should be used that clearly says "no line".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have no done that anywhere in the code - simplecpp or Cppcheck.

If we would add that it would need to be added in simplecpp but that might lead to having to include simplecpp.h in every file and that is certainly undesirable.

@danmar danmar Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep the constant SuppressionList::Suppression::NO_LINE but change its value from -1 to 0.

The constant is meant to be used on suppressions not tokens.

Maybe simplecpp should have some "no line" constant also. Off the top of my head I am unsure if tokens from simplecpp can have "no line"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants