std.cfg: Fixed false negatives regarding uninitialized variable usage and added test cases.
This commit is contained in:
parent
0b782853fe
commit
12b4bf75e0
|
@ -3087,6 +3087,7 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
|
@ -3098,12 +3099,15 @@
|
|||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<strz/>
|
||||
<minsize type="argvalue" arg="3"/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
|
@ -3123,6 +3127,7 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
|
@ -3142,6 +3147,7 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
|
|
|
@ -2975,40 +2975,76 @@ void uninivar_strpbrk(void)
|
|||
(void)strpbrk(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_strncat(void)
|
||||
void uninivar_strncat(char *Ct, char *S, size_t N)
|
||||
{
|
||||
char *ct;
|
||||
char *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncat(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncat(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncat(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncat(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)strncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncat(void)
|
||||
void uninivar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct;
|
||||
wchar_t *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncat(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncat(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncat(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncat(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)wcsncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_strncmp(void)
|
||||
void uninivar_strncmp(char *Ct, char *S, size_t N)
|
||||
{
|
||||
char *ct;
|
||||
char *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncmp(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncmp(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncmp(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)strncmp(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)strncmp(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncmp(void)
|
||||
void uninivar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct;
|
||||
wchar_t *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncmp(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncmp(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncmp(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)wcsncmp(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)wcsncmp(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_strstr(void)
|
||||
|
|
|
@ -2304,40 +2304,76 @@ void uninivar_strpbrk(void)
|
|||
(void)std::strpbrk(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_strncat(void)
|
||||
void uninivar_strncat(char *Ct, char *S, size_t N)
|
||||
{
|
||||
char *ct;
|
||||
char *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncat(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncat(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncat(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncat(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)std::strncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncat(void)
|
||||
void uninivar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct;
|
||||
wchar_t *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncat(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncat(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncat(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncat(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)std::wcsncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_strncmp(void)
|
||||
void uninivar_strncmp(char *Ct, char *S, size_t N)
|
||||
{
|
||||
char *ct;
|
||||
char *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncmp(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncmp(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncmp(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncmp(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)std::strncmp(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncmp(void)
|
||||
void uninivar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct;
|
||||
wchar_t *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncmp(ct,s,n);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncmp(ct,S,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncmp(Ct,s,N);
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncmp(Ct,S,n);
|
||||
|
||||
// no warning is expected for
|
||||
(void)std::wcsncmp(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_strstr(void)
|
||||
|
|
Loading…
Reference in New Issue