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)