test/cfg: Improved testing of std.cfg.

This commit is contained in:
Martin Ettl 2015-08-29 00:09:33 +02:00
parent f8083e9fba
commit 08413f0112
4 changed files with 141 additions and 7 deletions

View File

@ -611,7 +611,7 @@
</arg>
</function>
<!-- char * ctime(const time_t *tp); -->
<function name="ctime">
<function name="ctime,std::ctime">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -621,7 +621,7 @@
</arg>
</function>
<!-- double difftime(time_t time2, time_t time1); -->
<function name="difftime">
<function name="difftime,std::difftime">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -633,7 +633,7 @@
</arg>
</function>
<!-- div_t div(int num, int denom); -->
<function name="div">
<function name="div,std::div">
<pure/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -646,7 +646,7 @@
</arg>
</function>
<!-- void exit(int status); -->
<function name="exit">
<function name="exit,std::exit">
<noreturn>true</noreturn>
<arg nr="1">
<not-uninit/>
@ -655,7 +655,7 @@
<!-- double erf(double x); -->
<!-- float erff(float f); -->
<!-- long double erfl(long double x); -->
<function name="erf,erff,erfl">
<function name="erf,std::erf,erff,erfl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -667,7 +667,7 @@
<!-- double erfc(double x); -->
<!-- float erfcf(float x); -->
<!-- long double erfcl(long double x); -->
<function name="erfc,erfcf,erfcl">
<function name="erfc,std::erfc,erfcf,erfcl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>

View File

@ -1422,7 +1422,8 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
return false;
}
bool Variable::isPointerArray() const {
bool Variable::isPointerArray() const
{
return isArray() && nameToken() && nameToken()->previous() && (nameToken()->previous()->str() == "*");
}

View File

@ -904,6 +904,80 @@ void uninitvar_cosh(void)
(void)coshl(ld);
}
void uninitvar_ccosh(void)
{
float complex fd;
// cppcheck-suppress uninitvar
(void)ccoshf(fd);
double complex dc;
// cppcheck-suppress uninitvar
(void)ccosh(dc);
long double complex ldc;
// cppcheck-suppress uninitvar
(void)ccoshl(ldc);
}
void uninitvar_ctime(void)
{
time_t *tp;
// cppcheck-suppress uninitvar
(void)ctime(tp);
}
void uninitvar_difftime(void)
{
time_t t1,t2;
// cppcheck-suppress uninitvar
(void)difftime(t1, t2);
}
void uninitvar_div(void)
{
int num;
int denom;
// cppcheck-suppress uninitvar
(void)div(num,denom);
}
void uninitvar_exit(void)
{
int i;
// cppcheck-suppress uninitvar
exit(i);
}
void uninitvar_erf(void)
{
float f;
// cppcheck-suppress uninitvar
(void)erff(f);
double d;
// cppcheck-suppress uninitvar
(void)erf(d);
long double ld;
// cppcheck-suppress uninitvar
(void)erfl(ld);
}
void uninitvar_erfc(void)
{
float f;
// cppcheck-suppress uninitvar
(void)erfcf(f);
double d;
// cppcheck-suppress uninitvar
(void)erfc(d);
long double ld;
// cppcheck-suppress uninitvar
(void)erfcl(ld);
}
void ignoreretrn(void)
{
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";

View File

@ -486,3 +486,62 @@ void uninitvar_feupdateenv(void)
// cppcheck-suppress uninitvar
(void)std::feupdateenv(envp);
}
void uninitvar_ctime(void)
{
time_t *tp;
// cppcheck-suppress uninitvar
(void)std::ctime(tp);
}
void uninitvar_difftime(void)
{
time_t t1,t2;
// cppcheck-suppress uninitvar
(void)std::difftime(t1, t2);
}
void uninitvar_div(void)
{
int num;
int denom;
// cppcheck-suppress uninitvar
(void)std::div(num,denom);
}
void uninitvar_exit(void)
{
int i;
// cppcheck-suppress uninitvar
std::exit(i);
}
void uninitvar_erf(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::erf(f);
double d;
// cppcheck-suppress uninitvar
(void)std::erf(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::erf(ld);
}
void uninitvar_erfc(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::erfc(f);
double d;
// cppcheck-suppress uninitvar
(void)std::erfc(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::erfc(ld);
}