From 75124317e994a82a06b7c338fbd21a4c79d81de2 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 4 Nov 2016 14:03:48 +0100 Subject: [PATCH] std.cfg: Added returnValue support for iswblank(). --- cfg/std.cfg | 1 + test/cfg/std.c | 13 +++++++++++-- test/cfg/std.cpp | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index bdb8dc36a..fe8c92150 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -1543,6 +1543,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun false + arg1==L' ' || arg1==L'\t' diff --git a/test/cfg/std.c b/test/cfg/std.c index 300674530..20a9125ba 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3692,8 +3692,9 @@ void invalidPrintfArgType_printf(void) void valueFlow(void) { const char abc[] = "abc"; - int three = 3, minusThree = -3; - int c0='0', ca='a', blank=' ', tab='\t'; + const int three = 3, minusThree = -3; + const int c0='0', ca='a', blank=' ', tab='\t'; + const wint_t wblank=L' ', wtab=L'\t', w0=L'0'; // When adding functions below, please sort alphabetically. @@ -3713,6 +3714,14 @@ void valueFlow(void) AssertAlwaysTrue(isdigit(c0) == 1); // cppcheck-suppress knownConditionTrueFalse AssertAlwaysTrue(isdigit(ca) == 0); + + // cppcheck-suppress knownConditionTrueFalse + AssertAlwaysTrue(iswblank(wblank) == 1); + // cppcheck-suppress knownConditionTrueFalse + AssertAlwaysTrue(iswblank(wtab) == 1); + // cppcheck-suppress knownConditionTrueFalse + AssertAlwaysTrue(iswblank(w0) == 0); + // cppcheck-suppress knownConditionTrueFalse AssertAlwaysTrue(labs(three) == 3); // cppcheck-suppress knownConditionTrueFalse diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index b9a02a217..4494d81e0 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -3218,6 +3218,6 @@ void stdalgorithm(const std::list &ints1, const std::list &ints2) // // cppcheck-suppress mismatchingContainers - std::for_each(ints1.begin(), ints2.end(), [](int i){}); + std::for_each(ints1.begin(), ints2.end(), [](int i) {}); }