Rename 'cppcheckID' to 'hash'

This commit is contained in:
Daniel Marjamäki 2020-07-21 11:27:03 +02:00
parent ae0ad17152
commit 4ab04db53c
14 changed files with 80 additions and 80 deletions

View File

@ -25,7 +25,7 @@
</attribute>
</optional>
<optional>
<attribute name="cppcheck-id">
<attribute name="hash">
<data type="integer">
<param name="minExclusive">1</param>
</data>

View File

@ -37,7 +37,7 @@ ErrorItem::ErrorItem()
, incomplete(false)
, inconclusive(false)
, cwe(-1)
, cppcheckId(0)
, hash(0)
{
}
@ -51,7 +51,7 @@ ErrorItem::ErrorItem(const ErrorMessage &errmsg)
, summary(QString::fromStdString(errmsg.shortMessage()))
, message(QString::fromStdString(errmsg.verboseMessage()))
, cwe(errmsg.cwe.id)
, cppcheckId(errmsg.cppcheckId)
, hash(errmsg.hash)
, symbolNames(QString::fromStdString(errmsg.symbolNames()))
{
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = errmsg.callStack.begin();
@ -88,8 +88,8 @@ QString ErrorItem::toString() const
bool ErrorItem::sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2)
{
if (errorItem1.cppcheckId || errorItem2.cppcheckId)
return errorItem1.cppcheckId == errorItem2.cppcheckId;
if (errorItem1.hash || errorItem2.hash)
return errorItem1.hash == errorItem2.hash;
// fallback
return errorItem1.errorId == errorItem2.errorId &&

View File

@ -88,7 +88,7 @@ public:
QString summary;
QString message;
int cwe;
unsigned long long cppcheckId;
unsigned long long hash;
QList<QErrorPathItem> errorPath;
QString symbolNames;
@ -115,7 +115,7 @@ public:
QString errorId;
bool incomplete;
int cwe;
unsigned long long cppcheckId;
unsigned long long hash;
bool inconclusive;
Severity::SeverityType severity;
QString summary;

View File

@ -610,8 +610,8 @@ void ProjectFile::readSuppressions(QXmlStreamReader &reader)
suppression.lineNumber = reader.attributes().value(QString(),"lineNumber").toInt();
if (reader.attributes().hasAttribute(QString(),"symbolName"))
suppression.symbolName = reader.attributes().value(QString(),"symbolName").toString().toStdString();
if (reader.attributes().hasAttribute(QString(),"cppcheck-id"))
suppression.cppcheckId = reader.attributes().value(QString(),"cppcheck-id").toULongLong();
if (reader.attributes().hasAttribute(QString(),"hash"))
suppression.hash = reader.attributes().value(QString(),"hash").toULongLong();
type = reader.readNext();
if (type == QXmlStreamReader::Characters) {
suppression.errorId = reader.text().toString().toStdString();
@ -650,8 +650,8 @@ void ProjectFile::readTagWarnings(QXmlStreamReader &reader, const QString &tag)
case QXmlStreamReader::StartElement:
// Read library-elements
if (reader.name().toString() == CppcheckXml::WarningElementName) {
std::size_t cppcheckId = reader.attributes().value(QString(), CppcheckXml::CppcheckIdAttributeName).toULongLong();
mWarningTags[cppcheckId] = tag;
std::size_t hash = reader.attributes().value(QString(), CppcheckXml::HashAttributeName).toULongLong();
mWarningTags[hash] = tag;
}
break;
@ -774,17 +774,17 @@ void ProjectFile::setVSConfigurations(const QStringList &vsConfigs)
mVsConfigurations = vsConfigs;
}
void ProjectFile::setWarningTags(std::size_t cppcheckId, QString tag)
void ProjectFile::setWarningTags(std::size_t hash, QString tag)
{
if (tag.isEmpty())
mWarningTags.erase(cppcheckId);
else if (cppcheckId > 0)
mWarningTags[cppcheckId] = tag;
mWarningTags.erase(hash);
else if (hash > 0)
mWarningTags[hash] = tag;
}
QString ProjectFile::getWarningTags(std::size_t cppcheckId) const
QString ProjectFile::getWarningTags(std::size_t hash) const
{
auto it = mWarningTags.find(cppcheckId);
auto it = mWarningTags.find(hash);
return (it != mWarningTags.end()) ? it->second : QString();
}
@ -936,8 +936,8 @@ bool ProjectFile::write(const QString &filename)
xmlWriter.writeAttribute("lineNumber", QString::number(suppression.lineNumber));
if (!suppression.symbolName.empty())
xmlWriter.writeAttribute("symbolName", QString::fromStdString(suppression.symbolName));
if (suppression.cppcheckId > 0)
xmlWriter.writeAttribute(CppcheckXml::CppcheckIdAttributeName, QString::number(suppression.cppcheckId));
if (suppression.hash > 0)
xmlWriter.writeAttribute(CppcheckXml::HashAttributeName, QString::number(suppression.hash));
if (!suppression.errorId.empty())
xmlWriter.writeCharacters(QString::fromStdString(suppression.errorId));
xmlWriter.writeEndElement();
@ -981,7 +981,7 @@ bool ProjectFile::write(const QString &filename)
for (const auto wt: mWarningTags) {
if (wt.second == tag) {
xmlWriter.writeStartElement(CppcheckXml::WarningElementName);
xmlWriter.writeAttribute(CppcheckXml::CppcheckIdAttributeName, QString::number(wt.first));
xmlWriter.writeAttribute(CppcheckXml::HashAttributeName, QString::number(wt.first));
xmlWriter.writeEndElement();
}
}

View File

@ -332,10 +332,10 @@ public:
}
/** Set tags for a warning */
void setWarningTags(std::size_t cppcheckId, QString tags);
void setWarningTags(std::size_t hash, QString tags);
/** Get tags for a warning */
QString getWarningTags(std::size_t cppcheckId) const;
QString getWarningTags(std::size_t hash) const;
/**
* @brief Write project file (to disk).

View File

@ -50,12 +50,12 @@
#include "xmlreportv2.h"
static const char COLUMN[] = "column";
static const char CPPCHECKID[] = "cppcheckId";
static const char CWE[] = "cwe";
static const char ERRORID[] = "id";
static const char FILENAME[] = "file";
static const char FILE0[] = "file0";
static const char FUNCTION[] = "function";
static const char HASH[] = "hash";
static const char HIDE[] = "hide";
static const char INCOMPLETE[] = "incomplete";
static const char INCONCLUSIVE[] = "inconclusive";
@ -187,14 +187,14 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
line.errorId = item.errorId;
line.incomplete = item.incomplete;
line.cwe = item.cwe;
line.cppcheckId = item.cppcheckId;
line.hash = item.hash;
line.inconclusive = item.inconclusive;
line.summary = item.summary;
line.message = item.message;
line.severity = item.severity;
line.sinceDate = item.sinceDate;
if (const ProjectFile *activeProject = ProjectFile::getActiveProject()) {
line.tags = activeProject->getWarningTags(item.cppcheckId);
line.tags = activeProject->getWarningTags(item.hash);
}
//Create the base item for the error and ensure it has a proper
//file item as a parent
@ -219,7 +219,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
data[ERRORID] = item.errorId;
data[INCOMPLETE] = item.incomplete;
data[CWE] = item.cwe;
data[CPPCHECKID] = item.cppcheckId;
data[HASH] = item.hash;
data[INCONCLUSIVE] = item.inconclusive;
data[FILE0] = stripPath(item.file0, true);
data[FUNCTION] = item.function;
@ -256,7 +256,7 @@ bool ResultsTree::addErrorItem(const ErrorItem &item)
child_data[ERRORID] = line.errorId;
child_data[INCOMPLETE] = line.incomplete;
child_data[CWE] = line.cwe;
child_data[CPPCHECKID] = line.cppcheckId;
child_data[HASH] = line.hash;
child_data[INCONCLUSIVE] = line.inconclusive;
child_data[SYMBOLNAMES] = item.symbolNames;
child_item->setData(QVariant(child_data));
@ -661,7 +661,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
QAction *copy = new QAction(tr("Copy"), &menu);
QAction *hide = new QAction(tr("Hide"), &menu);
QAction *hideallid = new QAction(tr("Hide all with id"), &menu);
QAction *suppressCppcheckID = new QAction(tr("Suppress cppcheck-id"), &menu);
QAction *suppresshash = new QAction(tr("Suppress hash"), &menu);
QAction *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
if (multipleSelection) {
@ -679,7 +679,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
menu.addSeparator();
menu.addAction(hide);
menu.addAction(hideallid);
menu.addAction(suppressCppcheckID);
menu.addAction(suppresshash);
if (!bughunting) {
QAction *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
menu.addAction(suppress);
@ -692,7 +692,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
connect(copy, SIGNAL(triggered()), this, SLOT(copy()));
connect(hide, SIGNAL(triggered()), this, SLOT(hideResult()));
connect(hideallid, SIGNAL(triggered()), this, SLOT(hideAllIdResult()));
connect(suppressCppcheckID, &QAction::triggered, this, &ResultsTree::suppressCppcheckID);
connect(suppresshash, &QAction::triggered, this, &ResultsTree::suppressHash);
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
const ProjectFile *currentProject = ProjectFile::getActiveProject();
@ -1066,7 +1066,7 @@ void ResultsTree::suppressSelectedIds()
emit suppressIds(selectedIds.toList());
}
void ResultsTree::suppressCppcheckID()
void ResultsTree::suppressHash()
{
if (!mSelectionModel)
return;
@ -1087,9 +1087,9 @@ void ResultsTree::suppressCppcheckID()
for (QStandardItem *item: selectedWarnings) {
QStandardItem *fileItem = item->parent();
const QVariantMap data = item->data().toMap();
if (projectFile && data.contains("cppcheckId")) {
if (projectFile && data.contains(HASH)) {
Suppressions::Suppression suppression;
suppression.cppcheckId = data[CPPCHECKID].toULongLong();
suppression.hash = data[HASH].toULongLong();
suppression.errorId = data[ERRORID].toString().toStdString();
suppression.fileName = data[FILENAME].toString().toStdString();
suppression.lineNumber = data[LINE].toInt();
@ -1132,9 +1132,9 @@ void ResultsTree::tagSelectedItems(const QString &tag)
data[TAGS] = tag;
item->setData(QVariant(data));
item->parent()->child(index.row(), COLUMN_TAGS)->setText(tag);
if (currentProject && data.contains(CPPCHECKID)) {
if (currentProject && data.contains(HASH)) {
isTagged = true;
currentProject->setWarningTags(data[CPPCHECKID].toULongLong(), tag);
currentProject->setWarningTags(data[HASH].toULongLong(), tag);
}
}
}
@ -1296,7 +1296,7 @@ void ResultsTree::readErrorItem(const QStandardItem *error, ErrorItem *item) con
item->errorId = data[ERRORID].toString();
item->incomplete = data[INCOMPLETE].toBool();
item->cwe = data[CWE].toInt();
item->cppcheckId = data[CPPCHECKID].toULongLong();
item->hash = data[HASH].toULongLong();
item->inconclusive = data[INCONCLUSIVE].toBool();
item->file0 = data[FILE0].toString();
item->sinceDate = data[SINCEDATE].toString();

View File

@ -276,8 +276,8 @@ protected slots:
/** Slot for context menu item to suppress all messages with the current message id */
void suppressSelectedIds();
/** Slot for context menu item to suppress message with cppcheck ID */
void suppressCppcheckID();
/** Slot for context menu item to suppress message with hash */
void suppressHash();
/**
* @brief Slot for context menu item to open the folder containing the current file.

View File

@ -34,7 +34,7 @@ static const QString ErrorElementName = "error";
static const QString ErrorsElementName = "errors";
static const QString LocationElementName = "location";
static const QString CWEAttribute = "cwe";
static const QString CppcheckIdAttribute = "cppcheck-id";
static const QString HashAttribute = "hash";
static const QString SinceDateAttribute = "sinceDate";
static const QString TagsAttribute = "tag";
static const QString FilenameAttribute = "file";
@ -123,8 +123,8 @@ void XmlReportV2::writeError(const ErrorItem &error)
mXmlWriter->writeAttribute(InconclusiveAttribute, "true");
if (error.cwe > 0)
mXmlWriter->writeAttribute(CWEAttribute, QString::number(error.cwe));
if (error.cppcheckId > 0)
mXmlWriter->writeAttribute(CppcheckIdAttribute, QString::number(error.cppcheckId));
if (error.hash > 0)
mXmlWriter->writeAttribute(HashAttribute, QString::number(error.hash));
if (!error.sinceDate.isEmpty())
mXmlWriter->writeAttribute(SinceDateAttribute, error.sinceDate);
if (!error.tags.isEmpty())
@ -218,8 +218,8 @@ ErrorItem XmlReportV2::readError(QXmlStreamReader *reader)
item.inconclusive = true;
if (attribs.hasAttribute(QString(), CWEAttribute))
item.cwe = attribs.value(QString(), CWEAttribute).toInt();
if (attribs.hasAttribute(QString(), CppcheckIdAttribute))
item.cppcheckId = attribs.value(QString(), CppcheckIdAttribute).toULongLong();
if (attribs.hasAttribute(QString(), HashAttribute))
item.hash = attribs.value(QString(), HashAttribute).toULongLong();
if (attribs.hasAttribute(QString(), SinceDateAttribute))
item.sinceDate = attribs.value(QString(), SinceDateAttribute).toString();
if (attribs.hasAttribute(QString(), TagsAttribute))

View File

@ -59,7 +59,7 @@ InternalError::InternalError(const Token *tok, const std::string &errorMsg, Type
}
}
static std::size_t calculateCppcheckId(const TokenList *tokenList, const std::string &msg)
static std::size_t calculateWarningHash(const TokenList *tokenList, const std::string &msg)
{
if (!tokenList)
return 0;
@ -67,7 +67,7 @@ static std::size_t calculateCppcheckId(const TokenList *tokenList, const std::st
}
ErrorMessage::ErrorMessage()
: incomplete(false), severity(Severity::none), cwe(0U), inconclusive(false), cppcheckId(0)
: incomplete(false), severity(Severity::none), cwe(0U), inconclusive(false), hash(0)
{
}
@ -79,7 +79,7 @@ ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::
severity(severity), // severity for this error message
cwe(0U),
inconclusive(inconclusive),
cppcheckId(0)
hash(0)
{
// set the summary and verbose messages
setmsg(msg);
@ -95,14 +95,14 @@ ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, const std::
severity(severity), // severity for this error message
cwe(cwe.id),
inconclusive(inconclusive),
cppcheckId(0)
hash(0)
{
// set the summary and verbose messages
setmsg(msg);
}
ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive)
: id(id), incomplete(false), severity(severity), cwe(0U), inconclusive(inconclusive), cppcheckId(0)
: id(id), incomplete(false), severity(severity), cwe(0U), inconclusive(inconclusive), hash(0)
{
// Format callstack
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {
@ -137,7 +137,7 @@ ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const Token
setmsg(msg);
cppcheckId = calculateCppcheckId(list, toString(false));
hash = calculateWarningHash(list, toString(false));
}
ErrorMessage::ErrorMessage(const ErrorPath &errorPath, const TokenList *tokenList, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, bool inconclusive)
@ -158,7 +158,7 @@ ErrorMessage::ErrorMessage(const ErrorPath &errorPath, const TokenList *tokenLis
setmsg(msg);
cppcheckId = calculateCppcheckId(tokenList, toString(false));
hash = calculateWarningHash(tokenList, toString(false));
}
ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)
@ -187,8 +187,8 @@ ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)
attr = errmsg->Attribute("verbose");
mVerboseMessage = attr ? attr : "";
attr = errmsg->Attribute("cppcheck-id");
std::istringstream(attr ? attr : "0") >> cppcheckId;
attr = errmsg->Attribute("hash");
std::istringstream(attr ? attr : "0") >> hash;
for (const tinyxml2::XMLElement *e = errmsg->FirstChildElement(); e; e = e->NextSiblingElement()) {
if (std::strcmp(e->Name(),"location")==0) {
@ -235,7 +235,7 @@ void ErrorMessage::setmsg(const std::string &msg)
Suppressions::ErrorMessage ErrorMessage::toSuppressionsErrorMessage() const
{
Suppressions::ErrorMessage ret;
ret.cppcheckId = cppcheckId;
ret.hash = hash;
ret.errorId = id;
if (!callStack.empty()) {
ret.setFileName(callStack.back().getfile(false));
@ -254,7 +254,7 @@ std::string ErrorMessage::serialize() const
oss << id.length() << " " << id;
oss << Severity::toString(severity).length() << " " << Severity::toString(severity);
oss << MathLib::toString(cwe.id).length() << " " << MathLib::toString(cwe.id);
oss << MathLib::toString(cppcheckId).length() << " " << MathLib::toString(cppcheckId);
oss << MathLib::toString(hash).length() << " " << MathLib::toString(hash);
if (inconclusive) {
const std::string text("inconclusive");
oss << text.length() << " " << text;
@ -309,7 +309,7 @@ bool ErrorMessage::deserialize(const std::string &data)
id = results[0];
severity = Severity::fromString(results[1]);
std::istringstream(results[2]) >> cwe.id;
std::istringstream(results[3]) >> cppcheckId;
std::istringstream(results[3]) >> hash;
mShortMessage = results[4];
mVerboseMessage = results[5];
@ -418,8 +418,8 @@ std::string ErrorMessage::toXML() const
printer.PushAttribute("verbose", fixInvalidChars(mVerboseMessage).c_str());
if (cwe.id)
printer.PushAttribute("cwe", cwe.id);
if (cppcheckId)
printer.PushAttribute("cppcheck-id", MathLib::toString(cppcheckId).c_str());
if (hash)
printer.PushAttribute("hash", MathLib::toString(hash).c_str());
if (inconclusive)
printer.PushAttribute("inconclusive", "true");

View File

@ -196,8 +196,8 @@ public:
CWE cwe;
bool inconclusive;
/** Warning ID */
std::size_t cppcheckId;
/** Warning hash */
std::size_t hash;
/** set short and verbose messages */
void setmsg(const std::string &msg);

