Improved std.cfg and added coressponding test cases to test/cfg.

This commit is contained in:
Martin Ettl 2015-09-18 23:57:20 +02:00
parent 841ad5462d
commit 39622417b1
3 changed files with 72 additions and 2 deletions

View File

@ -15,6 +15,16 @@
<not-bool/>
</arg>
</function>
<!-- intmax_t imaxabs(intmax_t n); -->
<function name="imaxabs,std::imaxabs">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<!-- std::proj(std::complex) -->
<function name="std::proj">
<use-retval/>
@ -634,6 +644,19 @@
<valid>:-1,1:</valid>
</arg>
</function>
<!-- imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom); -->
<function name="imaxdiv,std::imaxdiv">
<pure/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
<valid>:-1,1:</valid>
</arg>
</function>
<!-- void exit(int status); -->
<function name="exit,std::exit">
<noreturn>true</noreturn>
@ -3414,7 +3437,9 @@
<!-- unsigned long strtoul(const char *s, char **endp, int base); -->
<!-- long long strtoll(const char *s, char **endp, int base); -->
<!-- unsigned long long strtoull(const char *s, char **endp, int base); -->
<function name="strtol,std::strtol,strtoul,std::strtoul,strtoll,std::strtoll,strtoull,std::strtoull">
<!-- intmax_t strtoimax (const char* str, char** endptr, int base); -->
<!-- uintmax_t strtoumax (const char* str, char** endptr, int base); -->
<function name="strtol,std::strtol,strtoul,std::strtoul,strtoll,std::strtoll,strtoull,std::strtoull,strtoimax,std::strtoimax,strtoumax,std::strtoumax">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3593,7 +3618,9 @@
<!-- long long wcstoll(const wchar_t *s, wchar ** endp, int base); -->
<!-- unsigned long wcstoul(const wchar_t *s, wchar ** endp, int base); -->
<!-- unsigned long long wcstoull(const wchar_t *s, wchar ** endp, int base); -->
<function name="wcstol,std::wcstol,wcstoll,std::wcstoll,wcstoul,std::wcstoul,wcstoull,std::wcstoull">
<!-- intmax_t wcstoimax (const wchar_t* wcs, wchar_t** endptr, int base); -->
<!-- uintmax_t wcstoumax (const wchar_t* wcs, wchar_t** endptr, int base); -->
<function name="wcstol,std::wcstol,wcstoll,std::wcstoll,wcstoul,std::wcstoul,wcstoull,std::wcstoull,wcstoimax,std::wcstoimax,wcstoumax,std::wcstoumax">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>

View File

@ -17,6 +17,7 @@
#include <setjmp.h>
#include <time.h>
#include <stdbool.h>
#include <stdint.h>
void bufferAccessOutOfBounds(void)
{
@ -191,6 +192,13 @@ void nullpointerMemcmp(char *p)
// uninit pointers
void uninivar_abs(void)
{
int i;
// cppcheck-suppress uninitvar
(void)abs(i);
}
void uninit_clearerr(void)
{
FILE *fp;

View File

@ -45,6 +45,15 @@ void uninitvar_abs(void)
(void)std::abs(i);
}
void uninivar_imaxabs(void)
{
intmax_t i;
// cppcheck-suppress uninitvar
(void)std::imaxabs(i);
// cppcheck-suppress uninitvar
(void)imaxabs(i);
}
void uninitvar_isalnum(void)
{
int i;
@ -523,6 +532,16 @@ void uninitvar_div(void)
(void)std::div(num,denom);
}
void uninitvar_imaxdiv(void)
{
intmax_t numer;
intmax_t denom;
// cppcheck-suppress uninitvar
(void)std::imaxdiv(numer,denom);
// cppcheck-suppress uninitvar
(void)imaxdiv(numer,denom);
}
void uninitvar_exit(void)
{
int i;
@ -2447,6 +2466,14 @@ void uninivar_strtol(void)
(void)std::strtoul(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::strtoull(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::strtoimax(s,endp,base);
// cppcheck-suppress uninitvar
(void)strtoimax(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::strtoumax(s,endp,base);
// cppcheck-suppress uninitvar
(void)strtoumax(s,endp,base);
}
void uninitvar_time(void)
@ -2633,6 +2660,14 @@ void uninivar_wcstol(void)
(void)std::wcstoul(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::wcstoull(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::wcstoimax(s,endp,base);
// cppcheck-suppress uninitvar
(void)wcstoimax(s,endp,base);
// cppcheck-suppress uninitvar
(void)std::wcstoumax(s,endp,base);
// cppcheck-suppress uninitvar
(void)wcstoumax(s,endp,base);
}
void uninitvar_wprintf(wchar_t *format, int input)