Update to 2.3

- Remove the following patches, which are not needed anymore in 2.3:
  cppcheck-2.2-tinyxml.patch
  cppcheck-2.2-exprengine.patch
  cppcheck-2.2-online-help.patch
  cppcheck-2.2-online-help_q_readonly.patch
- Update patch:
  cppcheck-2.3-gcc11.patch
- Add -DUSE_BUNDLED_TINYXML2=OFF to cmake
This commit is contained in:
Wolfgang Stöggl 2020-12-06 06:42:35 +01:00
parent 3cbed43cee
commit 0318041ec1
8 changed files with 27 additions and 239 deletions

1
.gitignore vendored
View File

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

View File

@ -1,57 +0,0 @@
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,25 +0,0 @@
From df9f6f38be7ed385b0b56d5c6101e34f717e2318 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>
Date: Sun, 11 Oct 2020 03:49:27 +0200
Subject: [PATCH] Look for Qt online-help file also in FILESDIR (#2844)
---
gui/helpdialog.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gui/helpdialog.cpp b/gui/helpdialog.cpp
index 706266968b..c158c8092f 100644
--- a/gui/helpdialog.cpp
+++ b/gui/helpdialog.cpp
@@ -33,6 +33,11 @@ static QString getHelpFile()
<< datadir
<< (QApplication::applicationDirPath() + "/help")
<< QApplication::applicationDirPath();
+#ifdef FILESDIR
+ const QString filesdir = FILESDIR;
+ paths << (filesdir + "/help")
+ << filesdir;
+#endif
for (QString p: paths) {
QString filename = p + "/online-help.qhc";
if (QFileInfo(filename).exists())

View File

@ -1,31 +0,0 @@
From 4a057c181373626f6e1538a2edf46cc4741fe7bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>
Date: Sun, 8 Nov 2020 15:06:14 +0100
Subject: [PATCH] Set _q_readonly property for online-help (#2890)
- Setting _q_readonly disables the timestamp check of the registered
online-help.qch file
- This enables displaying of Contents and Index of the online help,
even if the timestamp of online-help.qch is slightly different.
Differences in the timestamp can result from packing online-help.qch
in a cab file, when building the installer (1 or 2 seconds) or from
installing the file under a different timezone under Linux etc.
- Remark: Qt 5.14 or newer is required to display Contents or Index,
when the help files are readonly
---
gui/helpdialog.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gui/helpdialog.cpp b/gui/helpdialog.cpp
index c158c8092f..ce24aa1c3a 100644
--- a/gui/helpdialog.cpp
+++ b/gui/helpdialog.cpp
@@ -66,6 +66,8 @@ HelpDialog::HelpDialog(QWidget *parent) :
}
mHelpEngine = new QHelpEngine(helpFile);
+ // Disable the timestamp check of online-help.qhc by setting _q_readonly
+ mHelpEngine->setProperty("_q_readonly", QVariant::fromValue<bool>(true));
mHelpEngine->setupData();
mUi->contents->addWidget(mHelpEngine->contentWidget());

View File

@ -1,90 +0,0 @@
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/)
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
file(GLOB hdrs "*.h")
@@ -8,7 +7,7 @@ file(GLOB mainfile "main.cpp")
list(REMOVE_ITEM srcs ${mainfile})
add_library(cli_objs OBJECT ${hdrs} ${srcs})
-add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
target_link_libraries(cppcheck ${PCRE_LIBRARY})
endif()
@@ -18,6 +17,7 @@ endif()
if (WIN32 AND NOT BORLAND)
target_link_libraries(cppcheck Shlwapi.lib)
endif()
+target_link_libraries(cppcheck tinyxml2)
install(TARGETS cppcheck
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
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()
-add_subdirectory(externals/tinyxml)
add_subdirectory(externals/simplecpp)
add_subdirectory(lib) # CppCheck Library
add_subdirectory(cli) # Client application
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()
include_directories(${PROJECT_SOURCE_DIR}/lib/)
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
file(GLOB hdrs "*.h")
file(GLOB srcs "*.cpp")
@@ -20,14 +19,14 @@ if (BUILD_GUI)
QT5_ADD_RESOURCES(resources "gui.qrc")
QT5_ADD_TRANSLATION(qms ${tss})
- add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+ add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
target_link_libraries(cppcheck-gui ${PCRE_LIBRARY})
endif()
if (USE_Z3)
target_link_libraries(cppcheck-gui ${Z3_LIBRARIES})
endif()
- 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.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)
include_directories(${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/cli/)
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml)
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
file(GLOB hdrs "*.h")
file(GLOB srcs "*.cpp")
- add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+ add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
target_link_libraries(testrunner ${PCRE_LIBRARY})
endif()
if (USE_Z3)
target_link_libraries(testrunner ${Z3_LIBRARIES})
endif()
+ target_link_libraries(testrunner tinyxml2)
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
target_precompile_headers(testrunner PRIVATE precompiled.h)

View File

@ -1,24 +1,24 @@
diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp
index 6b0e2d8..785c9cf 100644
index 753a5c846..bb9569624 100644
--- a/lib/programmemory.cpp
+++ b/lib/programmemory.cpp
@@ -6,6 +6,7 @@
@@ -5,6 +5,7 @@
#include "symboldatabase.h"
#include <algorithm>
#include <cassert>
#include <memory>
+#include <limits>
#include <memory>
void ProgramMemory::setValue(nonneg int varid, const ValueFlow::Value &value)
{
diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp
index 4d378d5..ced44ab 100644
index 1d2bc8d54..399ea7593 100644
--- a/test/testsymboldatabase.cpp
+++ b/test/testsymboldatabase.cpp
@@ -38,6 +38,7 @@
#include <stdexcept>
#include <string>
#include <vector>
@@ -31,6 +31,7 @@
#include <cstddef>
#include <cstdint>
#include <cstring>
+#include <limits>
struct InternalError;
#include <list>
#include <map>
#include <set>

View File

@ -1,28 +1,19 @@
%undefine __cmake_in_source_build
Name: cppcheck
Version: 2.2
Version: 2.3
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.2-tinyxml.patch
# Fix location of translations
Patch1: cppcheck-2.2-translations.patch
Patch0: 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
# Look for Qt online-help file also in FILESDIR
# https://github.com/danmar/cppcheck/commit/df9f6f3
Patch4: cppcheck-2.2-online-help.patch
Patch1: cppcheck-1.88-htmlreport-python3.patch
# Fix for missing #include with gcc-11
Patch5: cppcheck-gcc11.patch
# https://github.com/danmar/cppcheck/pull/2890
Patch6: cppcheck-2.2-online-help_q_readonly.patch
Patch2: cppcheck-2.3-gcc11.patch
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -65,15 +56,11 @@ from xml files first generated using cppcheck.
%prep
%setup -q
%patch0 -p1 -b .tinyxml
%patch1 -p1 -b .translations
%patch2 -p1 -b .python3
%patch3 -p1 -b .exprengine
%patch4 -p1 -b .online-help
%patch5 -p1 -b .gcc11
%patch6 -p1 -b .online-help_q_readonly
# Make sure bundled tinyxml is not used
rm -r externals/tinyxml
%patch0 -p1 -b .translations
%patch1 -p1 -b .python3
%patch2 -p1 -b .gcc11
# Make sure bundled tinyxml2 is not used
rm -r externals/tinyxml2
# Generate the Qt online-help file
cd gui/help
qhelpgenerator-qt5 online-help.qhcp -o online-help.qhc
@ -86,7 +73,7 @@ pandoc man/reference-cfg-format.md -o man/reference-cfg-format.html -s --number-
# Binaries
# Upstream doesn't support shared libraries (unversioned solib)
%cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DUSE_Z3=yes -DHAVE_RULES=yes -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck
%cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DUSE_Z3=yes -DHAVE_RULES=yes -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck -DUSE_BUNDLED_TINYXML2=OFF
%cmake_build
%install
@ -126,6 +113,9 @@ cd %{_vpath_builddir}/bin
%{_bindir}/cppcheck-htmlreport
%changelog
* Sat Dec 05 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.3-1
- Update to 2.3.
* Mon Nov 09 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.2-1
- Update to 2.2.

View File

@ -1 +1 @@
SHA512 (cppcheck-2.2.tar.gz) = 510dccba09530cb19a7d736966aeaac8683c9eb37ff1a347e1310f775b312c6c1598347b01f06343dbeab04d1fdc774aafa6800ee054b2f2f50a68ba4606c353
SHA512 (cppcheck-2.3.tar.gz) = ee15890f77c58847d4add7d555398e4bb83e3a73e942f218413b9830f05b2c975b49bf0aeb0092e0467f0cd7f26b9f05013f701dd80ee5e2aa3d2ef81945c4ed