From 6d7ec98dd691bbf118fa1bb3d6962e134a8fce63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Apr 2019 13:15:25 +0200 Subject: [PATCH 1/2] Import Project: import suppressions from gui project --- lib/importproject.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 912297839..18aa29dc3 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -985,6 +985,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti (void)ProjectVersionAttrib; std::list paths; + std::list suppressions; Settings temp; for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) { @@ -1009,11 +1010,9 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti guiProject.excludedPaths = readXmlStringList(node, IgnorePathName, IgnorePathNameAttrib); else if (strcmp(node->Name(), LibrariesElementName) == 0) guiProject.libraries = readXmlStringList(node, LibraryElementName, nullptr); - else if (strcmp(node->Name(), SuppressionsElementName) == 0) { - for (const std::string &s : readXmlStringList(node, SuppressionElementName, nullptr)) { - temp.nomsg.addSuppressionLine(s); - } - } else if (strcmp(node->Name(), PlatformElementName) == 0) + else if (strcmp(node->Name(), SuppressionsElementName) == 0) + suppressions = readXmlStringList(node, SuppressionElementName, nullptr); + else if (strcmp(node->Name(), PlatformElementName) == 0) guiProject.platform = node->GetText(); else if (strcmp(node->Name(), AnalyzeAllVsConfigsElementName) == 0) ; // FIXME: Write some warning @@ -1033,5 +1032,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings *setti settings->userUndefs = temp.userUndefs; for (const std::string &path : paths) guiProject.pathNames.push_back(path); + for (const std::string &supp : suppressions) + settings->nomsg.addSuppressionLine(supp); return true; } From 7ec8ce2ece701846d3eaee097d880ccfe8e180f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Apr 2019 13:20:23 +0200 Subject: [PATCH 2/2] --help: arguments should be written in alphabetical order --- cli/cmdlineparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 4398c66b9..5244d803d 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -937,6 +937,7 @@ void CmdLineParser::printHelp() " be considered for evaluation.\n" " --config-excludes-file=\n" " A file that contains a list of config-excludes\n" + " --doc Print a list of all available checks.\n" " --dump Dump xml data for each translation unit. The dump\n" " files have the extension .dump and contain ast,\n" " tokenlist, symboldatabase, valueflow.\n" @@ -981,7 +982,6 @@ void CmdLineParser::printHelp() " provided. Note that your operating system can modify\n" " this value, e.g. '256' can become '0'.\n" " --errorlist Print a list of all the error messages in XML format.\n" - " --doc Print a list of all available checks.\n" " --exitcode-suppressions=\n" " Used when certain messages should be displayed but\n" " should not cause a non-zero exitcode.\n"