Update to 2.2

- Add BR qt5-qttools-devel
- Update patches:
  cppcheck-2.2-tinyxml.patch
  cppcheck-2.2-translations.patch
- Add patch:
  cppcheck-2.2-exprengine.patch
This commit is contained in:
Wolfgang Stöggl 2020-10-04 18:57:40 +02:00
parent 27cade0386
commit 5073703177
6 changed files with 97 additions and 32 deletions

1
.gitignore vendored
View File

@ -43,3 +43,4 @@ cppcheck-1.44.tar.bz2
/cppcheck-1.90.tar.gz
/cppcheck-2.0.tar.gz
/cppcheck-2.1.tar.gz
/cppcheck-2.2.tar.gz

View File

@ -0,0 +1,57 @@
From b052843655f90a62526585db20fcf18660919cb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= <daniel.marjamaki@gmail.com>
Date: Sun, 4 Oct 2020 11:21:00 +0200
Subject: [PATCH] exprengine: Use and tweak ExprEngine::ArrayValue::MAXSIZE
---
lib/exprengine.cpp | 2 +-
lib/exprengine.h | 2 +-
test/testexprengine.cpp | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp
index 49ea76b4ab..21c6bd9a9f 100644
--- a/lib/exprengine.cpp
+++ b/lib/exprengine.cpp
@@ -1506,7 +1506,7 @@ static ExprEngine::ValuePtr getValueRangeFromValueType(const ValueType *valueTyp
value = getValueRangeFromValueType(&vt, data);
} else
return ExprEngine::ValuePtr();
- auto bufferSize = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ~0U);
+ auto bufferSize = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ExprEngine::ArrayValue::MAXSIZE);
return std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), bufferSize, value, false, false, false);
}
return getValueRangeFromValueType(data.getNewSymbolName(), valueType, *data.settings);
diff --git a/lib/exprengine.h b/lib/exprengine.h
index 46966d6108..889140fd85 100644
--- a/lib/exprengine.h
+++ b/lib/exprengine.h
@@ -194,7 +194,7 @@ namespace ExprEngine {
// Array or pointer
class ArrayValue: public Value {
public:
- const int MAXSIZE = 0x100000;
+ enum { MAXSIZE = 0x7fffffff };
ArrayValue(const std::string &name, ValuePtr size, ValuePtr value, bool pointer, bool nullPointer, bool uninitPointer);
ArrayValue(DataBase *data, const Variable *var);
diff --git a/test/testexprengine.cpp b/test/testexprengine.cpp
index f403eae35c..d8965167a1 100644
--- a/test/testexprengine.cpp
+++ b/test/testexprengine.cpp
@@ -328,13 +328,13 @@ class TestExprEngine : public TestFixture {
Settings settings;
LOAD_LIB_2(settings.library, "std.cfg");
- ASSERT_EQUALS("1:26: $3=0:ffffffff\n"
+ ASSERT_EQUALS("1:26: $3=0:2147483647\n"
"1:26: $2=-128:127\n"
"1:27: 0:{ s=($4,[$3],[:]=$2)}\n",
trackExecution("void foo() { std::string s; }", &settings));
- ASSERT_EQUALS("1:52: $3=0:ffffffff\n"
+ ASSERT_EQUALS("1:52: $3=0:2147483647\n"
"1:52: $2=-128:127\n"
"1:66: 0:{ s=($4,[$3],[:]=$2)}\n",
trackExecution("std::string getName(int); void foo() { std::string s = getName(1); }", &settings));

View File

@ -1,6 +1,6 @@
diff -up cppcheck-2.1/cli/CMakeLists.txt.orig cppcheck-2.1/cli/CMakeLists.txt
--- cppcheck-2.1/cli/CMakeLists.txt.orig 2020-06-13 18:08:37.000000000 +0200
+++ cppcheck-2.1/cli/CMakeLists.txt 2020-06-15 11:52:39.095165469 +0200
diff -up cppcheck-2.2/cli/CMakeLists.txt.orig cppcheck-2.2/cli/CMakeLists.txt
--- cppcheck-2.2/cli/CMakeLists.txt.orig 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/cli/CMakeLists.txt 2020-10-04 06:47:29.867450500 +0200
@@ -1,5 +1,4 @@
include_directories(${PROJECT_SOURCE_DIR}/lib/)
-include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
@ -24,9 +24,9 @@ diff -up cppcheck-2.1/cli/CMakeLists.txt.orig cppcheck-2.1/cli/CMakeLists.txt
install(TARGETS cppcheck
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
diff -up cppcheck-2.1/CMakeLists.txt.orig cppcheck-2.1/CMakeLists.txt
--- cppcheck-2.1/CMakeLists.txt.orig 2020-06-13 18:08:37.000000000 +0200
+++ cppcheck-2.1/CMakeLists.txt 2020-06-15 11:52:39.099165304 +0200
diff -up cppcheck-2.2/CMakeLists.txt.orig cppcheck-2.2/CMakeLists.txt
--- cppcheck-2.2/CMakeLists.txt.orig 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/CMakeLists.txt 2020-10-04 06:48:18.324566600 +0200
@@ -23,7 +23,6 @@ if (BUILD_TESTS)
enable_testing()
endif()
@ -35,9 +35,9 @@ diff -up cppcheck-2.1/CMakeLists.txt.orig cppcheck-2.1/CMakeLists.txt
add_subdirectory(externals/simplecpp)
add_subdirectory(lib) # CppCheck Library
add_subdirectory(cli) # Client application
diff -up cppcheck-2.1/gui/CMakeLists.txt.orig cppcheck-2.1/gui/CMakeLists.txt
--- cppcheck-2.1/gui/CMakeLists.txt.orig 2020-06-13 18:08:37.000000000 +0200
+++ cppcheck-2.1/gui/CMakeLists.txt 2020-06-15 11:53:24.866217469 +0200
diff -up cppcheck-2.2/gui/CMakeLists.txt.orig cppcheck-2.2/gui/CMakeLists.txt
--- cppcheck-2.2/gui/CMakeLists.txt.orig 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/gui/CMakeLists.txt 2020-10-04 07:36:13.199769100 +0200
@@ -10,7 +10,6 @@ if (BUILD_GUI)
endif()
@ -58,14 +58,14 @@ diff -up cppcheck-2.1/gui/CMakeLists.txt.orig cppcheck-2.1/gui/CMakeLists.txt
if (USE_Z3)
target_link_libraries(cppcheck-gui ${Z3_LIBRARIES})
endif()
- target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
+ target_link_libraries(cppcheck-gui tinyxml2 Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
- target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Help)
+ target_link_libraries(cppcheck-gui tinyxml2 Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Help)
if(WITH_QCHART)
target_compile_definitions (cppcheck-gui PRIVATE HAVE_QCHART )
target_link_libraries(cppcheck-gui Qt5::Charts)
diff -up cppcheck-2.1/test/CMakeLists.txt.orig cppcheck-2.1/test/CMakeLists.txt
--- cppcheck-2.1/test/CMakeLists.txt.orig 2020-06-15 11:52:39.108164933 +0200
+++ cppcheck-2.1/test/CMakeLists.txt 2020-06-15 11:54:10.167286593 +0200
diff -up cppcheck-2.2/test/CMakeLists.txt.orig cppcheck-2.2/test/CMakeLists.txt
--- cppcheck-2.2/test/CMakeLists.txt.orig 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/test/CMakeLists.txt 2020-10-04 06:55:33.660775300 +0200
@@ -13,19 +13,19 @@ if (BUILD_TESTS)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -j ${CTEST_PARALLEL_LEVEL} -C ${CMAKE_CFG_INTDIR} --timeout 90)
@ -86,5 +86,5 @@ diff -up cppcheck-2.1/test/CMakeLists.txt.orig cppcheck-2.1/test/CMakeLists.txt
endif()
+ target_link_libraries(testrunner tinyxml2)
add_custom_target(copy_cfg ALL
COMMENT "Copying cfg files")
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
target_precompile_headers(testrunner PRIVATE precompiled.h)

View File

@ -1,7 +1,7 @@
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)
diff -urp cppcheck-2.2.orig/gui/CMakeLists.txt cppcheck-2.2/gui/CMakeLists.txt
--- cppcheck-2.2.orig/gui/CMakeLists.txt 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/gui/CMakeLists.txt 2020-10-04 07:18:23.309796000 +0200
@@ -40,7 +40,7 @@ if (BUILD_GUI)
endif()
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
@ -10,12 +10,12 @@ diff -urp cppcheck-1.89.orig/gui/CMakeLists.txt cppcheck-1.89/gui/CMakeLists.txt
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;
diff -urp cppcheck-2.2.orig/gui/translationhandler.cpp cppcheck-2.2/gui/translationhandler.cpp
--- cppcheck-2.2.orig/gui/translationhandler.cpp 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/gui/translationhandler.cpp 2020-10-04 07:19:44.765892500 +0200
@@ -113,15 +113,7 @@ bool TranslationHandler::setLanguage(con
QString datadir = getDataDir();
- QString translationFile;
- if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm"))
@ -26,7 +26,7 @@ diff -urp cppcheck-1.89.orig/gui/translationhandler.cpp cppcheck-1.89/gui/transl
-
- else
- translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm";
+ QString translationFile("/usr/share/Cppcheck/lang/" + 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

View File

@ -1,17 +1,19 @@
Name: cppcheck
Version: 2.1
Release: 7%{?dist}
Version: 2.2
Release: 1%{?dist}
Summary: Tool for static C/C++ code analysis
License: GPLv3+
URL: http://cppcheck.wiki.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# Use system tinyxml2
Patch0: cppcheck-2.1-tinyxml.patch
Patch0: cppcheck-2.2-tinyxml.patch
# Fix location of translations
Patch1: cppcheck-1.89-translations.patch
Patch1: cppcheck-2.2-translations.patch
# Select python3 explicitly
Patch2: cppcheck-1.88-htmlreport-python3.patch
# https://github.com/danmar/cppcheck/commit/b052843
Patch3: cppcheck-2.2-exprengine.patch
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -25,6 +27,7 @@ BuildRequires: zlib-devel
BuildRequires: python3-devel
BuildRequires: z3-devel >= 4.7.1
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qttools-devel
BuildRequires: qt5-linguist
@ -56,6 +59,7 @@ from xml files first generated using cppcheck.
%patch0 -p1 -b .tinyxml
%patch1 -p1 -b .translations
%patch2 -p1 -b .python3
%patch3 -p1 -b .exprengine
# Make sure bundled tinyxml is not used
rm -r externals/tinyxml
@ -104,6 +108,9 @@ cd %{_vpath_builddir}/bin
%{_bindir}/cppcheck-htmlreport
%changelog
* Sun Oct 04 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.2-1
- Update to 2.2.
* Tue Aug 18 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 2.1-7
- Gui package is always built.

View File

@ -1 +1 @@
SHA512 (cppcheck-2.1.tar.gz) = 5001486c0f5dd2149c733df6167e274217dba6e248f525aba0f1523c92f44ad119b7e4c5655ccc812567ccf9ab11bcaaa35aa165d5d256212802f69594a581b8
SHA512 (cppcheck-2.2.tar.gz) = 510dccba09530cb19a7d736966aeaac8683c9eb37ff1a347e1310f775b312c6c1598347b01f06343dbeab04d1fdc774aafa6800ee054b2f2f50a68ba4606c353