test/cfg: Improved testing of std.cfg. Fixed false negatives by adding more stdandard namespace functions and test cases.

This commit is contained in:
Martin Ettl 2015-08-29 01:43:17 +02:00
parent 08413f0112
commit 0e3b74fbbc
3 changed files with 373 additions and 15 deletions

View File

@ -691,7 +691,7 @@
<!-- double exp(double x); -->
<!-- float expf(float x); -->
<!-- long double expl(long double x); -->
<function name="exp,expf,expl">
<function name="exp,std::exp,expf,expl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -715,7 +715,7 @@
<!-- double complex cimag(double complex x); -->
<!-- float complex cimagf(float complex x); -->
<!-- long double complex cimagl(long double complex x); -->
<function name="cimagl,cimagf,cimagl">
<function name="cimag,cimagf,cimagl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -727,7 +727,7 @@
<!-- double exp2(double x); -->
<!-- float exp2f(float x); -->
<!-- long double exp2l(long double x);-->
<function name="exp2,exp2f,exp2l">
<function name="exp2,std::exp2,exp2f,exp2l">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -739,7 +739,7 @@
<!-- double expm1(double x); -->
<!-- float expm1f(float x); -->
<!-- long double expm1l(long double x); -->
<function name="expm1,expm1f,expm1l">
<function name="expm1,std::expm1,expm1f,expm1l">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -751,7 +751,7 @@
<!-- double fabs(double x); -->
<!-- float fabsf(float x); -->
<!-- long double fabsl(long double x); -->
<function name="fabs,fabsf,fabsl">
<function name="fabs,std::fabs,fabsf,fabsl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -763,7 +763,7 @@
<!-- double fdim(double x, double y); -->
<!-- float fdimf(float x, float y); -->
<!-- long double fdiml(long double x, long double y); -->
<function name="fdim,fdimffdiml">
<function name="fdim,std::fdim,fdimf,fdiml">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -776,7 +776,7 @@
</arg>
</function>
<!-- int fclose(FILE * stream); -->
<function name="fclose">
<function name="fclose,std::fclose">
<noreturn>false</noreturn>
<arg nr="1">
<not-null/>
@ -784,7 +784,7 @@
</arg>
</function>
<!-- int feof(FILE *stream); -->
<function name="feof">
<function name="feof,std::feof">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -794,7 +794,7 @@
</arg>
</function>
<!-- int ferror(FILE *stream);-->
<function name="ferror">
<function name="ferror,std::ferror">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -804,7 +804,7 @@
</arg>
</function>
<!-- int fflush(FILE *stream); -->
<function name="fflush">
<function name="fflush,std::fflush">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -812,7 +812,7 @@
</arg>
</function>
<!-- int fgetc(FILE *stream); -->
<function name="fgetc">
<function name="fgetc,std::fgetc">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -821,7 +821,7 @@
</arg>
</function>
<!-- wint_t fgetwc(FILE * stream); -->
<function name="fgetwc">
<function name="fgetwc,std::fgetwc">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -830,7 +830,7 @@
</arg>
</function>
<!-- int fgetpos(FILE* stream, fpos_t *ptr); -->
<function name="fgetpos">
<function name="fgetpos,std::fgetpos">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -844,7 +844,7 @@
<!-- double floor(double x); -->
<!-- float floorf(float x); -->
<!-- long double floorl(long double x); -->
<function name="floor,floorf,floorl">
<function name="floor,std::floor,floorf,floorl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -856,7 +856,7 @@
<!-- double fma(double x, double y, double z); -->
<!-- float fmaf(float x, float y, float z); -->
<!-- long double fmal(long double x, long double y, long double z); -->
<function name="fma,fmaf,fmal">
<function name="fma,std::fma,fmaf,fmal">
<use-retval/>
<pure/>
<noreturn>false</noreturn>

View File

