test/cfg: Improved testing of std.cfg regarding uninitialized and nullPointer checks.
This commit is contained in:
parent
3187a2b972
commit
fd81ee9804
17
cfg/std.cfg
17
cfg/std.cfg
|
@ -463,7 +463,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int atexit(void (*func)(void)); -->
|
||||
<function name="atexit">
|
||||
<function name="atexit,std::atexit">
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
|
@ -471,22 +471,11 @@
|
|||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- double atof(const char *s); -->
|
||||
<function name="atof">
|
||||
<use-retval/>
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<strz/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int atoi(const char *s); -->
|
||||
<!-- long int atol(const char *s); -->
|
||||
<!-- long long int atoll(const char *s); -->
|
||||
<function name="atoi,atol,atoll,std::atoi,std::atol,std::atoll">
|
||||
<!-- double atof(const char *s); -->
|
||||
<function name="atoi,atol,atoll,std::atoi,std::atol,std::atoll,atof,std::atof">
|
||||
<use-retval/>
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
|
|
|
@ -14,9 +14,9 @@ CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco
|
|||
|
||||
# Compiler settings
|
||||
CXX=g++
|
||||
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format-security'
|
||||
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format-security -Wno-nonnull'
|
||||
CC=gcc
|
||||
CC_OPT='-Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -fsyntax-only'
|
||||
CC_OPT='-Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
|
||||
|
||||
# posix.c
|
||||
${CC} ${CC_OPT} ${DIR}posix.c
|
||||
|
|
|
@ -789,6 +789,13 @@ void uninitvar_atan2(void)
|
|||
(void)atan2l(ld1,ld2);
|
||||
}
|
||||
|
||||
void uninitvar_atof(void)
|
||||
{
|
||||
char * c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)atof(c);
|
||||
}
|
||||
|
||||
void uninitvar_atol(void)
|
||||
{
|
||||
char * c;
|
||||
|
@ -3445,3 +3452,36 @@ void nullPointer_fesetenv(void)
|
|||
(void)fesetenv(0);
|
||||
}
|
||||
|
||||
void nullPointer_fesetexceptflag(int excepts)
|
||||
{
|
||||
fexcept_t* flagp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)fesetexceptflag(flagp,excepts);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)fesetexceptflag(0,excepts);
|
||||
}
|
||||
|
||||
void nullPointer_feupdateenv(void)
|
||||
{
|
||||
fenv_t* envp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)feupdateenv(envp);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)feupdateenv(0);
|
||||
}
|
||||
|
||||
void nullPointer_atexit(void)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)atexit(0);
|
||||
}
|
||||
|
||||
void nullPointer_atof(void)
|
||||
{
|
||||
char * c = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)atof(c);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)atof(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -350,6 +350,13 @@ void uninitvar_atan2(void)
|
|||
(void)std::atan2(ld1,ld2);
|
||||
}
|
||||
|
||||
void uninitvar_atof(void)
|
||||
{
|
||||
char * c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::atof(c);
|
||||
}
|
||||
|
||||
void uninitvar_atol(void)
|
||||
{
|
||||
char * c;
|
||||
|
@ -2799,3 +2806,36 @@ void nullPointer_fesetenv(void)
|
|||
// cppcheck-suppress nullPointer
|
||||
(void)std::fesetenv(0);
|
||||
}
|
||||
|
||||
void nullPointer_fesetexceptflag(int excepts)
|
||||
{
|
||||
fexcept_t* flagp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::fesetexceptflag(flagp,excepts);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::fesetexceptflag(0,excepts);
|
||||
}
|
||||
|
||||
void nullPointer_feupdateenv(void)
|
||||
{
|
||||
fenv_t* envp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::feupdateenv(envp);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::feupdateenv(0);
|
||||
}
|
||||
|
||||
void nullPointer_atexit(void)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::atexit(0);
|
||||
}
|
||||
|
||||
void nullPointer_atof(void)
|
||||
{
|
||||
char * c = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::atof(c);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::atof(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue