Fix constParameterPointer regression (#5361)

Commit 73251544a ("Fix #11842 FN constParameterPointer with library
function (#5257)") most likely introduced a regression for (C) function
pointers passed to functions provided by the standard library that
cppcheck has knowledge about.
This commit is contained in:
Anton Lindqvist 2023-08-23 10:33:01 +02:00 committed by GitHub
parent e35d5d3ceb
commit 73b9442edd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -4445,7 +4445,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<arg nr="4">
<not-null/>
<not-uninit/>
<not-bool/>

View File

@ -3808,6 +3808,11 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:1]: (style) Parameter 'p' can be declared as pointer to const\n",
errout.str());
check("void f(void *p, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) {\n"
" qsort(p, nmemb, size, cmp);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void switchRedundantAssignmentTest() {