View File

@ -1086,7 +1086,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti
s.fileName = joinRelativePath(path, s.fileName);
s.lineNumber = child->IntAttribute("lineNumber", Suppressions::Suppression::NO_LINE);
s.symbolName = read(child->Attribute("symbolName"), "");
std::istringstream(read(child->Attribute("cppcheck-id"), "0")) >> s.cppcheckId;
std::istringstream(read(child->Attribute("hash"), "0")) >> s.hash;
suppressions.push_back(s);
}
} else if (strcmp(node->Name(), CppcheckXml::VSConfigurationElementName) == 0)

View File

@ -164,7 +164,7 @@ namespace CppcheckXml {
const char TagWarningsElementName[] = "tag-warnings";
const char TagAttributeName[] = "tag";
const char WarningElementName[] = "warning";
const char CppcheckIdAttributeName[] = "cppcheck-id";
const char HashAttributeName[] = "hash";
const char CheckHeadersElementName[] = "check-headers";
const char CheckUnusedTemplatesElementName[] = "check-unused-templates";
const char MaxCtuDepthElementName[] = "max-ctu-depth";

View File

@ -85,7 +85,7 @@ std::string Suppressions::parseXmlFile(const char *filename)
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
for (const tinyxml2::XMLElement * e = rootnode->FirstChildElement(); e; e = e->NextSiblingElement()) {
if (std::strcmp(e->Name(), "suppress") != 0)
return "Invalid suppression xml file format, expected <suppress> element but got a <" + std::string(e->Name()) + '>';
return "Invalid suppression xml file format, expected <suppress> element but got a \"" + std::string(e->Name()) + '\"';
Suppression s;
for (const tinyxml2::XMLElement * e2 = e->FirstChildElement(); e2; e2 = e2->NextSiblingElement()) {
@ -98,10 +98,10 @@ std::string Suppressions::parseXmlFile(const char *filename)
s.lineNumber = std::atoi(text);
else if (std::strcmp(e2->Name(), "symbolName") == 0)
s.symbolName = text;
else if (*text && std::strcmp(e2->Name(), "cppcheckId") == 0)
std::istringstream(text) >> s.cppcheckId;
else if (*text && std::strcmp(e2->Name(), "hash") == 0)
std::istringstream(text) >> s.hash;
else
return "Unknown suppression element <" + std::string(e2->Name()) + ">, expected <id>/<fileName>/<lineNumber>/<symbolName>/<cppcheckId>";
return "Unknown suppression element \"" + std::string(e2->Name()) + "\", expected id/fileName/lineNumber/symbolName/hash";
}
const std::string err = addSuppression(s);
@ -206,7 +206,7 @@ std::string Suppressions::addSuppressionLine(const std::string &line)
std::string Suppressions::addSuppression(const Suppressions::Suppression &suppression)
{
// Check that errorId is valid..
if (suppression.errorId.empty() && suppression.cppcheckId == 0)
if (suppression.errorId.empty() && suppression.hash == 0)
return "Failed to add suppression. No id.";
if (suppression.errorId != "*") {
@ -273,7 +273,7 @@ bool Suppressions::Suppression::parseComment(std::string comment, std::string *e
bool Suppressions::Suppression::isSuppressed(const Suppressions::ErrorMessage &errmsg) const
{
if (cppcheckId > 0 && cppcheckId != errmsg.cppcheckId)
if (hash > 0 && hash != errmsg.hash)
return false;
if (!errorId.empty() && !matchglob(errorId, errmsg.errorId))
return false;
@ -319,8 +319,8 @@ std::string Suppressions::Suppression::getText() const
ret += " lineNumber=" + MathLib::toString(lineNumber);
if (!symbolName.empty())
ret += " symbolName=" + symbolName;
if (cppcheckId > 0)
ret += " cppcheckId=" + MathLib::toString(cppcheckId);
if (hash > 0)
ret += " hash=" + MathLib::toString(hash);
if (ret.compare(0,1," ")==0)
return ret.substr(1);
return ret;
@ -364,8 +364,8 @@ void Suppressions::dump(std::ostream & out) const
out << " lineNumber=\"" << suppression.lineNumber << '"';
if (!suppression.symbolName.empty())
out << " symbolName=\"" << ErrorLogger::toxml(suppression.symbolName) << '\"';
if (suppression.cppcheckId > 0)
out << " cppcheckId=\"" << suppression.cppcheckId << '\"';
if (suppression.hash > 0)
out << " hash=\"" << suppression.hash << '\"';
out << " />" << std::endl;
}
out << " </suppressions>" << std::endl;
@ -377,7 +377,7 @@ std::list<Suppressions::Suppression> Suppressions::getUnmatchedLocalSuppressions
for (const Suppression &s : mSuppressions) {
if (s.matched)
continue;
if (s.cppcheckId > 0)
if (s.hash > 0)
continue;
if (!unusedFunctionChecking && s.errorId == "unusedFunction")
continue;
@ -394,7 +394,7 @@ std::list<Suppressions::Suppression> Suppressions::getUnmatchedGlobalSuppression
for (const Suppression &s : mSuppressions) {
if (s.matched)
continue;
if (s.cppcheckId > 0)
if (s.hash > 0)
continue;
if (!unusedFunctionChecking && s.errorId == "unusedFunction")
continue;

View File

@ -35,7 +35,7 @@ class CPPCHECKLIB Suppressions {
public:
struct CPPCHECKLIB ErrorMessage {
std::size_t cppcheckId;
std::size_t hash;
std::string errorId;
void setFileName(const std::string &s);
const std::string &getFileName() const {
@ -49,18 +49,18 @@ public:
};
struct CPPCHECKLIB Suppression {
Suppression() : lineNumber(NO_LINE), cppcheckId(0), matched(false) {}
Suppression() : lineNumber(NO_LINE), hash(0), matched(false) {}
Suppression(const Suppression &other) {
*this = other;
}
Suppression(const std::string &id, const std::string &file, int line=NO_LINE) : errorId(id), fileName(file), lineNumber(line), cppcheckId(0), matched(false) {}
Suppression(const std::string &id, const std::string &file, int line=NO_LINE) : errorId(id), fileName(file), lineNumber(line), hash(0), matched(false) {}
Suppression & operator=(const Suppression &other) {
errorId = other.errorId;
fileName = other.fileName;
lineNumber = other.lineNumber;
symbolName = other.symbolName;
cppcheckId = other.cppcheckId;
hash = other.hash;
matched = other.matched;
return *this;
}
@ -74,8 +74,8 @@ public:
return fileName < other.fileName;
if (symbolName != other.symbolName)
return symbolName < other.symbolName;
if (cppcheckId != other.cppcheckId)
return cppcheckId < other.cppcheckId;
if (hash != other.hash)
return hash < other.hash;
return false;
}
@ -100,7 +100,7 @@ public:
std::string fileName;
int lineNumber;
std::string symbolName;
std::size_t cppcheckId;
std::size_t hash;
bool matched;
enum { NO_LINE = -1 };