diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 858825746..915269f19 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -102,13 +102,6 @@ static bool isVariableCopyNeeded(const Variable &var, Function::Type type) (var.valueType() && var.valueType()->type >= ValueType::Type::CHAR)); } -static bool isVcl(const Settings *settings) -{ - return std::any_of(settings->libraries.cbegin(), settings->libraries.cend(), [](const std::string& library) { - return library == "vcl"; - }); -} - static bool isVclTypeInit(const Type *type) { if (!type) @@ -141,7 +134,7 @@ void CheckClass::constructors() const bool printInconclusive = mSettings->certainty.isEnabled(Certainty::inconclusive); for (const Scope * scope : mSymbolDatabase->classAndStructScopes) { - if (isVcl(mSettings) && isVclTypeInit(scope->definedType)) + if (mSettings->hasLib("vcl") && isVclTypeInit(scope->definedType)) continue; const bool unusedTemplate = Token::simpleMatch(scope->classDef->previous(), ">"); diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 3942128c9..cb8560c50 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -116,7 +116,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, return New; } - if (mSettings_->posix()) { + if (mSettings_->hasLib("posix")) { if (Token::Match(tok2, "open|openat|creat|mkstemp|mkostemp|socket (")) { // simple sanity check of function parameters.. // TODO: Make such check for all these functions @@ -237,7 +237,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok if (tok->str() == "realloc" && Token::simpleMatch(vartok->next(), ", 0 )")) return Malloc; - if (mSettings_->posix()) { + if (mSettings_->hasLib("posix")) { if (tok->str() == "close") return Fd; if (tok->str() == "pclose") @@ -276,7 +276,7 @@ bool CheckMemoryLeak::isReopenStandardStream(const Token *tok) const bool CheckMemoryLeak::isOpenDevNull(const Token *tok) const { - if (mSettings_->posix() && tok->str() == "open" && numberOfArguments(tok) == 2) { + if (mSettings_->hasLib("posix") && tok->str() == "open" && numberOfArguments(tok) == 2) { const Token* arg = getArguments(tok).at(0); if (Token::simpleMatch(arg, "\"/dev/null\"")) return true; diff --git a/lib/settings.h b/lib/settings.h index 08f8af126..79362e4b7 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -417,9 +417,9 @@ public: */ bool isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck=false) const; - /** Is posix library specified? */ - bool posix() const { - return std::find(libraries.cbegin(), libraries.cend(), "posix") != libraries.cend(); + /** Is library specified? */ + bool hasLib(const std::string &lib) const { + return std::find(libraries.cbegin(), libraries.cend(), lib) != libraries.cend(); } /** @brief Request termination of checking */ diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index 189f23e21..49e07ab7f 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -52,6 +52,7 @@ private: settings.severity.enable(Severity::style); LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "qt.cfg"); + settings.libraries.emplace_back("qt"); TEST_CASE(testautovar1); TEST_CASE(testautovar2); diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 8fb5d6caa..a15e5cb81 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -3528,9 +3528,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); // Attempt to get size from Cfg files, no false positives if size is not specified check("void f() {\n" @@ -4083,9 +4081,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); settings.severity.enable(Severity::warning); settings.sizeof_wchar_t = 4; @@ -4225,9 +4221,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); check("void f() {\n" " char c[7];\n" @@ -4289,9 +4283,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); // formatstr.. check("void f() {\n" @@ -4403,9 +4395,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); check("void f() {\n" " char c[5];\n" @@ -5498,6 +5488,7 @@ private: Settings settings; LOAD_LIB_2(settings.library, "posix.cfg"); + settings.libraries.emplace_back("posix"); check("void f(){\n" "int pipefd[1];\n" // <-- array of two integers is needed diff --git a/test/testclass.cpp b/test/testclass.cpp index 74430452b..8f07f22c8 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -60,10 +60,8 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings0.library.load(doc); - settings1.library.load(doc); + ASSERT(settings0.library.loadxmldata(xmldata, sizeof(xmldata))); + ASSERT(settings1.library.loadxmldata(xmldata, sizeof(xmldata))); } @@ -3390,9 +3388,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); checkNoMemset("class A {\n" " std::array ints;\n" diff --git a/test/testcondition.cpp b/test/testcondition.cpp index f4813ff18..f46378a7b 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -49,6 +49,7 @@ private: PLATFORM(settings1, cppcheck::Platform::Native); LOAD_LIB_2(settings0.library, "qt.cfg"); + settings0.libraries.emplace_back("qt"); LOAD_LIB_2(settings0.library, "std.cfg"); settings0.severity.enable(Severity::style); @@ -58,11 +59,9 @@ private: "\n" " \n" ""; - tinyxml2::XMLDocument xmldoc; - xmldoc.Parse(cfg, sizeof(cfg)); + ASSERT(settings1.library.loadxmldata(cfg, sizeof(cfg))); settings1.severity.enable(Severity::style); settings1.severity.enable(Severity::warning); - settings1.library.load(xmldoc); TEST_CASE(assignAndCompare); // assignment and comparison don't match TEST_CASE(mismatchingBitAnd); // overlapping bitmasks diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 313df2d5d..7ebdd1008 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -1952,7 +1952,8 @@ private: void initvar_smartptr() { // #10237 Settings s; - s.libraries.emplace_back("std"); + // TODO: test shuld probably not pass without library + //LOAD_LIB_2(s.library, "std.cfg"); check("struct S {\n" " explicit S(const std::shared_ptr& sp) {\n" " set(*sp);\n" @@ -3589,7 +3590,9 @@ private: void uninitVarInheritClassInit() { Settings s; - s.libraries.emplace_back("vcl"); + // TODO: test should probably not pass without library + //LOAD_LIB_2(s.library, "vcl.cfg"); + //s.libraries.emplace_back("vcl"); check("class Fred: public TObject\n" "{\n" diff --git a/test/testerrorlogger.cpp b/test/testerrorlogger.cpp index 67aae00fd..7b7c778a1 100644 --- a/test/testerrorlogger.cpp +++ b/test/testerrorlogger.cpp @@ -249,7 +249,7 @@ private: " \n" ""; tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); + ASSERT(doc.Parse(xmldata, sizeof(xmldata)) == tinyxml2::XML_SUCCESS); ErrorMessage msg(doc.FirstChildElement()); ASSERT_EQUALS("errorId", msg.id); ASSERT_EQUALS(Severity::error, msg.severity); diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 9cccc61fd..26fefcd92 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -43,11 +43,11 @@ private: settings.severity.enable(Severity::performance); settings.severity.enable(Severity::portability); settings.certainty.enable(Certainty::inconclusive); - settings.libraries.emplace_back("posix"); settings.standards.c = Standards::C11; settings.standards.cpp = Standards::CPP11; LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "posix.cfg"); + settings.libraries.emplace_back("posix"); // Prohibited functions TEST_CASE(prohibitedFunctions_posix); @@ -1313,9 +1313,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings2.library.load(doc); + ASSERT(settings2.library.loadxmldata(xmldata, sizeof(xmldata))); check("void foo() {\n" " mystrcmp(a, b);\n" @@ -1468,9 +1466,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings2.library.load(doc); + ASSERT(settings2.library.loadxmldata(xmldata, sizeof(xmldata))); check("void foo() {\n" " mystrcmp(a, b);\n" diff --git a/test/testio.cpp b/test/testio.cpp index 17826b214..f72a91a06 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -39,6 +39,7 @@ private: LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "windows.cfg"); LOAD_LIB_2(settings.library, "qt.cfg"); + settings.libraries.emplace_back("qt"); TEST_CASE(coutCerrMisusage); diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 904457471..43a3c9579 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -65,9 +65,7 @@ private: "\n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); // Assign TEST_CASE(assign1); @@ -474,6 +472,7 @@ private: void assign23() { Settings s = settings; LOAD_LIB_2(settings.library, "posix.cfg"); + settings.libraries.emplace_back("posix"); check("void f() {\n" " int n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14;\n" " *&n1 = open(\"xx.log\", O_RDONLY);\n" @@ -1854,6 +1853,7 @@ private: Settings s; LOAD_LIB_2(s.library, "std.cfg"); LOAD_LIB_2(s.library, "posix.cfg"); + s.libraries.emplace_back("posix"); check("void f() {\n" " char* temp = strdup(\"temp.txt\");\n" @@ -2594,9 +2594,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settingsFunctionCall.library.load(doc); + ASSERT(settingsFunctionCall.library.loadxmldata(xmldata, sizeof(xmldata))); check("void test_func()\n" "{\n" " char * buf = malloc(4);\n" @@ -2616,9 +2614,7 @@ private: " \n" " \n" "\n"; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settingsLeakIgnore.library.load(doc); + ASSERT(settingsLeakIgnore.library.loadxmldata(xmldata, sizeof(xmldata))); check("void f() {\n" " double* a = new double[1024];\n" " SomeClass::someMethod(a);\n" diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 1ea7e7243..ba78e1e0d 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -71,12 +71,6 @@ private: TEST_CASE(loadLibErrors); } - static Library::Error readLibrary(Library& library, const char* xmldata) { - tinyxml2::XMLDocument doc; - doc.Parse(xmldata); - return library.load(doc); - } - void isCompliantValidationExpression() const { ASSERT_EQUALS(true, Library::isCompliantValidationExpression("-1")); ASSERT_EQUALS(true, Library::isCompliantValidationExpression("1")); @@ -103,7 +97,7 @@ private: // Reading an empty library file is considered to be OK const char xmldata[] = "\n"; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.functions.empty()); } @@ -121,7 +115,7 @@ private: tokenList.front()->next()->astOperand1(tokenList.front()); Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(library.functions.size(), 1U); ASSERT(library.functions.at("foo").argumentChecks.empty()); ASSERT(library.isnotnoreturn(tokenList.front())); @@ -136,7 +130,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); { TokenList tokenList(nullptr); std::istringstream istr("fred.foo(123);"); // <- wrong scope, not library function @@ -168,7 +162,7 @@ private: tokenList.createAst(); Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.isNotLibraryFunction(tokenList.front())); } @@ -182,7 +176,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); { TokenList tokenList(nullptr); @@ -237,7 +231,7 @@ private: tokenList.front()->next()->varId(1); Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.isNotLibraryFunction(tokenList.front()->next())); } @@ -254,7 +248,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(0, library.functions["foo"].argumentChecks[1].notuninit); ASSERT_EQUALS(true, library.functions["foo"].argumentChecks[2].notnull); ASSERT_EQUALS(true, library.functions["foo"].argumentChecks[3].formatstr); @@ -273,7 +267,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(0, library.functions["foo"].argumentChecks[-1].notuninit); } @@ -287,7 +281,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(0, library.functions["foo"].argumentChecks[-1].notuninit); TokenList tokenList(nullptr); @@ -313,7 +307,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); TokenList tokenList(nullptr); std::istringstream istr("foo(a,b,c,d);"); @@ -345,7 +339,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); TokenList tokenList(nullptr); std::istringstream istr("foo(a,b,c,d,e,f,g,h,i,j,k);"); @@ -487,7 +481,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); TokenList tokenList(nullptr); std::istringstream istr("foo(a,b,c,d,e);"); @@ -546,7 +540,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(library.functions.size(), 2U); ASSERT(library.functions.at("Foo::foo").argumentChecks.empty()); ASSERT(library.functions.at("bar").argumentChecks.empty()); @@ -575,7 +569,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT_EQUALS(library.functions.size(), 1U); { @@ -602,7 +596,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); { Tokenizer tokenizer(&settings, nullptr); @@ -631,7 +625,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); TokenList tokenList(nullptr); std::istringstream istr("a(); b();"); @@ -665,7 +659,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.functions.empty()); ASSERT(Library::ismemory(library.getAllocFuncInfo("CreateX"))); @@ -708,7 +702,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.functions.empty()); const Library::AllocFunc* af = library.getAllocFuncInfo("CreateX"); @@ -727,7 +721,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); ASSERT(library.functions.empty()); ASSERT(Library::isresource(library.allocId("CreateX"))); @@ -744,7 +738,7 @@ private: " \n" ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); // s8 { const struct Library::PodType * const type = library.podtype("s8"); @@ -822,7 +816,7 @@ private: ""; Library library; - ASSERT_EQUALS(true, Library::ErrorCode::OK == (readLibrary(library, xmldata)).errorcode); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); Library::Container& A = library.containers["A"]; Library::Container& B = library.containers["B"]; @@ -937,16 +931,14 @@ private: "\n" ""; Library library; - const Library::Error err = readLibrary(library, xmldata); - ASSERT_EQUALS(true, err.errorcode == Library::ErrorCode::OK); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); } { const char xmldata[] = "\n" "\n" ""; Library library; - const Library::Error err = readLibrary(library, xmldata); - ASSERT_EQUALS(true, err.errorcode == Library::ErrorCode::OK); + ASSERT(library.loadxmldata(xmldata, sizeof(xmldata))); } { const char xmldata[] = "\n" @@ -958,6 +950,12 @@ private: } } + static Library::Error readLibrary(Library& library, const char* xmldata) { + tinyxml2::XMLDocument doc; + doc.Parse(xmldata); // TODO: check result + return library.load(doc); + } + void loadLibError(const char xmldata[], Library::ErrorCode errorcode, const char* file, unsigned line) const { Library library; assertEquals(file, line, true, errorcode == readLibrary(library, xmldata).errorcode); diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 0fb93d8f3..a694a710b 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -151,6 +151,7 @@ private: void run() override { LOAD_LIB_2(settings1.library, "std.cfg"); LOAD_LIB_2(settings1.library, "posix.cfg"); + settings1.libraries.emplace_back("posix"); LOAD_LIB_2(settings2.library, "std.cfg"); TEST_CASE(realloc1); @@ -1705,6 +1706,7 @@ private: void run() override { LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "posix.cfg"); + settings.libraries.emplace_back("posix"); // testing that errors are detected TEST_CASE(err); @@ -2291,11 +2293,11 @@ private: void run() override { settings.certainty.setEnabled(Certainty::inconclusive, true); - settings.libraries.emplace_back("posix"); settings.severity.enable(Severity::warning); LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "posix.cfg"); + settings.libraries.emplace_back("posix"); // pass allocated memory to function.. TEST_CASE(functionParameter); diff --git a/test/testother.cpp b/test/testother.cpp index 9fead3abe..51dd8d801 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5891,9 +5891,7 @@ private: " \n" " \n" ""; - tinyxml2::XMLDocument doc; - doc.Parse(xmldata, sizeof(xmldata)); - settings.library.load(doc); + ASSERT(settings.library.loadxmldata(xmldata, sizeof(xmldata))); check("void foo() {\n" " if (x() || x()) {}\n" diff --git a/test/testplatform.cpp b/test/testplatform.cpp index 6b474abab..94c126fe1 100644 --- a/test/testplatform.cpp +++ b/test/testplatform.cpp @@ -45,8 +45,7 @@ private: static bool readPlatform(cppcheck::Platform& platform, const char* xmldata) { tinyxml2::XMLDocument doc; - doc.Parse(xmldata); - return platform.loadFromXmlDocument(&doc); + return (doc.Parse(xmldata) == tinyxml2::XML_SUCCESS) && platform.loadFromXmlDocument(&doc); } void empty() const { diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 8fdf1f34e..6315162c9 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -7856,10 +7856,8 @@ private: "\n" \ "\n" \ "\n" \ - ""; \ - tinyxml2::XMLDocument doc; \ - doc.Parse(xmldata, sizeof(xmldata)); \ - sF.library.load(doc); \ + ""; \ + ASSERT(sF.library.loadxmldata(xmldata, sizeof(xmldata))); \ ASSERT_EQUALS(#type, typeOf("void f() { auto x = g(); }", "x", "test.cpp", &sF)); \ } while (false) // *INDENT-OFF* diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 2c1c89a07..cc679eb1e 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -58,8 +58,11 @@ private: settings_windows.checkUnusedTemplates = true; // library=qt + LOAD_LIB_2(settings0.library, "qt.cfg"); settings0.libraries.emplace_back("qt"); + LOAD_LIB_2(settings1.library, "qt.cfg"); settings1.libraries.emplace_back("qt"); + LOAD_LIB_2(settings2.library, "qt.cfg"); settings2.libraries.emplace_back("qt"); TEST_CASE(tokenize1);