gnu.cfg: Added tests for mkostemp(), mkstemps() and mkostemps() functions. The test script 'test/cfg/runtests.sh' is now loading posix.cfg when checking gnu.cfg. Otherwise 'close()' was not available to Cppcheck, which lead to an error when 'make checkcfg' was executed.
This commit is contained in:
parent
0469111750
commit
e48d785ea4
|
@ -15,6 +15,59 @@
|
|||
#include <sys/epoll.h>
|
||||
#endif
|
||||
|
||||
void resourceLeak_mkostemps(char *template, int suffixlen, int flags)
|
||||
{
|
||||
// cppcheck-suppress unreadVariable
|
||||
int fp = mkostemps(template, suffixlen, flags);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void no_resourceLeak_mkostemps_01(char *template, int suffixlen, int flags)
|
||||
{
|
||||
int fp = mkostemps(template, suffixlen, flags);
|
||||
close(fp);
|
||||
}
|
||||
|
||||
int no_resourceLeak_mkostemps_02(char *template, int suffixlen, int flags)
|
||||
{
|
||||
return mkostemps(template, suffixlen, flags);
|
||||
}
|
||||
|
||||
void resourceLeak_mkstemps(char *template, int suffixlen)
|
||||
{
|
||||
// cppcheck-suppress unreadVariable
|
||||
int fp = mkstemps(template, suffixlen);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void no_resourceLeak_mkstemps_01(char *template, int suffixlen)
|
||||
{
|
||||
int fp = mkstemps(template, suffixlen);
|
||||
close(fp);
|
||||
}
|
||||
|
||||
int no_resourceLeak_mkstemps_02(char *template, int suffixlen)
|
||||
{
|
||||
return mkstemps(template, suffixlen);
|
||||
}
|
||||
|
||||
void resourceLeak_mkostemp(char *template, int flags)
|
||||
{
|
||||
// cppcheck-suppress unreadVariable
|
||||
int fp = mkostemp(template, flags);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void no_resourceLeak_mkostemp_01(char *template, int flags)
|
||||
{
|
||||
int fp = mkostemp(template, flags);
|
||||
close(fp);
|
||||
}
|
||||
|
||||
int no_resourceLeak_mkostemp_02(char *template, int flags)
|
||||
{
|
||||
return mkostemp(template, flags);
|
||||
}
|
||||
|
||||
void valid_code(int argInt1)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ ${CPPCHECK} ${CPPCHECK_OPT} --library=posix ${DIR}posix.c
|
|||
|
||||
# gnu.c
|
||||
${CC} ${CC_OPT} -D_GNU_SOURCE ${DIR}gnu.c
|
||||
${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c
|
||||
${CPPCHECK} ${CPPCHECK_OPT} --library=posix,gnu ${DIR}gnu.c
|
||||
|
||||
# qt.cpp
|
||||
set +e
|
||||
|
|
Loading…
Reference in New Issue