#1 New upstream version 1.89
Closed 4 years ago by c72578. Opened 4 years ago by c72578.

file modified
+1
@@ -39,3 +39,4 @@ 

  /cppcheck-1.86.tar.gz

  /cppcheck-1.87.tar.gz

  /cppcheck-1.88.tar.gz

+ /cppcheck-1.89.tar.gz

file removed
-154
@@ -1,154 +0,0 @@ 

- From 025129663032ab6a2c12e529a0a1a96aeca10db7 Mon Sep 17 00:00:00 2001

- From: Robert Reif <reif@FX6840>

- 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<Token *> 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<TokenAndName>::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 <typename T> struct S<C<T>> {..};

-          TEST_CASE(template_specialization_2);  // #7868 - template specialization template <typename T> struct S<C<T>> {..};

-          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<typename Tuple>\n"

- +                            "struct lambda_context {\n"

- +                            "    template<typename Sig> struct result;\n"

- +                            "    template<typename This, typename I>\n"

- +                            "    struct result<This(terminal, placeholder)> : at<Tuple, I> {};\n"

- +                            "};\n"

- +                            "template<typename T>\n"

- +                            "struct lambda {\n"

- +                            "    template<typename Sig> struct result;\n"

- +                            "    template<typename This>\n"

- +                            "    struct result<This()> : lambda_context<tuple<> > {};\n"

- +                            "};\n"

- +                            "lambda<int> 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<int> ; "

- +                           "lambda<int> l ; struct lambda<int> { "

- +                           "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 <typename T> struct S<C<T>> {..};

-          const char code[] = "template <typename T> struct C {};\n"

-                              "template <typename T> struct S {a};\n"

file removed
-100
@@ -1,100 +0,0 @@ 

- From e1f980c0e98540cdf0f4210c71dbd7f2d916abe7 Mon Sep 17 00:00:00 2001

- From: Robert Reif <reif@FX6840>

- 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 <class VALUE_T, class LIST_T = std::list<VALUE_T> >\n"

- +                   "class TestList {\n"

- +                   "public:\n"

- +                   "    LIST_T m_list;\n"

- +                   "};\n"

- +                   "class Test {\n"

- +                   "public:\n"

- +                   "    const std::list<std::shared_ptr<int>>& get() { return m_test.m_list; }\n"

- +                   "    TestList<std::shared_ptr<int>> 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 <typename T> struct S<C<T>> {..};

-          TEST_CASE(template_specialization_2);  // #7868 - template specialization template <typename T> struct S<C<T>> {..};

-          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 <class VALUE_T, class LIST_T = std::list<VALUE_T>>\n"

- +                            "class TestList { };\n"

- +                            "TestList<std::shared_ptr<int>> m_test;";

- +        const char exp[] = "class TestList<std::shared_ptr<int>,std::list<std::shared_ptr<int>>> ; "

- +                           "TestList<std::shared_ptr<int>,std::list<std::shared_ptr<int>>> m_test ; "

- +                           "class TestList<std::shared_ptr<int>,std::list<std::shared_ptr<int>>> { } ;";

- +        ASSERT_EQUALS(exp, tok(code));

- +    }

- +

