Skip to content

Fix #14959 (Warning hash for token-based warnings) - #8778

Open
danmar wants to merge 2 commits into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-14959
Open

Fix #14959 (Warning hash for token-based warnings)#8778
danmar wants to merge 2 commits into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-14959

Conversation

@danmar

Copy link
Copy Markdown
Collaborator

No description provided.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces deterministic “warning hash” generation for token-based warnings by computing and emitting a hash attribute in XML output, and updates build dependencies and CLI tests accordingly.

Changes:

  • Compute and store a warning hash from token callstacks/error paths in ErrorMessage.
  • Emit the hash attribute in XML output and update CLI XML-output expectations.
  • Update Makefile dependency lists to reflect new header usage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
test/cli/other_test.pyUpdates expected XML output to include the new hash attribute.
oss-fuzz/MakefileAdds missing header dependencies for errorlogger.o in the OSS-Fuzz build.
MakefileAdds missing header dependencies for errorlogger.o in the main build.
lib/errorlogger.hDeclares ErrorMessage::calculateWarningHash helper.
lib/errorlogger.cppImplements warning hash computation and wires it into relevant constructors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadlib/errorlogger.cpp
Comment on lines +301 to +305
// hash algorithm: sdbm
// any hash algorithm can be used but it has to be the same hash on different platforms and compilers
hash = std::accumulate(hashString.cbegin(), hashString.cend(), 0, [](std::size_t hash, char c) {
return static_cast<unsigned char>(c) + (hash << 6) + (hash << 16) - hash;
});
Sign up for freeto 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

@danmar