Skip to content

Conversation

@chrchr-github
Copy link
Collaborator

No description provided.


out << " <suppressions>" << std::endl;
for (const Suppression &suppression : mSuppressions) {
if (!filePath.empty() && !suppression.fileName.empty() && filePath != suppression.fileName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As the suppression could contain a pattern we need to use the matching logic of the suppressions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I follow. There is only one suppression at a time, and we only care about inline suppressions.

@firewave
Copy link
Collaborator

Way to test the non-inline suppression case:

  • create two input files
  • analyze with builddir
  • provide --suppress CLI option which only matches one of the files
  • re-analyze
  • make sure only the matching file has a different hash

@firewave
Copy link
Collaborator

It is possible that unmatchedSuppression warnings could somehow be leveraged to test this - but since those are still partially broken that is not really an option.

@chrchr-github chrchr-github marked this pull request as ready for review August 15, 2025 06:57
@sonarqubecloud
Copy link

@firewave
Copy link
Collaborator

LGTM but tests requiring sleep always give me pause. But not writing at all and not modifying are actually different cases (not necessary to address here). I will try to write some tests at a later date.

Although I/we should rather work on #7079 as a priority and IMO no more builddir changes should be landed before that is in.

@chrchr-github
Copy link
Collaborator Author

LGTM but tests requiring sleep always give me pause. But not writing at all and not modifying are actually different cases (not necessary to address here). I will try to write some tests at a later date.

sleep() is not strictly required. But depending on file time granularity and execution speed, reanalysis could happen in "zero time" and would not be caught without it.
On a related note, the loop with 10 repetitions caused the test to fail ~90% of the time before the fix.

@chrchr-github
Copy link
Collaborator Author

We might want to backport this to 2.18 as well.

@firewave
Copy link
Collaborator

We might want to backport this to 2.18 as well.

Definitely.

@chrchr-github chrchr-github merged commit 4617bc2 into danmar:main Aug 19, 2025
63 checks passed
@chrchr-github chrchr-github deleted the chr_14064 branch August 19, 2025 14:31
firewave pushed a commit to firewave/cppcheck that referenced this pull request Aug 20, 2025
…suppressions (regression) (danmar#7741)

(cherry picked from commit 4617bc2)
@firewave
Copy link
Collaborator

We might want to backport this to 2.18 as well.

See #7756.

firewave added a commit that referenced this pull request Aug 22, 2025
…suppressions (regression) (#7741) (#7756)

(cherry picked from commit 4617bc2)

Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
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.

3 participants