-      void template_specialization_1() {  // #7868 - template specialization template <typename T> struct S<C<T>> {..};

-          const char code[] = "template <typename T> struct C {};\n"

-                              "template <typename T> struct S {a};\n"

file added
+23
@@ -0,0 +1,23 @@ 

+ From dd8c7e38ab478edd4ead897abc35159d0b911ae0 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>

+ Date: Tue, 3 Sep 2019 18:02:42 +0200

+ Subject: [PATCH] Add missing xml closing tag to manual.docbook

+ 

+ This fixes xml parsing errors

+ ---

+  man/manual.docbook | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/man/manual.docbook b/man/manual.docbook

+ index d0fa85d6cb..6663b0cc97 100644

+ --- a/man/manual.docbook

+ +++ b/man/manual.docbook

+ @@ -1217,7 +1217,7 @@ Checking pen1.c...

+    &lt;/resource&gt;

+  &lt;/def&gt;</programlisting>

+  

+ -        <para>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:

+ +        <para>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:</para>

+  

+          <programlisting>&lt;?xml version="1.0"?&gt;

+  &lt;def&gt;

@@ -1,14 +0,0 @@ 

- diff -urp cppcheck-1.87.orig/cmake/options.cmake cppcheck-1.87/cmake/options.cmake

- --- cppcheck-1.87.orig/cmake/options.cmake	2019-02-09 03:31:27.000000000 -0500

- +++ cppcheck-1.87/cmake/options.cmake	2019-02-09 13:17:25.237561852 -0500

- @@ -22,6 +22,10 @@ option(ANALYZE_UNDEFINED    "Clang dynam

-  option(ANALYZE_DATAFLOW     "Clang dynamic analyzer: general dynamic dataflow analysis."    OFF)

-  option(WARNINGS_ARE_ERRORS  "Treat warnings as errors"                                      OFF)

-  option(WARNINGS_ANSI_ISO    "Issue all the mandatory diagnostics Listed in C standard"      ON)

- +option(CFGDIR "Configuration file directory"                                               OFF)

- +if(CFGDIR)

- +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCFG=${CFGDIR}")

- +endif(CFGDIR)

-  

-  set(USE_MATCHCOMPILER "Auto" CACHE STRING "Usage of match compiler")

-  set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS Auto Off On Verify) 

@@ -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

@@ -0,0 +1,46 @@ 

+ diff -ur a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp

+ --- a/lib/symboldatabase.cpp	2019-09-01 15:01:12.000000000 +0200

+ +++ b/lib/symboldatabase.cpp	2019-10-08 00:15:39.599408149 +0200

+ @@ -5938,7 +5938,7 @@

+          return ValueType::MatchResult::UNKNOWN;

+  

+      if (call->isIntegral() && func->isIntegral() && call->sign != ValueType::Sign::UNKNOWN_SIGN && func->sign != ValueType::Sign::UNKNOWN_SIGN && call->sign != func->sign)

+ -        return ValueType::MatchResult::UNKNOWN; // TODO

+ +        return ValueType::MatchResult::FALLBACK1;

+  

+      return ValueType::MatchResult::SAME;

+  }

+ diff -ur a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp

+ --- a/test/testsymboldatabase.cpp	2019-09-01 15:01:12.000000000 +0200

+ +++ b/test/testsymboldatabase.cpp	2019-10-07 13:48:46.623740030 +0200

+ @@ -5363,10 +5363,7 @@

+          ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 4);

+  

+          f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v2 ) ) ;");

+ -        if (std::numeric_limits<char>::is_signed)

+ -            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);

+ -        else

+ -            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);

+ +        ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);

+  

+          f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v3 ) ) ;");

+          ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 6);

+ @@ -5381,13 +5378,16 @@

+          ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 9);

+  

+          f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v7 ) ) ;");

+ -        ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);

+ +        if (std::numeric_limits<char>::is_signed)

+ +            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);

+ +        else

+ +            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);

+  

+          f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v8 ) ) ;");

+          if (std::numeric_limits<char>::is_signed)

+              ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);

+          else

+ -            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);

+ +            ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 11);

+  

+          f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v9 ) ) ;");

+          ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 12);

@@ -0,0 +1,34 @@ 

+ diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt

+ index 1678dbbe1..c9ae78eb1 100644

+ --- a/gui/CMakeLists.txt

+ +++ b/gui/CMakeLists.txt

+ @@ -31,7 +31,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 --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp

+ index 0cb80a0f2..053dbab17 100644

+ --- a/gui/translationhandler.cpp

+ +++ b/gui/translationhandler.cpp

+ @@ -116,15 +116,7 @@ bool TranslationHandler::setLanguage(const QString &code)

+          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

file modified
+40 -15
@@ -2,8 +2,8 @@ 

  %global gui 1

  

  Name:           cppcheck

- Version:        1.88

- Release:        5%{?dist}

+ Version:        1.89

+ Release:        3%{?dist}

  Summary:        Tool for static C/C++ code analysis

  License:        GPLv3+

  URL:            http://cppcheck.wiki.sourceforge.net/
@@ -12,16 +12,15 @@ 

  # Use system tinyxml2

  Patch0:         cppcheck-1.88-tinyxml.patch

  # Fix location of translations

- Patch1:         cppcheck-1.88-translations.patch

- # Set location of config files

- Patch2:         cppcheck-1.87-cfgdir.patch

+ Patch1:         cppcheck-1.89-translations.patch

