Improved testing of std.cfg and added more test cases.

This commit is contained in:
orbitcowboy 2015-08-31 11:39:25 +02:00
parent baced8c9d8
commit f653189bd4
3 changed files with 148 additions and 8 deletions

View File

@ -917,7 +917,7 @@
</arg> </arg>
</function> </function>
<!-- FILE * fopen(const char *filename, const char* mode); --> <!-- FILE * fopen(const char *filename, const char* mode); -->
<function name="fopen"> <function name="fopen,std::fopen">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<arg nr="1"> <arg nr="1">
@ -931,7 +931,7 @@
</arg> </arg>
</function> </function>
<!-- int fprintf(FILE *stream, const char *format, ...); --> <!-- int fprintf(FILE *stream, const char *format, ...); -->
<function name="fprintf"> <function name="fprintf,std::fprintf">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -947,7 +947,7 @@
</arg> </arg>
</function> </function>
<!-- int vfprintf(FILE *stream, const char *format, va_list arg); --> <!-- int vfprintf(FILE *stream, const char *format, va_list arg); -->
<function name="vfprintf"> <function name="vfprintf,std::vfprintf">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -963,7 +963,7 @@
</arg> </arg>
</function> </function>
<!-- int vfwprintf(FILE *stream, const wchar_t *format, va_list arg); --> <!-- int vfwprintf(FILE *stream, const wchar_t *format, va_list arg); -->
<function name="vfwprintf"> <function name="vfwprintf,std::vfwprintf">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -979,7 +979,7 @@
</arg> </arg>
</function> </function>
<!-- int fputc(int c, FILE *stream); --> <!-- int fputc(int c, FILE *stream); -->
<function name="fputc"> <function name="fputc,std::fputc">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -993,7 +993,7 @@
</arg> </arg>
</function> </function>
<!-- wint_t fputwc(wchar_t wc, FILE * stream); --> <!-- wint_t fputwc(wchar_t wc, FILE * stream); -->
<function name="fputwc"> <function name="fputwc,std::fputwc">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -1006,7 +1006,7 @@
</arg> </arg>
</function> </function>
<!-- int fputs(const char *string, FILE* stream); --> <!-- int fputs(const char *string, FILE* stream); -->
<function name="fputs"> <function name="fputs,std::fputs">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -1020,7 +1020,7 @@
</arg> </arg>
</function> </function>
<!-- int fputws(const wchar_t* ws, FILE* stream); --> <!-- int fputws(const wchar_t* ws, FILE* stream); -->
<function name="fputws"> <function name="fputws,std::fputws">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">

View File

@ -1226,6 +1226,76 @@ void uninitvar_fmod(void)
(void)fmodl(ld1,ld2); (void)fmodl(ld1,ld2);
} }
void uninitar_fopen(void)
{
char *filename;
char *mode;
// cppcheck-suppress uninitvar
FILE * fp = fopen(filename, mode);
fclose(fp);
}
void uninitar_fprintf(void)
{
FILE *stream;
char *format;
int argument;
// cppcheck-suppress uninitvar
(void)fprintf(stream, format, argument);
}
void uninitar_vfprintf(void)
{
FILE *stream;
char *format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vfprintf(stream, format, arg);
}
void uninitar_vfwprintf(void)
{
FILE *stream;
wchar_t *format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vfwprintf(stream, format, arg);
}
void uninitvar_fputc(void)
{
int c;
FILE *stream;
// cppcheck-suppress uninitvar
(void)fputc(c,stream);
}
void uninitvar_fputwc(void)
{
wchar_t c;
FILE *stream;
// cppcheck-suppress uninitvar
(void)fputwc(c,stream);
}
void uninitvar_fputs(void)
{
char *string;
FILE *stream;
// cppcheck-suppress uninitvar
(void)fputs(string,stream);
}
void uninitvar_fputws(void)
{
wchar_t *string;
FILE *stream;
// cppcheck-suppress uninitvar
(void)fputws(string,stream);
}
void ignoreretrn(void) void ignoreretrn(void)
{ {
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff"; char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";

View File

@ -748,3 +748,73 @@ void uninitvar_fmod(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)std::fmod(ld1,ld2); (void)std::fmod(ld1,ld2);
} }
void uninitar_fopen(void)
{
char *filename;
char *mode;
// cppcheck-suppress uninitvar
FILE * fp = std::fopen(filename, mode);
fclose(fp);
}
void uninitar_fprintf(void)
{
FILE *stream;
char *format;
int argument;
// cppcheck-suppress uninitvar
(void)std::fprintf(stream, format, argument);
}
void uninitar_vfprintf(void)
{
FILE *stream;
char *format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vfprintf(stream, format, arg);
}
void uninitar_vfwprintf(void)
{
FILE *stream;
wchar_t *format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vfwprintf(stream, format, arg);
}
void uninitvar_fputc(void)
{
int c;
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fputc(c,stream);
}
void uninitvar_fputwc(void)
{
wchar_t c;
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fputwc(c,stream);
}
void uninitvar_fputs(void)
{
char *string;
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fputs(string,stream);
}
void uninitvar_fputws(void)
{
wchar_t *string;
FILE *stream;
// cppcheck-suppress uninitvar
(void)std::fputws(string,stream);
}