@ -978,6 +978,207 @@ void uninitvar_erfc(void)
(void)erfcl(ld);
}
void uninitvar_carg(void)
{
float complex fd;
// cppcheck-suppress uninitvar
(void)cargf(fd);
double complex dc;
// cppcheck-suppress uninitvar
(void)carg(dc);
long double complex ldc;
// cppcheck-suppress uninitvar
(void)cargl(ldc);
}
void uninitvar_exp(void)
{
float f;
// cppcheck-suppress uninitvar
(void)expf(f);
double d;
// cppcheck-suppress uninitvar
(void)exp(d);
long double ld;
// cppcheck-suppress uninitvar
(void)expl(ld);
}
void uninitvar_cexp(void)
{
float complex fd;
// cppcheck-suppress uninitvar
(void)cexpf(fd);
double complex dc;
// cppcheck-suppress uninitvar
(void)cexp(dc);
long double complex ldc;
// cppcheck-suppress uninitvar
(void)cexpl(ldc);
}
void uninitvar_cimag(void)
{
float complex fd;
// cppcheck-suppress uninitvar
(void)cimagf(fd);
double complex dc;
// cppcheck-suppress uninitvar
(void)cimag(dc);
long double complex ldc;
// cppcheck-suppress uninitvar
(void)cimagl(ldc);
}
void uninitvar_exp2(void)
{
float f;
// cppcheck-suppress uninitvar
(void)exp2f(f);
double d;
// cppcheck-suppress uninitvar
(void)exp2(d);
long double ld;
// cppcheck-suppress uninitvar
(void)exp2l(ld);
}
void uninitvar_expm1(void)
{
float f;
// cppcheck-suppress uninitvar
(void)expm1f(f);
double d;
// cppcheck-suppress uninitvar
(void)expm1(d);
long double ld;
// cppcheck-suppress uninitvar
(void)expm1l(ld);
}
void uninitvar_fabs(void)
{
float f;
// cppcheck-suppress uninitvar
(void)fabsf(f);
double d;
// cppcheck-suppress uninitvar
(void)fabs(d);
long double ld;
// cppcheck-suppress uninitvar
(void)fabsl(ld);
}
void uninitvar_fdim(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)fdimf(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)fdim(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)fdiml(ld1,ld2);
}
void uninitvar_fclose(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)fclose(stream);
}
void uninitvar_feof(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)feof(stream);
}
void uninitvar_ferror(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)ferror(stream);
}
void uninitvar_fflush(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)fflush(stream);
}
void uninitvar_fgetc(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)fgetc(stream);
}
void uninitvar_fgetwc(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)fgetwc(stream);
}
void uninitvar_fgetpos(void)
{
FILE* stream;
fpos_t *ptr;
// cppcheck-suppress uninitvar
(void)fgetpos(stream,ptr);
}
void uninitvar_floor(void)
{
float f;
// cppcheck-suppress uninitvar
(void)floorf(f);
double d;
// cppcheck-suppress uninitvar
(void)floor(d);
long double ld;
// cppcheck-suppress uninitvar
(void)floorl(ld);
}
#if 0 // #6958
void uninitvar_fma(void)
{
float f1,f2,f3;
// cppcheck-suppress uninitvar
(void)fmaf(f1,f2,f3);
double d1,d2,d3;
// cppcheck-suppress uninitvar
(void)fma(d1,d2,d3);
long double ld1,ld2,ld3;
// cppcheck-suppress uninitvar
(void)fmal(ld1,ld2,ld3);
}
#endif
void ignoreretrn(void)
{
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";

View File

@ -545,3 +545,160 @@ void uninitvar_erfc(void)
// cppcheck-suppress uninitvar
(void)std::erfc(ld);
}
void uninitvar_exp(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::exp(f);
double d;
// cppcheck-suppress uninitvar
(void)std::exp(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::exp(ld);
}
void uninitvar_exp2(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::exp2(f);
double d;
// cppcheck-suppress uninitvar
(void)std::exp2(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::exp2(ld);
}
void uninitvar_expm1(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::expm1(f);
double d;
// cppcheck-suppress uninitvar
(void)std::expm1(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::expm1(ld);
}
void uninitvar_fabs(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::fabs(f);
double d;
// cppcheck-suppress uninitvar
(void)std::fabs(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::fabs(ld);
}
void uninitvar_fdim(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)std::fdim(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)std::fdim(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)std::fdim(ld1,ld2);
}
void uninitvar_fclose(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fclose(stream);
}
void uninitvar_ferror(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::ferror(stream);
}
void uninitvar_feof(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::feof(stream);
}
void uninitvar_fflush(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fflush(stream);
}
void uninitvar_fgetc(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fgetc(stream);
}
void uninitvar_fgetwc(void)
{
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fgetwc(stream);
}
void uninitvar_fgetpos(void)
{
FILE* stream;
fpos_t *ptr;
// cppcheck-suppress uninitvar
(void)std::fgetpos(stream,ptr);
}
void uninitvar_floor(void)
{
float f;
// cppcheck-suppress uninitvar
(void)std::floor(f);
double d;
// cppcheck-suppress uninitvar
(void)std::floor(d);
long double ld;
// cppcheck-suppress uninitvar
(void)std::floor(ld);
}
#if 0 // #6958
void uninitvar_fma(void)
{
float f1,f2,f3;
// cppcheck-suppress uninitvar
(void)std::fma(f1,f2,f3);
double d1,d2,d3;
// cppcheck-suppress uninitvar
(void)std::fma(d1,d2,d3);
long double ld1,ld2,ld3;
// cppcheck-suppress uninitvar
(void)std::fma(ld1,ld2,ld3);
}
#endif