+ # Add missing xml closing tag to manual.docbook

+ Patch2:         https://github.com/danmar/cppcheck/pull/2142.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

+ # Fix failing tests on architectures, where char is unsigned by default.

+ # https://trac.cppcheck.net/ticket/9359

+ # Backported from: https://github.com/danmar/cppcheck/commit/3c085fd

+ Patch4:         cppcheck-1.89-fix-unsigned-char.patch

  

  BuildRequires:  gcc-c++

  BuildRequires:  pcre-devel
@@ -78,10 +77,9 @@ 

  %setup -q

  %patch0 -p1 -b .tinyxml

  %patch1 -p1 -b .translations

- %patch2 -p1 -b .cfgdir

+ %patch2 -p1 -b .2142

  %patch3 -p1 -b .python3

- %patch4 -p1 -b .bz1733663a

- %patch5 -p1 -b .bz1733663b

+ %patch4 -p1 -b .unsigned-char

  # Make sure bundled tinyxml is not used

  rm -r externals/tinyxml

  
@@ -96,7 +94,7 @@ 

  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 -DHAVE_RULES=1 -DBUILD_GUI=%{gui} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=1 -DFILESDIR=%{_datadir}/Cppcheck

  # SMP make doesn't seem to work

  make cppcheck

  
@@ -121,7 +119,8 @@ 

  ./testrunner -g -q

  

  %files

- %doc AUTHORS COPYING man/manual.html

+ %doc AUTHORS man/manual.html

+ %license COPYING

  %{_datadir}/Cppcheck/

  %{_bindir}/cppcheck

  %{_mandir}/man1/cppcheck.1*
@@ -139,6 +138,32 @@ 

  %{_bindir}/cppcheck-htmlreport

  

  %changelog

+ * Mon Oct 07 2019 Wolfgang Stöggl <c72578@yahoo.de> - 1.89-3

+ - Failing tests on architectures, where char is unsigned by default,

+   have been fixed upstream.

+ - Add cppcheck-1.89-fix-unsigned-char.patch

+ - Remove "-fsigned-char" from CXXFLAGS again

The second and the third comments are unnecessary: the second is not needed in the package changelog (it can be seen in the vcs), and the third is basically the same as the first.

+ 

+ * Sat Sep 28 2019 Wolfgang Stöggl <c72578@yahoo.de> - 1.89-2

+ - Add "-fsigned-char" to CXXFLAGS, to make all tests pass also on

+   armv7hl aarch64 ppc64le s390x

This is fine

+ 

+ * Wed Sep 04 2019 Wolfgang Stöggl <c72578@yahoo.de> - 1.89-1

+ - New upstream version 1.89

+ - Drop upstreamed patches:

+   Patch4: https://github.com/danmar/cppcheck/pull/1939.patch

+   Patch5: https://github.com/danmar/cppcheck/pull/1943.patch

+ - Update translations patch to 1.89:

+   Patch1: cppcheck-1.89-translations.patch

+   Fix typo in patch: CppCheck/lang/ -> Cppcheck/lang/

+ - Use FILESDIR instead of CFGDIR, see:

+   https://github.com/danmar/cppcheck/commit/a17f2a6

+   and drop Patch2: cppcheck-1.87-cfgdir.patch

+ - Add patch: Add missing xml closing tag to manual.docbook

+   https://github.com/danmar/cppcheck/pull/2142.patch

+ - Use %%license macro instead of %%doc for the COPYING file

+ - Make tests non fatal for armv7hl aarch64 ppc64le s390x

+ 

Upstreamed patches / patch updates / dropped patches aren't marked in the changelog since they happen pretty much at every release and they're of no interest to the end users (rpm -q --changelog cppcheck). Package developers see them easily in the git changelog.

  * Fri Aug 16 2019 Susi Lehtola <susi.lehtola@iki.fi> - 1.88-5

  - rebuilt

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (cppcheck-1.88.tar.gz) = fa4ede0665546341af0ba3dae09a00b6efae09ec7838c616c580be01ff6902594d61168a059539779be0c78e1708d2bd9c8e7987dd0bb67dc8fa332a10d1de6a

+ SHA512 (cppcheck-1.89.tar.gz) = 6d5f5817ca5f39bf94cbbda4ff25268360af6ee8baa9cbafa7df6359447648774d402bf1ad70b7b6f897e8b43a61b4afd244f2a879dc29ba2641049320ccf5a5

