Skip to content

Commit 841ad54

Browse files
committed
test/cfg: Improved std.cfg and added corresponding test cases.
1 parent fc4b9d3 commit 841ad54

2 files changed

Lines changed: 123 additions & 2 deletions

File tree

cfg/std.cfg

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3503,7 +3503,21 @@
35033503
</function>
35043504
<!-- double stod (const string& str, size_t* idx = 0); -->
35053505
<!-- double stod (const wstring& str, size_t* idx = 0); -->
3506-
<function name="std::stod">
3506+
<!-- float stof (const string& str, size_t* idx = 0); -->
3507+
<!-- float stof (const wstring& str, size_t* idx = 0); -->
3508+
<!-- int stoi (const string& str, size_t* idx = 0); -->
3509+
<!-- int stoi (const wstring& str, size_t* idx = 0); -->
3510+
<!-- long stol (const string& str, size_t* idx = 0); -->
3511+
<!-- long stol (const wstring& str, size_t* idx = 0); -->
3512+
<!-- long double stold (const string& str, size_t* idx = 0); -->
3513+
<!-- long double stold (const wstring& str, size_t* idx = 0); -->
3514+
<!-- long long stoll (const string& str, size_t* idx = 0); -->
3515+
<!-- long long stoll (const wstring& str, size_t* idx = 0); -->
3516+
<!-- unsigned long stoul (const string& str, size_t* idx = 0); -->
3517+
<!-- unsigned long stoul (const wstring& str, size_t* idx = 0); -->
3518+
<!-- unsigned long long stoull (const string& str, size_t* idx = 0); -->
3519+
<!-- unsigned long long stoull (const wstring& str, size_t* idx = 0); -->
3520+
<function name="std::stod,std::stof,std::stoi,std::stol,std::stold,std::stoll,std::stoul,std::stoull">
35073521
<use-retval/>
35083522
<noreturn>false</noreturn>
35093523
<leak-ignore/>
@@ -3514,6 +3528,23 @@
35143528
<not-uninit/>
35153529
</arg>
35163530
</function>
3531+
<!-- string to_string (int val); -->
3532+
<!-- string to_string (long val); -->
3533+
<!-- string to_string (long long val); -->
3534+
<!-- string to_string (unsigned val); -->
3535+
<!-- string to_string (unsigned long val); -->
3536+
<!-- string to_string (unsigned long long val); -->
3537+
<!-- string to_string (float val); -->
3538+
<!-- string to_string (double val); -->
3539+
<!-- string to_string (long double val);-->
3540+
<function name="std::to_string,std::to_wstring">
3541+
<use-retval/>
3542+
<noreturn>false</noreturn>
3543+
<leak-ignore/>
3544+
<arg nr="1">
3545+
<not-uninit/>
3546+
</arg>
3547+
</function>
35173548
<!-- size_t mbrtowc(wchar_t* pwc, const char* pmb, size_t max, mbstate_t* ps); -->
35183549
<function name="mbrtowc,std::mbrtowc">
35193550
<noreturn>false</noreturn>

test/cfg/std.cpp

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,7 @@ void uninivar_wcstof(void)
24892489
(void)std::wcstold(s,endp);
24902490
}
24912491

2492-
void uninivar_stod(void)
2492+
void uninivar_stoX(void)
24932493
{
24942494
std::string str;
24952495
std::wstring wstr;
@@ -2498,6 +2498,96 @@ void uninivar_stod(void)
24982498
(void)std::stod(str,idx);
24992499
// cppcheck-suppress uninitvar
25002500
(void)std::stod(wstr,idx);
2501+
// cppcheck-suppress uninitvar
2502+
(void)std::stof(str,idx);
2503+
// cppcheck-suppress uninitvar
2504+
(void)std::stof(wstr,idx);
2505+
// cppcheck-suppress uninitvar
2506+
(void)std::stoi(str,idx);
2507+
// cppcheck-suppress uninitvar
2508+
(void)std::stoi(wstr,idx);
2509+
// cppcheck-suppress uninitvar
2510+
(void)std::stol(str,idx);
2511+
// cppcheck-suppress uninitvar
2512+
(void)std::stol(wstr,idx);
2513+
// cppcheck-suppress uninitvar
2514+
(void)std::stold(str,idx);
2515+
// cppcheck-suppress uninitvar
2516+
(void)std::stold(wstr,idx);
2517+
// cppcheck-suppress uninitvar
2518+
(void)std::stoll(str,idx);
2519+
// cppcheck-suppress uninitvar
2520+
(void)std::stoll(wstr,idx);
2521+
// cppcheck-suppress uninitvar
2522+
(void)std::stoul(str,idx);
2523+
// cppcheck-suppress uninitvar
2524+
(void)std::stoul(wstr,idx);
2525+
// cppcheck-suppress uninitvar
2526+
(void)std::stoull(str,idx);
2527+
// cppcheck-suppress uninitvar
2528+
(void)std::stoull(wstr,idx);
2529+
}
2530+
2531+
void uninivar_to_string(void)
2532+
{
2533+
int i;
2534+
long l;
2535+
long long ll;
2536+
unsigned u;
2537+
unsigned long ul;
2538+
unsigned long long ull;
2539+
float f;
2540+
double d;
2541+
long double ld;
2542+
// cppcheck-suppress uninitvar
2543+
(void)std::to_string(i);
2544+
// cppcheck-suppress uninitvar
2545+
(void)std::to_string(l);
2546+
// cppcheck-suppress uninitvar
2547+
(void)std::to_string(ll);
2548+
// cppcheck-suppress uninitvar
2549+
(void)std::to_string(u);
2550+
// cppcheck-suppress uninitvar
2551+
(void)std::to_string(ul);
2552+
// cppcheck-suppress uninitvar
2553+
(void)std::to_string(ull);
2554+
// cppcheck-suppress uninitvar
2555+
(void)std::to_string(f);
2556+
// cppcheck-suppress uninitvar
2557+
(void)std::to_string(d);
2558+
// cppcheck-suppress uninitvar
2559+
(void)std::to_string(ld);
2560+
}
2561+
2562+
void uninivar_to_wstring(void)
2563+
{
2564+
int i;
2565+
long l;
2566+
long long ll;
2567+
unsigned u;
2568+
unsigned long ul;
2569+
unsigned long long ull;
2570+
float f;
2571+
double d;
2572+
long double ld;
2573+
// cppcheck-suppress uninitvar
2574+
(void)std::to_wstring(i);
2575+
// cppcheck-suppress uninitvar
2576+
(void)std::to_wstring(l);
2577+
// cppcheck-suppress uninitvar
2578+
(void)std::to_wstring(ll);
2579+
// cppcheck-suppress uninitvar
2580+
(void)std::to_wstring(u);
2581+
// cppcheck-suppress uninitvar
2582+
(void)std::to_wstring(ul);
2583+
// cppcheck-suppress uninitvar
2584+
(void)std::to_wstring(ull);
2585+
// cppcheck-suppress uninitvar
2586+
(void)std::to_wstring(f);
2587+
// cppcheck-suppress uninitvar
2588+
(void)std::to_wstring(d);
2589+
// cppcheck-suppress uninitvar
2590+
(void)std::to_wstring(ld);
25012591
}
25022592

25032593
void uninivar_mbrtowc(void)

0 commit comments

Comments
 (0)