From 2b416419de727db2e75c6d878d9e5f8057377c0e Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 9 Sep 2015 16:59:26 +0200 Subject: [PATCH] test/cfg: Improved testing of std.cfg regarding uninitialized variables. --- cfg/std.cfg | 15 ++++++++------- test/cfg/std.c | 17 +++++++++++++++++ test/cfg/std.cpp | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index fb440d570..66f4b2fd6 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3751,7 +3751,7 @@ - + false @@ -3759,7 +3759,7 @@ - + false @@ -3767,7 +3767,7 @@ - + false @@ -3775,7 +3775,7 @@ - + false @@ -3783,7 +3783,7 @@ - + false @@ -3791,7 +3791,7 @@ - + false @@ -3811,7 +3811,8 @@ - + + false diff --git a/test/cfg/std.c b/test/cfg/std.c index 2f84fec1a..edced6778 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3350,3 +3350,20 @@ void uninitvar_system(void) // cppcheck-suppress uninitvar (void)system(c); } + +void uninitvar_zonetime(void) +{ + time_t *tp; + int zone; + // cppcheck-suppress uninitvar + (void)zonetime(tp,zone); +} + +void uninitvar_itoa(void) +{ + int value; + char * str; + int base; + // cppcheck-suppress uninitvar + (void)itoa(value,str,base); +} diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index b964227ea..110811091 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2676,3 +2676,36 @@ void uninitvar_setiosflags(void) // cppcheck-suppress uninitvar std::cout << std::setiosflags(mask); // #6987 - false negative } + +void uninitvar_resetiosflags(void) +{ + std::ios_base::fmtflags mask; + // cppcheck-suppress uninitvar + std::cout << std::resetiosflags(mask); // #6987 - false negative +} + +void uninitvar_setfill(void) +{ + char c; + // cppcheck-suppress uninitvar + std::cout << std::setfill(c); + + wchar_t wc; + // cppcheck-suppress uninitvar + std::wcout << std::setfill(wc); +} + +void uninitvar_setprecision(void) +{ + int p; + // cppcheck-suppress uninitvar + std::cout << std::setprecision(p); +} + +void uninitvar_setbase(void) +{ + int p; + // cppcheck-suppress uninitvar + std::cout << std::setbase(p); +} +