@@ -165,7 +165,7 @@ void ImportProject::fsSetIncludePaths(FileSettings& fs, const std::string &basep
165165 }
166166}
167167
168- ImportProject::Type ImportProject::import (const std::string &filename, Settings *settings, Suppressions *supprs)
168+ ImportProject::Type ImportProject::import (const std::string &filename, Settings *settings, Suppressions *supprs, bool premium )
169169{
170170 std::ifstream fin (filename);
171171 if (!fin.is_open ())
@@ -201,7 +201,7 @@ ImportProject::Type ImportProject::import(const std::string &filename, Settings
201201 return ImportProject::Type::BORLAND;
202202 }
203203 } else if (settings && supprs && endsWith (filename, " .cppcheck" )) {
204- if (importCppcheckGuiProject (fin, *settings, *supprs)) {
204+ if (importCppcheckGuiProject (fin, *settings, *supprs, premium )) {
205205 setRelativePaths (filename);
206206 return ImportProject::Type::CPPCHECK_GUI;
207207 }
@@ -1287,7 +1287,7 @@ static std::string istream_to_string(std::istream &istr)
12871287 return std::string (std::istreambuf_iterator<char >(istr), eos);
12881288}
12891289
1290- bool ImportProject::importCppcheckGuiProject (std::istream &istr, Settings &settings, Suppressions &supprs)
1290+ bool ImportProject::importCppcheckGuiProject (std::istream &istr, Settings &settings, Suppressions &supprs, bool premium )
12911291{
12921292 tinyxml2::XMLDocument doc;
12931293 const std::string xmldata = istream_to_string (istr);
@@ -1371,6 +1371,13 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings &setti
13711371 else if (strcmp (name, CppcheckXml::AddonsElementName) == 0 ) {
13721372 const auto & addons = readXmlStringList (node, " " , CppcheckXml::AddonElementName, nullptr );
13731373 temp.addons .insert (addons.cbegin (), addons.cend ());
1374+ if (premium) {
1375+ auto it = temp.addons .find (" misra" );
1376+ if (it != temp.addons .end ()) {
1377+ temp.addons .erase (it);
1378+ temp.premiumArgs += " --misra-c-2012" ;
1379+ }
1380+ }
13741381 }
13751382 else if (strcmp (name, CppcheckXml::TagsElementName) == 0 )
13761383 node->Attribute (CppcheckXml::TagElementName); // FIXME: Write some warning
0 commit comments