Improved testing of std.cfg regarding uninitialized variables.

This commit is contained in:
orbitcowboy 2015-09-03 16:34:44 +02:00
parent b16a480dfe
commit 9daf78527f
3 changed files with 181 additions and 7 deletions

View File

@ -2451,7 +2451,7 @@
<!-- double pow(double x, double y); -->
<!-- float powf(float x, float y);-->
<!-- long double powl(long double x, long double y); -->
<function name="pow,powf,powl">
<function name="pow,std::pow,powf,powl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -2481,7 +2481,7 @@
<!-- double remainder(double x, double y); -->
<!-- float remainderf(float x, float y); -->
<!-- long double remainderl(long double x, long double y); -->
<function name="remainder,remainderf,remainderl">
<function name="remainder,std::remainder,remainderf,std::remainderf,remainderl,std::remainderl">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -2496,7 +2496,7 @@
<!-- double remquo(double, x, double y, int *quo); -->
<!-- float remquof(float x, float y, int *quo); -->
<!-- long double remquol(long double x, long double y, int *quo); -->
<function name="remquo,remquof,remquol">
<function name="remquo,std::remquo,remquof,std::remquof,remquol,std::remquol">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -2512,36 +2512,39 @@
</arg>
</function>
<!-- int printf(const char *format, ...); -->
<function name="printf">
<function name="printf,std::printf">
<noreturn>false</noreturn>
<leak-ignore/>
<formatstr/>
<arg nr="1">
<formatstr/>
<not-uninit/>
</arg>
<arg nr="any">
<not-uninit/>
</arg>
</function>
<!-- int vprintf(const char *format, va_list arg); -->
<function name="vprintf">
<function name="vprintf,std::vprintf">
<noreturn>false</noreturn>
<leak-ignore/>
<formatstr/>
<arg nr="1">
<formatstr/>
<not-uninit/>
</arg>
<arg nr="any">
<not-uninit/>
</arg>
</function>
<!-- int vprintf(const wchar_t *format, va_list arg); -->
<function name="vwprintf">
<!-- int vwprintf(const wchar_t *format, va_list arg); -->
<function name="vwprintf,std::vwprintf">
<noreturn>false</noreturn>
<leak-ignore/>
<formatstr/>
<arg nr="1">
<formatstr/>
<not-uninit/>
</arg>
<arg nr="any">
<not-uninit/>

View File

@ -2464,3 +2464,96 @@ void uninivar_perror(void)
// cppcheck-suppress uninitvar
(void)perror(string);
}
void uninitvar_pow(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)powf(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)pow(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)powl(ld1,ld2);
}
void uninitvar_cpow(void)
{
float complex f1,f2;
// cppcheck-suppress uninitvar
(void)cpowf(f1,f2);
double complex d1,d2;
// cppcheck-suppress uninitvar
(void)cpow(d1,d2);
long double complex ld1,ld2;
// cppcheck-suppress uninitvar
(void)cpowl(ld1,ld2);
}
void uninitvar_remainder(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)remainderf(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)remainder(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)remainderl(ld1,ld2);
}
void uninitvar_remquo(void)
{
float f1,f2;
int *i1;
// cppcheck-suppress uninitvar
(void)remquof(f1,f2,i1);
double d1,d2;
int *i2;
// cppcheck-suppress uninitvar
(void)remquo(d1,d2,i2);
long double ld1,ld2;
int *i3;
// cppcheck-suppress uninitvar
(void)remquol(ld1,ld2,i3);
}
void uninivar_printf(void)
{
char * format;
int i;
// no warning is expected
(void)printf("x");
// cppcheck-suppress uninitvar
(void)printf(format,i);
// cppcheck-suppress uninitvar
(void)printf(format,1);
}
void uninivar_vprintf(void)
{
char * format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vprintf(format,arg);
}
void uninivar_vwprintf(void)
{
wchar_t * format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vwprintf(format,arg);
}

View File

@ -1801,3 +1801,81 @@ void uninivar_perror(void)
// cppcheck-suppress uninitvar
(void)std::perror(string);
}
void uninitvar_pow(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)std::pow(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)std::pow(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)std::pow(ld1,ld2);
}
void uninitvar_remainder(void)
{
float f1,f2;
// cppcheck-suppress uninitvar
(void)std::remainderf(f1,f2);
double d1,d2;
// cppcheck-suppress uninitvar
(void)std::remainder(d1,d2);
long double ld1,ld2;
// cppcheck-suppress uninitvar
(void)std::remainderl(ld1,ld2);
}
void uninitvar_remquo(void)
{
float f1,f2;
int *i1;
// cppcheck-suppress uninitvar
(void)std::remquof(f1,f2,i1);
double d1,d2;
int *i2;
// cppcheck-suppress uninitvar
(void)std::remquo(d1,d2,i2);
long double ld1,ld2;
int *i3;
// cppcheck-suppress uninitvar
(void)std::remquol(ld1,ld2,i3);
}
void uninivar_printf(void)
{
char * format;
int i;
// no warning is expected
(void)std::printf("x");
// cppcheck-suppress uninitvar
(void)std::printf(format,i);
// cppcheck-suppress uninitvar
(void)std::printf(format,1);
}
void uninivar_vprintf(void)
{
char * format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vprintf(format,arg);
}
void uninivar_vwprintf(void)
{
wchar_t * format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vwprintf(format,arg);
}