Skip to content

fixed #14638 - report errors for invalid suppression lines#8404

Open
firewave wants to merge 3 commits intodanmar:mainfrom
firewave:suppr-invalid
Open

fixed #14638 - report errors for invalid suppression lines#8404
firewave wants to merge 3 commits intodanmar:mainfrom
firewave:suppr-invalid

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Apr 2, 2026

No description provided.

Comment on lines -239 to -244
try {
std::istringstream istr1(suppression.fileName.substr(pos+1));
istr1 >> suppression.lineNumber;
} catch (...) {
suppression.lineNumber = SuppressionList::Suppression::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.

The try-catch did nothing because the stream was not set to throw exceptions.

}

suppression.fileName = Path::simplifyPath(suppression.fileName);
// TODO: make this optional - do we even encounter this in production code?
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.

Lines with newlines can/are not being supported via suppression files and the --suppress option so we should disable support in those cases. After that there is not much left which parses lines.

I will look further into this in a follow-up.

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.

They are used in the IPC data and could be used in cppcheck.cfg. In all other cases we should be able to disable this.

Copy link
Copy Markdown
Collaborator Author

@firewave firewave Apr 3, 2026

Choose a reason for hiding this comment

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

The newlines were only recently introduced in #8169 which is a very unfortunate change. It would make more sense to preserve the previous : separator and make the additional fields separated by something like , or ;.

@firewave firewave force-pushed the suppr-invalid branch 2 times, most recently from 01632ab to 47b819c Compare April 2, 2026 09:42
@firewave firewave marked this pull request as ready for review April 2, 2026 09:42
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

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