From 716b4d6e182611ceed33b66443174738af538593 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Sun, 16 Aug 2015 01:21:11 +0200 Subject: [PATCH] Another attempt to fix the current travis build. Improved testing of std.cfg. --- cfg/std.cfg | 5 ++-- test/cfg/std.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ test/cfg/std.cpp | 30 +++++++++++++++++++++++ test/testmemleak.cpp | 2 +- 4 files changed, 90 insertions(+), 4 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index d93a8580b..c488f0837 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -86,7 +86,6 @@ - true @@ -234,7 +233,7 @@ - + false @@ -258,7 +257,7 @@ - + false diff --git a/test/cfg/std.c b/test/cfg/std.c index ba0ed9100..c0f639446 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -11,6 +11,7 @@ #include #include #include // frexp +#include void bufferAccessOutOfBounds(void) { @@ -401,12 +402,14 @@ void uninitvar_asctime(void) (void)asctime(tm); } +#if 0 void uninitvar_assert(void) { int i; // cppcheck-suppress uninitvar assert(i); } +#endif void uninitvar_sqrt(void) { @@ -558,6 +561,60 @@ void uninitvar_casinh(void) (void)casinhl(ldc); } +void uninitvar_wcsftime(wchar_t* ptr) +{ + size_t maxsize; + wchar_t* format; + struct tm* timeptr; + // cppcheck-suppress uninitvar + (void)wcsftime(ptr, maxsize, format, timeptr); +} + +void uninitvar_tan(void) +{ + float f; + // cppcheck-suppress uninitvar + (void)tanf(f); + + double d; + // cppcheck-suppress uninitvar + (void)tan(d); + + long double ld; + // cppcheck-suppress uninitvar + (void)tanl(ld); +} + +void uninitvar_ctan(void) +{ + float complex fd; + // cppcheck-suppress uninitvars + (void)ctanf(fd); + + double complex dc; + // cppcheck-suppress uninitvar + (void)ctan(dc); + + long double complex ldc; + // cppcheck-suppress uninitvar + (void)ctanl(ldc); +} + +void uninitvar_tanh(void) +{ + float f; + // cppcheck-suppress uninitvar + (void)tanhf(f); + + double d; + // cppcheck-suppress uninitvar + (void)tanh(d); + + long double ld; + // cppcheck-suppress uninitvar + (void)tanhl(ld); +} + void ignoreretrn(void) { char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff"; diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 25ac99d85..425b62900 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -236,3 +236,33 @@ void uninitvar_wcsftime(wchar_t* ptr) // cppcheck-suppress uninitvar (void)std::wcsftime(ptr, maxsize, format, timeptr); } + +void uninitvar_tan(void) +{ + float f; + // cppcheck-suppress uninitvar + (void)std::tan(f); + + double d; + // cppcheck-suppress uninitvar + (void)std::tan(d); + + long double ld; + // cppcheck-suppress uninitvar + (void)std::tan(ld); +} + +void uninitvar_tanh(void) +{ + float f; + // cppcheck-suppress uninitvar + (void)std::tanh(f); + + double d; + // cppcheck-suppress uninitvar + (void)std::tanh(d); + + long double ld; + // cppcheck-suppress uninitvar + (void)std::tanh(ld); +} diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index d526ae4d0..375c12c56 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -4172,7 +4172,7 @@ private: " return 0;\n" "}" ); - ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: buff\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: buff\n", errout.str()); } void trac2540() {