Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Wolfgang Stöggl | 2998b0780d | |
Wolfgang Stöggl | 6b94cc6ccc | |
Wolfgang Stöggl | 7a7613a777 | |
Wolfgang Stöggl | eabfd86eb3 |
|
@ -45,3 +45,6 @@ cppcheck-1.44.tar.bz2
|
|||
/cppcheck-2.1.tar.gz
|
||||
/cppcheck-2.2.tar.gz
|
||||
/cppcheck-2.3.tar.gz
|
||||
/cppcheck-2.5.tar.gz
|
||||
/cppcheck-2.6.tar.gz
|
||||
/cppcheck-2.7.tar.gz
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
From 5c4dc7f32978243db8ea10153b3cd84d116a1d10 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Fultz II <pfultz2@yahoo.com>
|
||||
Date: Mon, 14 Dec 2020 04:13:47 -0600
|
||||
Subject: [PATCH] Fix issue 10024: FP: nullPointerRedundantCheck when using a
|
||||
goto statement (#2947)
|
||||
|
||||
(cherry picked from commit da1375c9a3f3a3b7eae7aece5e2ba03e59973aa0)
|
||||
---
|
||||
lib/reverseanalyzer.cpp | 2 ++
|
||||
test/testnullpointer.cpp | 18 ++++++++++++++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
diff --git a/lib/reverseanalyzer.cpp b/lib/reverseanalyzer.cpp
|
||||
index a6a86f63e..31deda58d 100644
|
||||
--- a/lib/reverseanalyzer.cpp
|
||||
+++ b/lib/reverseanalyzer.cpp
|
||||
@@ -124,6 +124,8 @@ struct ReverseTraversal {
|
||||
}
|
||||
if (Token::Match(tok, "return|break|continue"))
|
||||
break;
|
||||
+ if (Token::Match(tok, "%name% :"))
|
||||
+ break;
|
||||
// Evaluate LHS of assignment before RHS
|
||||
if (Token* assignTok = assignExpr(tok)) {
|
||||
Token* assignTop = assignTok;
|
||||
diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp
|
||||
index 94d772911..8a3738fe9 100644
|
||||
--- a/test/testnullpointer.cpp
|
||||
+++ b/test/testnullpointer.cpp
|
||||
@@ -106,6 +106,7 @@ private:
|
||||
TEST_CASE(nullpointer63);
|
||||
TEST_CASE(nullpointer64);
|
||||
TEST_CASE(nullpointer65); // #9980
|
||||
+ TEST_CASE(nullpointer66); // #10024
|
||||
TEST_CASE(nullpointer_addressOf); // address of
|
||||
TEST_CASE(nullpointerSwitch); // #2626
|
||||
TEST_CASE(nullpointer_cast); // #4692
|
||||
@@ -2032,6 +2033,23 @@ private:
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
+ void nullpointer66() {
|
||||
+ check("int f() {\n"
|
||||
+ " int ret = 0;\n"
|
||||
+ " int *v = nullptr;\n"
|
||||
+ " if (!MyAlloc(&v)) {\n"
|
||||
+ " ret = -1;\n"
|
||||
+ " goto done;\n"
|
||||
+ " }\n"
|
||||
+ " DoSomething(*v);\n"
|
||||
+ "done:\n"
|
||||
+ " if (v)\n"
|
||||
+ " MyFree(&v);\n"
|
||||
+ " return ret;\n"
|
||||
+ "}\n");
|
||||
+ ASSERT_EQUALS("", errout.str());
|
||||
+ }
|
||||
+
|
||||
void nullpointer_addressOf() { // address of
|
||||
check("void f() {\n"
|
||||
" struct X *x = 0;\n"
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp
|
||||
index 753a5c846..bb9569624 100644
|
||||
--- a/lib/programmemory.cpp
|
||||
+++ b/lib/programmemory.cpp
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "symboldatabase.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
+#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 1d2bc8d54..399ea7593 100644
|
||||
--- a/test/testsymboldatabase.cpp
|
||||
+++ b/test/testsymboldatabase.cpp
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
+#include <limits>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
|
@ -0,0 +1,80 @@
|
|||
diff --git a/gui/test/benchmark/simple/CMakeLists.txt b/gui/test/benchmark/simple/CMakeLists.txt
|
||||
index 78cf81270..25e787819 100644
|
||||
--- a/gui/test/benchmark/simple/CMakeLists.txt
|
||||
+++ b/gui/test/benchmark/simple/CMakeLists.txt
|
||||
@@ -1,11 +1,13 @@
|
||||
qt5_wrap_cpp(test-benchmark-simple_SRC benchmarksimple.h)
|
||||
add_custom_target(build-testbenchmark-simple-deps SOURCES ${test-benchmark-simple_SRC})
|
||||
add_dependencies(gui-build-deps build-testbenchmark-simple-deps)
|
||||
+if(USE_BUNDLED_TINYXML2)
|
||||
+ list(APPEND test-benchmark-simple_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
|
||||
+endif()
|
||||
add_executable(benchmark-simple
|
||||
${test-benchmark-simple_SRC}
|
||||
benchmarksimple.cpp
|
||||
$<TARGET_OBJECTS:lib_objs>
|
||||
- $<TARGET_OBJECTS:tinyxml2_objs>
|
||||
$<TARGET_OBJECTS:simplecpp_objs>
|
||||
)
|
||||
target_include_directories(benchmark-simple PRIVATE ${CMAKE_SOURCE_DIR}/lib)
|
||||
@@ -16,4 +18,7 @@ if (HAVE_RULES)
|
||||
endif()
|
||||
if (USE_Z3)
|
||||
target_link_libraries(benchmark-simple ${Z3_LIBRARIES})
|
||||
-endif()
|
||||
\ No newline at end of file
|
||||
+endif()
|
||||
+if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
|
||||
+ target_link_libraries(benchmark-simple tinyxml2)
|
||||
+endif()
|
||||
diff --git a/gui/test/xmlreportv2/CMakeLists.txt b/gui/test/xmlreportv2/CMakeLists.txt
|
||||
index a244ea722..5dd39465c 100644
|
||||
--- a/gui/test/xmlreportv2/CMakeLists.txt
|
||||
+++ b/gui/test/xmlreportv2/CMakeLists.txt
|
||||
@@ -22,4 +22,7 @@ if (HAVE_RULES)
|
||||
endif()
|
||||
if (USE_Z3)
|
||||
target_link_libraries(test-xmlreportv2 ${Z3_LIBRARIES})
|
||||
-endif()
|
||||
\ No newline at end of file
|
||||
+endif()
|
||||
+if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
|
||||
+ target_link_libraries(test-xmlreportv2 tinyxml2)
|
||||
+endif()
|
||||
diff --git a/oss-fuzz/CMakeLists.txt b/oss-fuzz/CMakeLists.txt
|
||||
index c0fbd4d1c..5b2c5e059 100644
|
||||
--- a/oss-fuzz/CMakeLists.txt
|
||||
+++ b/oss-fuzz/CMakeLists.txt
|
||||
@@ -1,11 +1,19 @@
|
||||
if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
- add_executable(fuzz-client EXCLUDE_FROM_ALL
|
||||
+ set(fuzz-client_SRC
|
||||
main.cpp
|
||||
type2.cpp
|
||||
+ )
|
||||
+ if(USE_BUNDLED_TINYXML2)
|
||||
+ list(APPEND fuzz-client_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
|
||||
+ endif()
|
||||
+ add_executable(fuzz-client EXCLUDE_FROM_ALL
|
||||
+ ${fuzz-client_SRC}
|
||||
$<TARGET_OBJECTS:simplecpp_objs>
|
||||
- $<TARGET_OBJECTS:tinyxml2_objs>
|
||||
$<TARGET_OBJECTS:lib_objs>)
|
||||
- target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml2 ${CMAKE_SOURCE_DIR}/externals)
|
||||
+ target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals)
|
||||
+ if(USE_BUNDLED_TINYXML2)
|
||||
+ target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/externals/tinyxml2/)
|
||||
+ endif()
|
||||
target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer)
|
||||
# TODO: target_link_options() requires CMake >= 3.13
|
||||
#target_link_options(fuzz-client PRIVATE -fsanitize=fuzzer)
|
||||
@@ -16,6 +24,9 @@ if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if (USE_Z3)
|
||||
target_link_libraries(fuzz-client PRIVATE ${Z3_LIBRARIES})
|
||||
endif()
|
||||
+ if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
|
||||
+ target_link_libraries(fuzz-client PRIVATE tinyxml2)
|
||||
+ endif()
|
||||
|
||||
add_executable(translate EXCLUDE_FROM_ALL
|
||||
translate.cpp
|
|
@ -1,22 +1,19 @@
|
|||
%undefine __cmake_in_source_build
|
||||
|
||||
Name: cppcheck
|
||||
Version: 2.3
|
||||
Release: 3%{?dist}
|
||||
Version: 2.7
|
||||
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
|
||||
Source0: https://github.com/danmar/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
|
||||
# Fix location of translations
|
||||
Patch0: cppcheck-2.2-translations.patch
|
||||
# Select python3 explicitly
|
||||
Patch1: cppcheck-1.88-htmlreport-python3.patch
|
||||
# Fix for missing #include with gcc-11
|
||||
Patch2: cppcheck-2.3-gcc11.patch
|
||||
# da1375c9a3f3 ("Fix issue 10024: FP: nullPointerRedundantCheck
|
||||
# when using a goto statement (#2947)")
|
||||
Patch3: cppcheck-2.3-Fix-issue-10024-FP-nullPointerRedundantCheck-when-us.patch
|
||||
# https://github.com/danmar/cppcheck/commit/974dd5d
|
||||
Patch2: cppcheck-2.7-tinyxml2.patch
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: pcre-devel
|
||||
|
@ -28,6 +25,7 @@ BuildRequires: desktop-file-utils
|
|||
BuildRequires: tinyxml2-devel >= 2.1.0
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: z3-devel >= 4.7.1
|
||||
BuildRequires: qt5-qtbase-devel
|
||||
BuildRequires: qt5-qttools-devel
|
||||
|
@ -62,8 +60,7 @@ from xml files first generated using cppcheck.
|
|||
%setup -q
|
||||
%patch0 -p1 -b .translations
|
||||
%patch1 -p1 -b .python3
|
||||
%patch2 -p1 -b .gcc11
|
||||
%patch3 -p1 -b .nullptrcheck
|
||||
%patch2 -p1 -b .tinyxml2
|
||||
# Make sure bundled tinyxml2 is not used
|
||||
rm -r externals/tinyxml2
|
||||
# Generate the Qt online-help file
|
||||
|
@ -92,9 +89,10 @@ install -D -p -m 644 gui/cppcheck-gui.png %{buildroot}%{_datadir}/pixmaps/cppche
|
|||
# Install the Qt online-help file
|
||||
install -D -p -m 644 gui/help/online-help.qhc %{buildroot}%{_datadir}/Cppcheck/help/online-help.qhc
|
||||
install -D -p -m 644 gui/help/online-help.qch %{buildroot}%{_datadir}/Cppcheck/help/online-help.qch
|
||||
|
||||
# Install htmlreport
|
||||
install -D -p -m 755 htmlreport/cppcheck-htmlreport %{buildroot}%{_bindir}/cppcheck-htmlreport
|
||||
# Restore execute permission of python files
|
||||
grep -l "#\!/usr/bin/env python3" %{buildroot}%{_datadir}/Cppcheck/addons/*.py | xargs chmod +x
|
||||
|
||||
%check
|
||||
cd %{_vpath_builddir}/bin
|
||||
|
@ -118,6 +116,18 @@ cd %{_vpath_builddir}/bin
|
|||
%{_bindir}/cppcheck-htmlreport
|
||||
|
||||
%changelog
|
||||
* Tue Feb 08 2022 Wolfgang Stöggl <c72578@yahoo.de> - 2.7-1
|
||||
- Update to 2.7.
|
||||
|
||||
* Sat Oct 02 2021 Wolfgang Stöggl <c72578@yahoo.de> - 2.6-1
|
||||
- Update to 2.6.
|
||||
|
||||
* Fri Jul 23 2021 Wolfgang Stöggl <c72578@yahoo.de> - 2.5-2
|
||||
- Fix Failed to load translation for English (#1983599)
|
||||
|
||||
* Sun Jul 04 2021 Wolfgang Stöggl <c72578@yahoo.de> - 2.5-1
|
||||
- Update to 2.5.
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
|
|
2
sources
2
sources
|
@ -1 +1 @@
|
|||
SHA512 (cppcheck-2.3.tar.gz) = ee15890f77c58847d4add7d555398e4bb83e3a73e942f218413b9830f05b2c975b49bf0aeb0092e0467f0cd7f26b9f05013f701dd80ee5e2aa3d2ef81945c4ed
|
||||
SHA512 (cppcheck-2.7.tar.gz) = 22da64126ec76fa2b3c533fe4c82d8c3a46a274bce78aa2495bffed5491c604891ba46684499a28a4a22ab928979e9388e52df36ad0e2b001b81619c26791aad
|
||||
|
|
Loading…
Reference in New Issue