From 1442c51633d6db565533027c320c3bd87bfaddc1 Mon Sep 17 00:00:00 2001 From: Steve Grubb Date: Sat, 7 Dec 2019 14:21:58 -0500 Subject: [PATCH] New upstream release 1.89 --- .gitignore | 1 + 1939.patch | 154 ------------------------------- 1943.patch | 100 -------------------- cppcheck-1.88-translations.patch | 39 -------- cppcheck-1.89-manual.patch | 12 +++ cppcheck-1.89-translations.patch | 32 +++++++ cppcheck.spec | 21 ++--- sources | 2 +- 8 files changed, 56 insertions(+), 305 deletions(-) delete mode 100644 1939.patch delete mode 100644 1943.patch delete mode 100644 cppcheck-1.88-translations.patch create mode 100644 cppcheck-1.89-manual.patch create mode 100644 cppcheck-1.89-translations.patch diff --git a/.gitignore b/.gitignore index 9fc15b4..04554ce 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ cppcheck-1.44.tar.bz2 /cppcheck-1.86.tar.gz /cppcheck-1.87.tar.gz /cppcheck-1.88.tar.gz +/cppcheck-1.89.tar.gz diff --git a/1939.patch b/1939.patch deleted file mode 100644 index cd35053..0000000 --- a/1939.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 025129663032ab6a2c12e529a0a1a96aeca10db7 Mon Sep 17 00:00:00 2001 -From: Robert Reif -Date: Sun, 30 Jun 2019 18:00:28 -0400 -Subject: [PATCH] template simplifier: consistently handle templates with no - arguments - -this fixes daca boost1.67 crashes ---- - lib/templatesimplifier.cpp | 20 ++++++++++---------- - test/testsimplifytemplate.cpp | 30 ++++++++++++++++++++++++++++++ - 2 files changed, 40 insertions(+), 10 deletions(-) - -diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp -index 4a121e642b..0e0423691f 100644 ---- a/lib/templatesimplifier.cpp -+++ b/lib/templatesimplifier.cpp -@@ -1048,7 +1048,7 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration) - continue; - } - -- if (tok->str() == "<" && templateParameters(tok)) -+ if (tok->str() == "<" && (tok->strAt(1) == ">" || templateParameters(tok))) - ++templateParmDepth; - - // end of template parameters? -@@ -1101,7 +1101,7 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration) - instantiationArgs[index].push_back(tok1); - tok1 = tok1->next(); - } while (tok1 && tok1 != endLink); -- } else if (tok1->str() == "<") { -+ } else if (tok1->str() == "<" && (tok1->strAt(1) == ">" || templateParameters(tok1))) { - const Token *endLink = tok1->findClosingBracket(); - do { - instantiationArgs[index].push_back(tok1); -@@ -1134,7 +1134,7 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration) - const Token *from = (*it)->next(); - std::stack links; - while (from && (!links.empty() || indentlevel || !Token::Match(from, ",|>"))) { -- if (from->str() == "<") -+ if (from->str() == "<" && (from->strAt(1) == ">" || templateParameters(from))) - ++indentlevel; - else if (from->str() == ">") - --indentlevel; -@@ -1181,7 +1181,7 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration) - } - if (Token::Match(tok2, "(|{|[")) - tok2 = tok2->link(); -- else if (Token::Match(tok2, "%type% <") && templateParameters(tok2->next())) { -+ else if (Token::Match(tok2, "%type% <") && (tok2->strAt(2) == ">" || templateParameters(tok2->next()))) { - std::list::iterator ti = std::find_if(mTemplateInstantiations.begin(), - mTemplateInstantiations.end(), - FindToken(tok2)); -@@ -1346,7 +1346,7 @@ bool TemplateSimplifier::instantiateMatch(const Token *instance, const std::size - const Token *tok = instance; - unsigned int indentlevel = 0; - for (tok = instance; tok && (tok->str() != ">" || indentlevel > 0); tok = tok->next()) { -- if (Token::Match(tok, "<|,|(|:: %name% <") && templateParameters(tok->tokAt(2)) > 0) -+ if (Token::Match(tok, "<|,|(|:: %name% <") && (tok->strAt(3) == ">" || templateParameters(tok->tokAt(2)))) - ++indentlevel; - if (indentlevel > 0 && tok->str() == ">") - --indentlevel; -@@ -1637,7 +1637,7 @@ void TemplateSimplifier::expandTemplate( - typetok = typetok->tokAt(2); - continue; - } -- if (Token::Match(typetok, "%name% <") && templateParameters(typetok->next()) > 0) -+ if (Token::Match(typetok, "%name% <") && (typetok->strAt(2) == ">" || templateParameters(typetok->next()))) - ++typeindentlevel; - else if (typeindentlevel > 0 && typetok->str() == ">") - --typeindentlevel; -@@ -1859,7 +1859,7 @@ void TemplateSimplifier::expandTemplate( - if (Token::simpleMatch(typetok, ". . .")) { - typetok = typetok->tokAt(2); - } else { -- if (Token::Match(typetok, "%name% <") && templateParameters(typetok->next()) > 0) -+ if (Token::Match(typetok, "%name% <") && (typetok->strAt(2) == ">" || templateParameters(typetok->next()))) - ++typeindentlevel; - else if (typeindentlevel > 0 && typetok->str() == ">") - --typeindentlevel; -@@ -1939,7 +1939,7 @@ void TemplateSimplifier::expandTemplate( - typetok = typetok->tokAt(2); - continue; - } -- if (Token::Match(typetok, "%name% <") && templateParameters(typetok->next()) > 0) -+ if (Token::Match(typetok, "%name% <") && (typetok->strAt(2) == ">" || templateParameters(typetok->next()))) - ++typeindentlevel; - else if (typeindentlevel > 0 && typetok->str() == ">") - --typeindentlevel; -@@ -2710,7 +2710,7 @@ std::string TemplateSimplifier::getNewName( - typeForNewName.clear(); - break; - } -- if (Token::Match(tok3->tokAt(-2), "<|,|:: %name% <") && templateParameters(tok3) > 0) -+ if (Token::Match(tok3->tokAt(-2), "<|,|:: %name% <") && (tok3->strAt(1) == ">" || templateParameters(tok3))) - ++indentlevel; - else if (indentlevel > 0 && Token::Match(tok3, "> [,>]")) - --indentlevel; -@@ -2975,7 +2975,7 @@ void TemplateSimplifier::replaceTemplateUsage( - const Token *typetok = (!mTypesUsedInTemplateInstantiation.empty()) ? mTypesUsedInTemplateInstantiation[0].token : nullptr; - unsigned int indentlevel2 = 0; // indentlevel for tokgt - while (tok2 != endToken && (indentlevel2 > 0 || tok2->str() != ">")) { -- if (tok2->str() == "<" && templateParameters(tok2) > 0) -+ if (tok2->str() == "<" && (tok2->strAt(1) == ">" || templateParameters(tok2))) - ++indentlevel2; - else if (indentlevel2 > 0 && Token::Match(tok2, "> [,>]")) - --indentlevel2; -diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp -index c1b3214e2d..bcfcebd03c 100644 ---- a/test/testsimplifytemplate.cpp -+++ b/test/testsimplifytemplate.cpp -@@ -157,6 +157,7 @@ class TestSimplifyTemplate : public TestFixture { - TEST_CASE(template117); - TEST_CASE(template118); - TEST_CASE(template119); // #9186 -+ TEST_CASE(template120); - TEST_CASE(template_specialization_1); // #7868 - template specialization template struct S> {..}; - TEST_CASE(template_specialization_2); // #7868 - template specialization template struct S> {..}; - TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template) -@@ -2819,6 +2820,35 @@ class TestSimplifyTemplate : public TestFixture { - } - } - -+ void template120() { -+ const char code[] = "template\n" -+ "struct lambda_context {\n" -+ " template struct result;\n" -+ " template\n" -+ " struct result : at {};\n" -+ "};\n" -+ "template\n" -+ "struct lambda {\n" -+ " template struct result;\n" -+ " template\n" -+ " struct result : lambda_context > {};\n" -+ "};\n" -+ "lambda l;"; -+ const char exp[] = "template < typename Tuple > " -+ "struct lambda_context { " -+ "template < typename Sig > struct result ; " -+ "template < typename This , typename I > " -+ "struct result < This ( terminal , placeholder ) > : at < Tuple , I > { } ; " -+ "} ; " -+ "struct lambda ; " -+ "lambda l ; struct lambda { " -+ "template < typename Sig > struct result ; " -+ "template < typename This > " -+ "struct result < This ( ) > : lambda_context < tuple < > > { } ; " -+ "} ;"; -+ ASSERT_EQUALS(exp, tok(code)); -+ } -+ - void template_specialization_1() { // #7868 - template specialization template struct S> {..}; - const char code[] = "template struct C {};\n" - "template struct S {a};\n" diff --git a/1943.patch b/1943.patch deleted file mode 100644 index 42af4f8..0000000 --- a/1943.patch +++ /dev/null @@ -1,100 +0,0 @@ -From e1f980c0e98540cdf0f4210c71dbd7f2d916abe7 Mon Sep 17 00:00:00 2001 -From: Robert Reif -Date: Mon, 1 Jul 2019 19:43:23 -0400 -Subject: [PATCH] Fixed #9193 (functionStatic false positive (inconclusive)) - ---- - lib/templatesimplifier.cpp | 4 +++- - test/testclass.cpp | 15 +++++++++++++++ - test/testsimplifytemplate.cpp | 11 +++++++++++ - 3 files changed, 29 insertions(+), 1 deletion(-) - -diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp -index 0e0423691f..893849743a 100644 ---- a/lib/templatesimplifier.cpp -+++ b/lib/templatesimplifier.cpp -@@ -1094,19 +1094,21 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration) - continue; - if (end != instantiation.token->tokAt(2)) - instantiationArgs.resize(1); -- for (const Token *tok1 = instantiation.token->tokAt(2); tok1 && tok1!= end; tok1 = tok1->next()) { -+ for (const Token *tok1 = instantiation.token->tokAt(2); tok1 && tok1 != end; tok1 = tok1->next()) { - if (tok1->link() && Token::Match(tok1, "{|(|[")) { - const Token *endLink = tok1->link(); - do { - instantiationArgs[index].push_back(tok1); - tok1 = tok1->next(); - } while (tok1 && tok1 != endLink); -+ instantiationArgs[index].push_back(tok1); - } else if (tok1->str() == "<" && (tok1->strAt(1) == ">" || templateParameters(tok1))) { - const Token *endLink = tok1->findClosingBracket(); - do { - instantiationArgs[index].push_back(tok1); - tok1 = tok1->next(); - } while (tok1 && tok1 != endLink); -+ instantiationArgs[index].push_back(tok1); - } else if (tok1->str() == ",") { - ++index; - instantiationArgs.resize(index + 1); -diff --git a/test/testclass.cpp b/test/testclass.cpp -index f0ac9cc747..0e0a86d198 100644 ---- a/test/testclass.cpp -+++ b/test/testclass.cpp -@@ -174,6 +174,7 @@ class TestClass : public TestFixture { - TEST_CASE(const64); // ticket #6268 - TEST_CASE(const65); // ticket #8693 - TEST_CASE(const66); // ticket #7714 -+ TEST_CASE(const67); // ticket #9193 - TEST_CASE(const_handleDefaultParameters); - TEST_CASE(const_passThisToMemberOfOtherClass); - TEST_CASE(assigningPointerToPointerIsNotAConstOperation); -@@ -5661,6 +5662,20 @@ class TestClass : public TestFixture { - ASSERT_EQUALS("", errout.str()); - } - -+ void const67() { // #9193 -+ checkConst("template >\n" -+ "class TestList {\n" -+ "public:\n" -+ " LIST_T m_list;\n" -+ "};\n" -+ "class Test {\n" -+ "public:\n" -+ " const std::list>& get() { return m_test.m_list; }\n" -+ " TestList> m_test;\n" -+ "};\n"); -+ ASSERT_EQUALS("[test.cpp:8]: (style, inconclusive) Technically the member function 'Test::get' can be const.\n", errout.str()); -+ } -+ - void const_handleDefaultParameters() { - checkConst("struct Foo {\n" - " void foo1(int i, int j = 0) {\n" -diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp -index bcfcebd03c..337391571e 100644 ---- a/test/testsimplifytemplate.cpp -+++ b/test/testsimplifytemplate.cpp -@@ -158,6 +158,7 @@ class TestSimplifyTemplate : public TestFixture { - TEST_CASE(template118); - TEST_CASE(template119); // #9186 - TEST_CASE(template120); -+ TEST_CASE(template121); // #9193 - TEST_CASE(template_specialization_1); // #7868 - template specialization template struct S> {..}; - TEST_CASE(template_specialization_2); // #7868 - template specialization template struct S> {..}; - TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template) -@@ -2849,6 +2850,16 @@ class TestSimplifyTemplate : public TestFixture { - ASSERT_EQUALS(exp, tok(code)); - } - -+ void template121() { // #9193 -+ const char code[] = "template >\n" -+ "class TestList { };\n" -+ "TestList> m_test;"; -+ const char exp[] = "class TestList,std::list>> ; " -+ "TestList,std::list>> m_test ; " -+ "class TestList,std::list>> { } ;"; -+ ASSERT_EQUALS(exp, tok(code)); -+ } -+ - void template_specialization_1() { // #7868 - template specialization template struct S> {..}; - const char code[] = "template struct C {};\n" - "template struct S {a};\n" diff --git a/cppcheck-1.88-translations.patch b/cppcheck-1.88-translations.patch deleted file mode 100644 index 70844c4..0000000 --- a/cppcheck-1.88-translations.patch +++ /dev/null @@ -1,39 +0,0 @@ -Only in cppcheck-1.88: .astylerc -Only in cppcheck-1.88: .codacy.yml -Only in cppcheck-1.88: .gitignore -diff -urp cppcheck-1.88.orig/gui/CMakeLists.txt cppcheck-1.88/gui/CMakeLists.txt ---- cppcheck-1.88.orig/gui/CMakeLists.txt 2019-07-01 20:46:32.662721323 -0400 -+++ cppcheck-1.88/gui/CMakeLists.txt 2019-07-01 20:48:29.298708807 -0400 -@@ -30,7 +30,7 @@ if (BUILD_GUI) - endif() - - install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) -- install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) -+ install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang COMPONENT applications) - - install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) - -diff -urp cppcheck-1.88.orig/gui/translationhandler.cpp cppcheck-1.88/gui/translationhandler.cpp ---- cppcheck-1.88.orig/gui/translationhandler.cpp 2019-06-29 03:51:25.000000000 -0400 -+++ cppcheck-1.88/gui/translationhandler.cpp 2019-07-01 20:49:18.750703500 -0400 -@@ -116,15 +116,7 @@ bool TranslationHandler::setLanguage(con - if (datadir.isEmpty()) - datadir = appPath; - -- QString translationFile; -- if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm")) -- translationFile = datadir + "/lang/" + mTranslations[index].mFilename + ".qm"; -- -- else if (QFile::exists(datadir + "/" + mTranslations[index].mFilename + ".qm")) -- translationFile = datadir + "/" + mTranslations[index].mFilename + ".qm"; -- -- else -- translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm"; -+ QString translationFile("/usr/share/CppCheck/lang/" + mTranslations[index].mFilename + ".qm"); - - if (!mTranslator->load(translationFile) && !failure) { - //If it failed, lets check if the default file exists -Only in cppcheck-1.88: .mailmap -Only in cppcheck-1.88: .travis_llvmcheck_suppressions -Only in cppcheck-1.88: .travis_suppressions -Only in cppcheck-1.88: .travis.yml diff --git a/cppcheck-1.89-manual.patch b/cppcheck-1.89-manual.patch new file mode 100644 index 0000000..adfa23f --- /dev/null +++ b/cppcheck-1.89-manual.patch @@ -0,0 +1,12 @@ +diff -urp cppcheck-1.89.orig/man/manual.docbook cppcheck-1.89/man/manual.docbook +--- cppcheck-1.89.orig/man/manual.docbook 2019-09-01 09:01:12.000000000 -0400 ++++ cppcheck-1.89/man/manual.docbook 2019-12-07 14:04:54.363409384 -0500 +@@ -1217,7 +1217,7 @@ Checking pen1.c... + </resource> + </def> + +- Functions that reallocate memory can be configured using a realloc tag. The input argument which points to the memory that shall be reallocated can also be configured (the default is the first argument). As an example, here is a configuration file for the fopen, freopen and fclose functions from the c standard library: ++ Functions that reallocate memory can be configured using a realloc tag. The input argument which points to the memory that shall be reallocated can also be configured (the default is the first argument). As an example, here is a configuration file for the fopen, freopen and fclose functions from the c standard library: + + <?xml version="1.0"?> + <def> diff --git a/cppcheck-1.89-translations.patch b/cppcheck-1.89-translations.patch new file mode 100644 index 0000000..1ba2604 --- /dev/null +++ b/cppcheck-1.89-translations.patch @@ -0,0 +1,32 @@ +diff -urp cppcheck-1.89.orig/gui/CMakeLists.txt cppcheck-1.89/gui/CMakeLists.txt +--- cppcheck-1.89.orig/gui/CMakeLists.txt 2019-12-07 13:41:32.651559443 -0500 ++++ cppcheck-1.89/gui/CMakeLists.txt 2019-12-07 13:45:16.037535529 -0500 +@@ -30,7 +30,7 @@ if (BUILD_GUI) + endif() + + install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) +- install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) ++ install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang COMPONENT applications) + + install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + +diff -urp cppcheck-1.89.orig/gui/translationhandler.cpp cppcheck-1.89/gui/translationhandler.cpp +--- cppcheck-1.89.orig/gui/translationhandler.cpp 2019-09-01 09:01:12.000000000 -0400 ++++ cppcheck-1.89/gui/translationhandler.cpp 2019-12-07 13:46:47.085525782 -0500 +@@ -116,15 +116,7 @@ bool TranslationHandler::setLanguage(con + if (datadir.isEmpty()) + datadir = appPath; + +- QString translationFile; +- if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm")) +- translationFile = datadir + "/lang/" + mTranslations[index].mFilename + ".qm"; +- +- else if (QFile::exists(datadir + "/" + mTranslations[index].mFilename + ".qm")) +- translationFile = datadir + "/" + mTranslations[index].mFilename + ".qm"; +- +- else +- translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm"; ++ QString translationFile("/usr/share/CppCheck/lang/" + mTranslations[index].mFilename + ".qm"); + + if (!mTranslator->load(translationFile) && !failure) { + //If it failed, lets check if the default file exists diff --git a/cppcheck.spec b/cppcheck.spec index d3ab5d7..4731817 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -2,8 +2,8 @@ %global gui 1 Name: cppcheck -Version: 1.88 -Release: 5%{?dist} +Version: 1.89 +Release: 1%{?dist} Summary: Tool for static C/C++ code analysis License: GPLv3+ URL: http://cppcheck.wiki.sourceforge.net/ @@ -12,16 +12,13 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar. # Use system tinyxml2 Patch0: cppcheck-1.88-tinyxml.patch # Fix location of translations -Patch1: cppcheck-1.88-translations.patch +Patch1: cppcheck-1.89-translations.patch # Set location of config files Patch2: cppcheck-1.87-cfgdir.patch # Select python3 explicitly Patch3: cppcheck-1.88-htmlreport-python3.patch - -# BZ #1733663 -Patch4: https://github.com/danmar/cppcheck/pull/1939.patch -# BZ #1733663 -Patch5: https://github.com/danmar/cppcheck/pull/1943.patch +# Fixup missing in manual +Patch4: cppcheck-1.89-manual.patch BuildRequires: gcc-c++ BuildRequires: pcre-devel @@ -80,8 +77,7 @@ from xml files first generated using cppcheck. %patch1 -p1 -b .translations %patch2 -p1 -b .cfgdir %patch3 -p1 -b .python3 -%patch4 -p1 -b .bz1733663a -%patch5 -p1 -b .bz1733663b +%patch4 -p1 -b .manual # Make sure bundled tinyxml is not used rm -r externals/tinyxml @@ -96,7 +92,7 @@ xsltproc --nonet -o man/manual.html \ mkdir objdir-%{_target_platform} cd objdir-%{_target_platform} # Upstream doesn't support shared libraries (unversioned solib) -%cmake .. -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=1 -DBUILD_GUI=%{gui} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=1 -DCFGDIR=%{_datadir}/Cppcheck +%cmake .. -DCMAKE_BUILD_TYPE=Release -DMATCHCOMPILER=yes -DHAVE_RULES=yes -DBUILD_GUI=%{gui} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck # SMP make doesn't seem to work make cppcheck @@ -139,6 +135,9 @@ cd objdir-%{_target_platform}/bin %{_bindir}/cppcheck-htmlreport %changelog +* Sat Dec 07 2019 Steve Grubb - 1.89-1 +- New upstream release 1.89 + * Fri Aug 16 2019 Susi Lehtola - 1.88-5 - rebuilt diff --git a/sources b/sources index 7873e4a..7fcdb38 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cppcheck-1.88.tar.gz) = fa4ede0665546341af0ba3dae09a00b6efae09ec7838c616c580be01ff6902594d61168a059539779be0c78e1708d2bd9c8e7987dd0bb67dc8fa332a10d1de6a +SHA512 (cppcheck-1.89.tar.gz) = 0e8f7ae6fe70261f69954ec830c20faff37126ec41a7fdc59ce91db99313a1c99e1850656efeb7182a37fb78fbf8402b71d72a11d6189a5bede2819bdde69b9b