The changelog is much too verbose; none of the entries are supposed to go into the changelog.

Do you have a reason for disabling the tests on non-x86_64?

3 tests of Cppcheck 1.89 are currently failing under these architectures: armv7hl aarch64 ppc64le s390x
See e.g.: https://koji.fedoraproject.org/koji/taskinfo?taskID=37448253

Testing Complete
Number of tests: 3436
Number of todos: 179
BUILDSTDERR: Tests failed: 3

The tests are not disabled in the spec file for these architectures. Using "||:" lets the build pass, even if some tests fail.

Here is a recent koji scratch build from the current spec file of the PR, which passes:
https://koji.fedoraproject.org/koji/taskinfo?taskID=37469551

If some tests fails, it is much preferred to just disable such specific tests only, not bypassing whole test results.

Making the build succeed even when the tests fail is tantamount to bypassing the tests altogether. The package should not be updated until all tests pass on all architectures. Please file bugs upstream on the failing tests.

Has anyone of you got an account at https://trac.cppcheck.net/
to file the bug there?

OK, I have started reporting at #cppcheck

Just a quick update on this:
In the meantime I've been in contact by e-mail with Daniel Marjamäki from the Cppcheck project. A nightly build of current master of Cppcheck has been set up with one of the affected architectures (ppc64le), to see when/if this gets fixed [1].

[1] https://copr.fedorainfracloud.org/coprs/c72578/cppcheck/

An upstream ticket concerning the failing tests under armv7hl, aarch64, ppc64le and s390x has been created here:
https://trac.cppcheck.net/ticket/9359

1 new commit added

  • Add "-fsigned-char" to CXXFLAGS
4 years ago

In the meantime I did some debugging on a ppc64le system.
The following warning (separate issue), which appeared in the ppc64le build log but not in x86_64, gave an indication, where the problem was coming from:
lib/suppressions.cpp:172:42: warning: comparison is always false due to limited range of data type [-Wtype-limits]

Whereas errorId is of type std::string, which is defined as std::basic_string<char>.
The type char is signed on i686 and x86_64, but unsigned on armv7hl aarch64 ppc64le s390x.

Use CXXFLAGS="-fsigned-char" for now, to make all tests pass also on armv7hl aarch64 ppc64le s390x.

Successful Koji build:
https://koji.fedoraproject.org/koji/taskinfo?taskID=37920113

Good work! Looking at the upstream ticket, they have discovered they can reproduce the problem with CXXFLAGS="-funsigned-char". I think this won't take long for upstream to fix; they'll probably release a new version.

1 new commit added

  • Add cppcheck-1.89-fix-unsigned-char.patch
4 years ago

In the meantime, the issue has been fixed upstream. See the following commit for details:
https://github.com/danmar/cppcheck/commit/3c085fd
I have backported the upstream fix to Cppcheck 1.89, see:
cppcheck-1.89-fix-unsigned-char.patch

Successful Koji build:
https://koji.fedoraproject.org/koji/taskinfo?taskID=38121551

3 new commits added

  • Add cppcheck-1.89-fix-unsigned-char.patch
  • Add "-fsigned-char" to CXXFLAGS
  • New upstream version 1.89
4 years ago

3 new commits added

  • Add cppcheck-1.89-fix-unsigned-char.patch
  • Add "-fsigned-char" to CXXFLAGS
  • New upstream version 1.89
4 years ago

Cppcheck-1.90 has been released today. So I will close this PR now.
https://github.com/danmar/cppcheck/releases

Pull-Request has been closed by c72578

4 years ago

Sorry, I've been 250% busy at $DAYJOB, and have missed a lot of then-non-essential emails. I'd be happy to merge the PR with the update to 1.90 and fixes.

The second and the third comments are unnecessary: the second is not needed in the package changelog (it can be seen in the vcs), and the third is basically the same as the first.

Upstreamed patches / patch updates / dropped patches aren't marked in the changelog since they happen pretty much at every release and they're of no interest to the end users (rpm -q --changelog cppcheck). Package developers see them easily in the git changelog.

@jussilehtola Thanks for your feedback. I have prepared a new PR now for Cppcheck 1.90
https://src.fedoraproject.org/rpms/cppcheck/pull-request/2