From c64f9cf9b1502194d848a3bfe4092e724571b90e Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Tue, 29 Sep 2015 21:33:39 +0200 Subject: [PATCH] #7012: Fixed FP in std.cfg by explicitly definining the first parameter of snprintf. --- cfg/std.cfg | 1 + test/cfg/std.c | 3 +-- test/cfg/std.cpp | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index ae96b397c..5e74daf89 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3745,6 +3745,7 @@ false + diff --git a/test/cfg/std.c b/test/cfg/std.c index cfa7d97ed..bee31d29f 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3329,8 +3329,7 @@ void uninivar_snprintf(char *S, size_t N, char *Format, int Int) // cppcheck-suppress uninitvar (void)snprintf(S,N,Format,i); // i is uninitialized // cppcheck-suppress redundantCopy - // cppcheck-suppress uninitvar - (void)snprintf(s,N,Format,Int); // no warning is expected for s (refer to #7012) + (void)snprintf(s,N,Format,Int); } void uninivar_vsnprintf(void) diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 8af4d67c2..eb335b1cd 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2744,14 +2744,24 @@ void uninivar_fwprintf(void) (void)std::fwprintf(stream,format,i); } -void uninivar_snprintf(void) +void uninivar_snprintf(char *S, size_t N, char *Format, int Int) { - char *s; size_t n; char *format; int i; + char *s; // cppcheck-suppress uninitvar (void)std::snprintf(s,n,format,i); + // cppcheck-suppress uninitvar + (void)std::snprintf(S,n,Format,Int); // n is uninitialized + // cppcheck-suppress redundantCopy + // cppcheck-suppress uninitvar + (void)std::snprintf(S,N,format,Int); // format is uninitialized + // cppcheck-suppress redundantCopy + // cppcheck-suppress uninitvar + (void)std::snprintf(S,N,Format,i); // i is uninitialized + // cppcheck-suppress redundantCopy + (void)std::snprintf(s,N,Format,Int); } void uninivar_vsnprintf(void)