std.cfg: Merged 'wcscmp' and 'strcmp' configurations and added better tests.
This commit is contained in:
parent
20e2c513b6
commit
dd30f37642
21
cfg/std.cfg
21
cfg/std.cfg
|
@ -4621,25 +4621,8 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int strcmp(const char *str1, const char *str2); -->
|
<!-- int strcmp(const char *str1, const char *str2); -->
|
||||||
<function name="strcmp,std::strcmp">
|
|
||||||
<use-retval/>
|
|
||||||
<pure/>
|
|
||||||
<returnValue type="int"/>
|
|
||||||
<noreturn>false</noreturn>
|
|
||||||
<leak-ignore/>
|
|
||||||
<arg nr="1" direction="in">
|
|
||||||
<not-null/>
|
|
||||||
<not-uninit/>
|
|
||||||
<strz/>
|
|
||||||
</arg>
|
|
||||||
<arg nr="2" direction="in">
|
|
||||||
<not-null/>
|
|
||||||
<not-uninit/>
|
|
||||||
<strz/>
|
|
||||||
</arg>
|
|
||||||
</function>
|
|
||||||
<!-- int wcscmp(const wchar_t *str1, const wchar_t c); -->
|
<!-- int wcscmp(const wchar_t *str1, const wchar_t c); -->
|
||||||
<function name="wcscmp,std::wcscmp">
|
<function name="strcmp,std::strcmp,wcscmp,std::wcscmp">
|
||||||
<use-retval/>
|
<use-retval/>
|
||||||
<pure/>
|
<pure/>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
|
@ -4648,10 +4631,12 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
<strz/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="2" direction="in">
|
<arg nr="2" direction="in">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
<strz/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- char *strcpy(char *desstr, const char *srcstr); -->
|
<!-- char *strcpy(char *desstr, const char *srcstr); -->
|
||||||
|
|
|
@ -3041,28 +3041,52 @@ void uninitvar_wcschr(void)
|
||||||
(void)wcschr(cs,c);
|
(void)wcschr(cs,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_strcmp(void)
|
void uninitvar_strcmp(char *s1, char *s2)
|
||||||
{
|
{
|
||||||
char *str1;
|
char *str1;
|
||||||
char *str2;
|
char *str2;
|
||||||
|
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strcmp(str1,s2);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strcmp(s1,str2);
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
(void)strcmp(str1,str2);
|
(void)strcmp(str1,str2);
|
||||||
|
|
||||||
|
// No warning is expected
|
||||||
|
(void)strcmp(s1,s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_wcscmp(void)
|
void uninitvar_wcscmp(wchar_t *s1, wchar_t *s2)
|
||||||
{
|
{
|
||||||
wchar_t *str1;
|
wchar_t *str1;
|
||||||
wchar_t *str2;
|
wchar_t *str2;
|
||||||
|
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)wcscmp(str1,s2);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)wcscmp(s1,str2);
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
(void)wcscmp(str1,str2);
|
(void)wcscmp(str1,str2);
|
||||||
|
|
||||||
|
// No warning is expected
|
||||||
|
(void)wcscmp(s1,s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_strcpy(void)
|
void uninitvar_strcpy(char *d, char *s)
|
||||||
{
|
{
|
||||||
char *str1;
|
char *dest;
|
||||||
char *str2;
|
char *src;
|
||||||
|
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
(void)strcpy(str1,str2);
|
(void)strcpy(dest,s);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strcpy(d,src);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strcpy(dest,src);
|
||||||
|
|
||||||
|
// No warning is expected
|
||||||
|
(void)strcpy(d,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_strcpy_s(char * strDest)
|
void uninitvar_strcpy_s(char * strDest)
|
||||||
|
|
Loading…
Reference in New Issue