From c23aef989a57abe703d4c9e0ed16df5d235bdbdd Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 10:18:22 +0200
Subject: [PATCH 1/9] Update astutils.cpp
---
lib/astutils.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/astutils.cpp b/lib/astutils.cpp
index f16144310ac..37e815ff2a0 100644
--- a/lib/astutils.cpp
+++ b/lib/astutils.cpp
@@ -3471,6 +3471,9 @@ static ExprUsage getFunctionUsage(const Token* tok, int indirect, const Settings
const bool isuninitbad = settings.library.isuninitargbad(ftok, argnr + 1, indirect, &hasIndirect);
if (isuninitbad && (!addressOf || isnullbad))
return ExprUsage::Used;
+ const Library::ArgumentChecks::Direction argDirection = settings.library.getArgDirection(tok, argnr + 1, indirect);
+ if (argDirection == Library::ArgumentChecks::Direction::DIR_IN)
+ return ExprUsage::Used;
}
return ExprUsage::Inconclusive;
}
From 4930d4c162fdea06b0df0d375d5f1b73c5b4633b Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 10:19:36 +0200
Subject: [PATCH 2/9] Update posix.c
---
test/cfg/posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/cfg/posix.c b/test/cfg/posix.c
index 2e53d171dec..61588b670bd 100644
--- a/test/cfg/posix.c
+++ b/test/cfg/posix.c
@@ -1408,7 +1408,7 @@ void timet_h(const struct timespec* ptp1)
clock_settime(clk_id2, ptp1);
struct timespec tp;
- // FIXME cppcheck-suppress uninitvar
+ // cppcheck-suppress uninitvar
clock_settime(CLOCK_REALTIME, &tp); // #6577 - false negative
// cppcheck-suppress uninitvar
clock_settime(clk_id3, &tp);
From 520f6152490d2f69a7a3807983f6fc22c0b10fa0 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 10:27:10 +0200
Subject: [PATCH 3/9] Update astutils.cpp
---
lib/astutils.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/astutils.cpp b/lib/astutils.cpp
index 37e815ff2a0..bed7eca56b2 100644
--- a/lib/astutils.cpp
+++ b/lib/astutils.cpp
@@ -3471,7 +3471,7 @@ static ExprUsage getFunctionUsage(const Token* tok, int indirect, const Settings
const bool isuninitbad = settings.library.isuninitargbad(ftok, argnr + 1, indirect, &hasIndirect);
if (isuninitbad && (!addressOf || isnullbad))
return ExprUsage::Used;
- const Library::ArgumentChecks::Direction argDirection = settings.library.getArgDirection(tok, argnr + 1, indirect);
+ const Library::ArgumentChecks::Direction argDirection = settings.library.getArgDirection(ftok, argnr + 1, indirect);
if (argDirection == Library::ArgumentChecks::Direction::DIR_IN)
return ExprUsage::Used;
}
From dd7991ddac52cd74340f05e7a044df203e1b97ac Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 10:43:43 +0200
Subject: [PATCH 4/9] Update gtk.cfg
---
cfg/gtk.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cfg/gtk.cfg b/cfg/gtk.cfg
index 4dd9700c62c..9b89a069903 100644
--- a/cfg/gtk.cfg
+++ b/cfg/gtk.cfg
@@ -8761,7 +8761,7 @@
false
-
+
From 3558d71cd6d6a8e379457bd5f16b923f0bd30a49 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 11:06:14 +0200
Subject: [PATCH 5/9] Update posix.c [skip ci]
---
test/cfg/posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/cfg/posix.c b/test/cfg/posix.c
index 61588b670bd..52607fe3a98 100644
--- a/test/cfg/posix.c
+++ b/test/cfg/posix.c
@@ -1312,7 +1312,7 @@ void uninitvar(int fd)
pthread_mutex_t mutex, mutex1, mutex2, mutex3;
// cppcheck-suppress uninitvar
write(x1,"ab",2);
- // TODO cppcheck-suppress uninitvar
+ // cppcheck-suppress uninitvar
write(fd,buf,2); // #6325
// cppcheck-suppress uninitvar
write(fd,"ab",x2);
From 95381ebaa44fbde5162ec99c3e346448771cb170 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 11:07:36 +0200
Subject: [PATCH 6/9] Update std.cfg
---
cfg/std.cfg | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cfg/std.cfg b/cfg/std.cfg
index 70e9cc17746..e7dff21da96 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -8751,7 +8751,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
false
-
+
@@ -8759,7 +8759,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
false
-
+
From c0f6224b3d6f70f2cab4173d5b693de5811b9a89 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 11:29:39 +0200
Subject: [PATCH 7/9] Update std.cpp
---
test/cfg/std.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 7e406ca2187..9dac4fa314d 100644
--- a/test/cfg/std.cpp
+++ b/test/cfg/std.cpp
@@ -5003,7 +5003,7 @@ void beginEnd()
//cppcheck-suppress ignoredReturnValue
std::crend(v);
- // cppcheck-suppress constVariable
+ // TODO cppcheck-suppress constVariable
int arr[4];
//cppcheck-suppress ignoredReturnValue
From c76820039eeee442faa5e25f0cbb22c180bea9b6 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 13:48:17 +0200
Subject: [PATCH 8/9] Update std.cpp
---
test/cfg/std.cpp | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 9dac4fa314d..31503e6bd85 100644
--- a/test/cfg/std.cpp
+++ b/test/cfg/std.cpp
@@ -5025,6 +5025,32 @@ void beginEnd()
std::crend(arr);
}
+struct S_constParameter_std_begin { // #11617
+ int a[2];
+};
+
+struct T_constParameter_std_begin {
+ std::vector v;
+};
+
+void f(S_constParameter_std_begin& s) {
+ std::for_each(std::begin(s.a), std::end(s.a), [](auto& i) { ++i; });
+}
+
+// cppcheck-suppress constParameterReference - FP
+void f(T_constParameter_std_begin& t) {
+ std::for_each(std::begin(t.v), std::end(t.v), [](auto& i) { ++i; });
+}
+
+void g_constVariable_std_begin(int* p) { *p = 0; }
+
+int f_constVariable_std_begin() {
+ int arr[1];
+ g_constVariable_std_begin(std::begin(arr));
+ *std::begin(arr) = 1;
+ return arr[0];
+}
+
void smartPtr_get()
{
std::unique_ptr p;
From d9476d60160f05c5588728de4d0b75f5b3914698 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Wed, 8 Apr 2026 14:06:45 +0200
Subject: [PATCH 9/9] Update std.cpp
---
test/cfg/std.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 31503e6bd85..a3c66724acb 100644
--- a/test/cfg/std.cpp
+++ b/test/cfg/std.cpp
@@ -5034,12 +5034,12 @@ struct T_constParameter_std_begin {
};
void f(S_constParameter_std_begin& s) {
- std::for_each(std::begin(s.a), std::end(s.a), [](auto& i) { ++i; });
+ std::for_each(std::begin(s.a), std::end(s.a), [](int& i) { ++i; });
}
// cppcheck-suppress constParameterReference - FP
void f(T_constParameter_std_begin& t) {
- std::for_each(std::begin(t.v), std::end(t.v), [](auto& i) { ++i; });
+ std::for_each(std::begin(t.v), std::end(t.v), [](int& i) { ++i; });
}
void g_constVariable_std_begin(int* p) { *p = 0; }