test/cfg: Improved std.cfg and added corresponding test cases.

This commit is contained in:
Martin Ettl 2015-09-18 23:02:51 +02:00
parent fc4b9d320d
commit 841ad5462d
2 changed files with 123 additions and 2 deletions

View File

@ -3503,7 +3503,21 @@
</function>
<!-- double stod (const string& str, size_t* idx = 0); -->
<!-- double stod (const wstring& str, size_t* idx = 0); -->
<function name="std::stod">
<!-- float stof (const string& str, size_t* idx = 0); -->
<!-- float stof (const wstring& str, size_t* idx = 0); -->
<!-- int stoi (const string& str, size_t* idx = 0); -->
<!-- int stoi (const wstring& str, size_t* idx = 0); -->
<!-- long stol (const string& str, size_t* idx = 0); -->
<!-- long stol (const wstring& str, size_t* idx = 0); -->
<!-- long double stold (const string& str, size_t* idx = 0); -->
<!-- long double stold (const wstring& str, size_t* idx = 0); -->
<!-- long long stoll (const string& str, size_t* idx = 0); -->
<!-- long long stoll (const wstring& str, size_t* idx = 0); -->
<!-- unsigned long stoul (const string& str, size_t* idx = 0); -->
<!-- unsigned long stoul (const wstring& str, size_t* idx = 0); -->
<!-- unsigned long long stoull (const string& str, size_t* idx = 0); -->
<!-- unsigned long long stoull (const wstring& str, size_t* idx = 0); -->
<function name="std::stod,std::stof,std::stoi,std::stol,std::stold,std::stoll,std::stoul,std::stoull">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3514,6 +3528,23 @@
<not-uninit/>
</arg>
</function>
<!-- string to_string (int val); -->
<!-- string to_string (long val); -->
<!-- string to_string (long long val); -->
<!-- string to_string (unsigned val); -->
<!-- string to_string (unsigned long val); -->
<!-- string to_string (unsigned long long val); -->
<!-- string to_string (float val); -->
<!-- string to_string (double val); -->
<!-- string to_string (long double val);-->
<function name="std::to_string,std::to_wstring">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<!-- size_t mbrtowc(wchar_t* pwc, const char* pmb, size_t max, mbstate_t* ps); -->
<function name="mbrtowc,std::mbrtowc">
<noreturn>false</noreturn>

View File

@ -2489,7 +2489,7 @@ void uninivar_wcstof(void)
(void)std::wcstold(s,endp);
}
void uninivar_stod(void)
void uninivar_stoX(void)
{
std::string str;
std::wstring wstr;
@ -2498,6 +2498,96 @@ void uninivar_stod(void)
(void)std::stod(str,idx);
// cppcheck-suppress uninitvar
(void)std::stod(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stof(str,idx);
// cppcheck-suppress uninitvar
(void)std::stof(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stoi(str,idx);
// cppcheck-suppress uninitvar
(void)std::stoi(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stol(str,idx);
// cppcheck-suppress uninitvar
(void)std::stol(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stold(str,idx);
// cppcheck-suppress uninitvar
(void)std::stold(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stoll(str,idx);
// cppcheck-suppress uninitvar
(void)std::stoll(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stoul(str,idx);
// cppcheck-suppress uninitvar
(void)std::stoul(wstr,idx);
// cppcheck-suppress uninitvar
(void)std::stoull(str,idx);
// cppcheck-suppress uninitvar
(void)std::stoull(wstr,idx);
}
void uninivar_to_string(void)
{
int i;
long l;
long long ll;
unsigned u;
unsigned long ul;
unsigned long long ull;
float f;
double d;
long double ld;
// cppcheck-suppress uninitvar
(void)std::to_string(i);
// cppcheck-suppress uninitvar
(void)std::to_string(l);
// cppcheck-suppress uninitvar
(void)std::to_string(ll);
// cppcheck-suppress uninitvar
(void)std::to_string(u);
// cppcheck-suppress uninitvar
(void)std::to_string(ul);
// cppcheck-suppress uninitvar
(void)std::to_string(ull);
// cppcheck-suppress uninitvar
(void)std::to_string(f);
// cppcheck-suppress uninitvar
(void)std::to_string(d);
// cppcheck-suppress uninitvar
(void)std::to_string(ld);
}
void uninivar_to_wstring(void)
{
int i;
long l;
long long ll;
unsigned u;
unsigned long ul;
unsigned long long ull;
float f;
double d;
long double ld;
// cppcheck-suppress uninitvar
(void)std::to_wstring(i);
// cppcheck-suppress uninitvar
(void)std::to_wstring(l);
// cppcheck-suppress uninitvar
(void)std::to_wstring(ll);
// cppcheck-suppress uninitvar
(void)std::to_wstring(u);
// cppcheck-suppress uninitvar
(void)std::to_wstring(ul);
// cppcheck-suppress uninitvar
(void)std::to_wstring(ull);
// cppcheck-suppress uninitvar
(void)std::to_wstring(f);
// cppcheck-suppress uninitvar
(void)std::to_wstring(d);
// cppcheck-suppress uninitvar
(void)std::to_wstring(ld);
}
void uninivar_mbrtowc(void)