std.cfg: Add std::[w]string::compare() with tests (#1162)
This commit is contained in:
parent
9db64ca934
commit
3fc53eb122
32
cfg/std.cfg
32
cfg/std.cfg
|
@ -6090,6 +6090,38 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="char &"/>
|
||||
<noreturn>false</noreturn>
|
||||
</function>
|
||||
<!-- int compare( const basic_string& str ) const; -->
|
||||
<!-- int compare( size_type pos1, size_type count1, const basic_string& str ) const; -->
|
||||
<!-- int compare( size_type pos1, size_type count1, const basic_string& str, size_type pos2, size_type count2 ) const; // until C++14 -->
|
||||
<!-- int compare( size_type pos1, size_type count1, const basic_string& str, size_type pos2, size_type count2 = npos ) const; // since C++14 -->
|
||||
<!-- int compare( const CharT* s ) const; -->
|
||||
<!-- int compare( size_type pos1, size_type count1, const CharT* s ) const; -->
|
||||
<!-- int compare( size_type pos1, size_type count1, const CharT* s, size_type count2 ) const; -->
|
||||
<!-- template < class T > int compare( const T& t ) const; // since C++17 -->
|
||||
<!-- template < class T > int compare( size_type pos1, size_type count1, const T& t ) const; // since C++17 -->
|
||||
<!-- template < class T > int compare( size_type pos1, size_type count1, const T& t, size_type pos2, size_type count2 = npos) const; // since C++17 -->
|
||||
<function name="std::string::compare,std::wstring::compare">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="int"/>
|
||||
<use-retval/>
|
||||
<const/>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="4" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="5" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- void swap (string& str); -->
|
||||
<function name="std::string::swap">
|
||||
<noreturn>false</noreturn>
|
||||
|
|
|
@ -3019,6 +3019,17 @@ void uninivar_istream_read(std::istream &f)
|
|||
f.read(buffer, size);
|
||||
}
|
||||
|
||||
void uninitvar_string_compare(std::string &teststr, std::wstring &testwstr)
|
||||
{
|
||||
char *pStrUninit;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)teststr.compare(pStrUninit);
|
||||
|
||||
wchar_t *pWStrUninit;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)testwstr.compare(pWStrUninit);
|
||||
}
|
||||
|
||||
void invalidFunctionArgBool_abs(bool b, double x, double y)
|
||||
{
|
||||
// cppcheck-suppress invalidFunctionArgBool
|
||||
|
@ -3037,6 +3048,14 @@ void ignoredReturnValue_abs(int i)
|
|||
std::abs(-199);
|
||||
}
|
||||
|
||||
void ignoredReturnValue_string_compare(std::string teststr, std::wstring testwstr)
|
||||
{
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
teststr.compare("test");
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
testwstr.compare(L"wtest");
|
||||
}
|
||||
|
||||
void nullPointer_ifstream_read(std::ifstream &f)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
|
|
Loading…
Reference in New Issue