From f653189bd4d6a4eaff6a15d18333a9cf9e7baa53 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Mon, 31 Aug 2015 11:39:25 +0200 Subject: [PATCH] Improved testing of std.cfg and added more test cases. --- cfg/std.cfg | 16 +++++------ test/cfg/std.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ test/cfg/std.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 8 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index c590b3ca9..f69a7d9a3 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -917,7 +917,7 @@ - + false @@ -931,7 +931,7 @@ - + false @@ -947,7 +947,7 @@ - + false @@ -963,7 +963,7 @@ - + false @@ -979,7 +979,7 @@ - + false @@ -993,7 +993,7 @@ - + false @@ -1006,7 +1006,7 @@ - + false @@ -1020,7 +1020,7 @@ - + false diff --git a/test/cfg/std.c b/test/cfg/std.c index 04a8e2fc2..2b703f7f9 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -1226,6 +1226,76 @@ void uninitvar_fmod(void) (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) { char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff"; diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 4e1650a6f..9d15ec8be 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -748,3 +748,73 @@ void uninitvar_fmod(void) // cppcheck-suppress uninitvar (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); +}