gnu: cppcheck: Update to 2.17.1.

* gnu/packages/check.scm (cppcheck): Update to 2.17.1.
Replace ‘cppcheck-disable-char-signedness-test.patch’ by
‘cppcheck-fix-basedir-test.patch’.
* gnu/packages/patches/cppcheck-disable-char-signedness-test.patch: Remove.
* gnu/packages/patches/cppcheck-fix-basedir-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Update accordingly.

Change-Id: Iebd33e2966ef30a3cd5b7b157f1051fcacbe1884
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Florent Pruvost 2025-04-11 15:42:38 +02:00 committed by Ludovic Courtès
parent 2caa8cb26f
commit 0f69a4df16
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 40 additions and 31 deletions

View file

@ -1145,7 +1145,7 @@ dist_patch_DATA = \
%D%/packages/patches/corefx-mono-5.4.0-patches.patch \
%D%/packages/patches/corefx-mono-pre-5.8.0-patches.patch \
%D%/packages/patches/coreutils-gnulib-tests.patch \
%D%/packages/patches/cppcheck-disable-char-signedness-test.patch \
%D%/packages/patches/cppcheck-fix-basedir-test.patch \
%D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\
%D%/packages/patches/cpulimit-with-glib-2.32.patch \
%D%/packages/patches/crawl-upgrade-saves.patch \

View file

@ -791,7 +791,7 @@ format.")
(define-public cppcheck
(package
(name "cppcheck")
(version "2.10.3")
(version "2.17.1")
(source (origin
(method git-fetch)
(uri (git-reference
@ -799,8 +799,8 @@ format.")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "1xfxcg00rxjrb9m2k78yd3jjlldkciv67fsbmjb6n3l43hgfxb9k"))
(patches (search-patches "cppcheck-disable-char-signedness-test.patch"))))
(base32 "19ap9ai9s4vsygyqfa215mrmpz4vki63d5b4qdb89zvbldaf3hlf"))
(patches (search-patches "cppcheck-fix-basedir-test.patch"))))
(build-system cmake-build-system)
(arguments
'(#:configure-flags '("-DBUILD_TESTS=ON")))

View file

@ -1,27 +0,0 @@
https://sources.debian.org/data/main/c/cppcheck/2.10-2/debian/patches/disable-some-tests-about-char-signedness
https://trac.cppcheck.net/ticket/11537
Description: Disable some tests affected by char signedness.
Author: Joachim Reichel <reichel@debian.org>
Bug: https://trac.cppcheck.net/ticket/11537
Index: cppcheck/test/testcondition.cpp
===================================================================
--- cppcheck.orig/test/testcondition.cpp
+++ cppcheck/test/testcondition.cpp
@@ -4939,6 +4939,7 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (style) Condition 'it!=vector.end()' is always true\n", errout.str());
+#if 0
// #11303
check("void f(int n) {\n"
" std::vector<char> buffer(n);\n"
@@ -4947,6 +4948,7 @@ private:
" buffer.back() == '\\0') {}\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5]: (style) Condition 'buffer.back()=='\\0'' is always false\n", errout.str());
+#endif
// #9353
check("typedef struct { std::string s; } X;\n"

View file

@ -0,0 +1,36 @@
Fix the test "TestFileLister" by giving precisely the source directory instead of guessing it.
Author: Florent Pruvost <florent.pruvost@inria.fr>
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 467e6e95e..d68d83e3d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -85,6 +85,7 @@ if (BUILD_TESTS)
elseif(TEST ${NAME})
else()
add_test(NAME ${NAME} COMMAND $<TARGET_FILE:testrunner> ${NAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ set_tests_properties(${NAME} PROPERTIES ENVIRONMENT "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}")
endif()
endfunction()
diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp
index 3e2f56dfc..ecf0f9c6e 100644
--- a/test/testfilelister.cpp
+++ b/test/testfilelister.cpp
@@ -45,15 +45,7 @@ private:
// TODO: generate file list instead
static std::string findBaseDir() {
- std::string basedir;
- while (!Path::isDirectory(Path::join(basedir, ".github"))) {
- const std::string abspath = Path::getAbsoluteFilePath(basedir);
- basedir += "../";
- // no more going up
- if (Path::getAbsoluteFilePath(basedir) == abspath)
- throw std::runtime_error("could not find repository root directory");
- }
- return basedir;
+ return Path::getAbsoluteFilePath(std::getenv("PROJECT_SOURCE_DIR")) + "/";
}
void recursiveAddFiles() const {