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
-
+
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
-
+
diff --git a/lib/astutils.cpp b/lib/astutils.cpp
index f16144310ac..bed7eca56b2 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(ftok, argnr + 1, indirect);
+ if (argDirection == Library::ArgumentChecks::Direction::DIR_IN)
+ return ExprUsage::Used;
}
return ExprUsage::Inconclusive;
}
diff --git a/test/cfg/posix.c b/test/cfg/posix.c
index 2e53d171dec..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);
@@ -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);
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 7e406ca2187..a3c66724acb 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
@@ -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), [](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), [](int& 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;