Skip to content

Commit 072d0d5

Browse files
committed
1
1 parent 387d7d8 commit 072d0d5

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

lib/cppcheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,9 @@ void CppCheck::executeAddons(const std::vector<std::string>& files, const std::s
16181618
}
16191619
errmsg.file0 = file0;
16201620

1621+
if (obj.count("hash")>0)
1622+
errmsg.hash = obj["hash"].get<std::int64_t>();
1623+
16211624
mErrorLogger.reportErr(errmsg);
16221625
}
16231626
}

lib/errorlogger.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const std::set<std::string> ErrorLogger::mCriticalErrorIds{
5757
};
5858

5959
ErrorMessage::ErrorMessage()
60-
: severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0)
60+
: severity(Severity::none), cwe(0U), certainty(Certainty::normal)
6161
{}
6262

6363
// TODO: id and msg are swapped compared to other calls
@@ -67,8 +67,7 @@ ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1,
6767
file0(std::move(file1)),
6868
severity(severity), // severity for this error message
6969
cwe(0U),
70-
certainty(certainty),
71-
hash(0)
70+
certainty(certainty)
7271
{
7372
// set the summary and verbose messages
7473
setmsg(msg);
@@ -82,15 +81,14 @@ ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1,
8281
file0(std::move(file1)),
8382
severity(severity), // severity for this error message
8483
cwe(cwe.id),
85-
certainty(certainty),
86-
hash(0)
84+
certainty(certainty)
8785
{
8886
// set the summary and verbose messages
8987
setmsg(msg);
9088
}
9189

9290
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity severity, std::string id, const std::string& msg, Certainty certainty)
93-
: id(std::move(id)), severity(severity), cwe(0U), certainty(certainty), hash(0)
91+
: id(std::move(id)), severity(severity), cwe(0U), certainty(certainty)
9492
{
9593
// Format callstack
9694
for (auto it = callstack.cbegin(); it != callstack.cend(); ++it) {
@@ -125,7 +123,7 @@ ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const Token
125123

126124
setmsg(msg);
127125

128-
hash = 0; // calculateWarningHash(list, hashWarning.str());
126+
// hash = calculateWarningHash(list, hashWarning.str());
129127
}
130128

131129
ErrorMessage::ErrorMessage(ErrorPath errorPath, const TokenList *tokenList, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
@@ -158,7 +156,7 @@ ErrorMessage::ErrorMessage(ErrorPath errorPath, const TokenList *tokenList, Seve
158156

159157
setmsg(msg);
160158

161-
hash = 0; // calculateWarningHash(tokenList, hashWarning.str());
159+
// hash = calculateWarningHash(tokenList, hashWarning.str());
162160
}
163161

164162
ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)

lib/errorlogger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class CPPCHECKLIB ErrorMessage {
179179
std::string guideline;
180180

181181
/** Warning hash */
182-
std::size_t hash;
182+
std::size_t hash{};
183183

184184
/** set short and verbose messages */
185185
void setmsg(const std::string &msg);

0 commit comments

Comments
 (0)