std.cfg: Added support for wmemcmp() and corresponding test cases.

This commit is contained in:
Martin Ettl 2015-09-23 22:46:36 +02:00
parent c27fc31fcf
commit 7476f0d1c2
3 changed files with 66 additions and 10 deletions

View File

@ -2319,6 +2319,28 @@
<valid>0:</valid>
</arg>
</function>
<!-- int wmemcmp (const wchar_t* ptr1, const wchar_t* ptr2, size_t num);-->
<function name="wmemcmp,std::wmemcmp">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-null/>
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="2">
<not-null/>
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- void * memcpy(void *ct, const void *cs, size_t n);-->
<function name="memcpy,std::memcpy">
<noreturn>false</noreturn>

View File

@ -177,7 +177,7 @@ void nullpointerMemchr2(char *p, char *s)
p = memchr(s, 0, strlen(s));
}
void nullpointerMemchr3(char *p)
void nullPointer_memchr(char *p)
{
char *s = 0;
// cppcheck-suppress nullPointer
@ -185,13 +185,17 @@ void nullpointerMemchr3(char *p)
p = memchr(s, 0, strlen(s));
}
void nullpointerMemcmp(char *p)
void nullPointer_memcmp(char *p)
{
// cppcheck-suppress ignoredReturnValue
// cppcheck-suppress nullPointer
memcmp(p, 0, 123);
(void)memcmp(p, 0, 123);
}
void nullPointer_wmemcmp(wchar_t *p)
{
// cppcheck-suppress nullPointer
(void)wmemcmp(p, 0, 123);
}
// uninit pointers
@ -2395,6 +2399,15 @@ void uninitvar_memcmp(void)
(void)memcmp(s1,s2,n);
}
void uninitvar_wmemcmp(void)
{
wchar_t *s1;
wchar_t *s2;
size_t n;
// cppcheck-suppress uninitvar
(void)wmemcmp(s1,s2,n);
}
void uninitvar_memcpy(void)
{
void *ct;

View File

@ -1747,6 +1747,15 @@ void uninitvar_memcmp(void)
(void)std::memcmp(s1,s2,n);
}
void uninitvar_wmemcmp(void)
{
wchar_t *s1;
wchar_t *s2;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wmemcmp(s1,s2,n);
}
void uninitvar_memcpy(void)
{
void *ct;
@ -2870,12 +2879,12 @@ void uninitvar_find(std::string s)
char c;
// cppcheck-suppress uninitvar
(void)s.find(c,pos);
/*
/*
// testing of size_t find (const char* pc, size_t pos, size_t n) const;
size_t n;
// cppcheck-suppress uninitvar
(void)s.find(pc,pos,n); // #6991
*/
*/
}
void invalidFunctionArgBool_abs(bool b, double x, double y)
@ -2986,3 +2995,15 @@ void nullPointer_atof(void)
// cppcheck-suppress nullPointer
(void)std::atof(0);
}
void nullPointer_memcmp(char *p)
{
// cppcheck-suppress nullPointer
(void)std::memcmp(p, 0, 123);
}
void nullPointer_wmemcmp(wchar_t *p)
{
// cppcheck-suppress nullPointer
(void)std::wmemcmp(p, 0, 123);
}