From 2fbb25e9bc6650feeeeb7c7c956d655f5f827c51 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Thu, 1 Oct 2015 20:18:06 +0200 Subject: [PATCH] test/std.cfg: Added more test cases and comments. --- test/cfg/runtests.sh | 4 ++-- test/cfg/std.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 37f22f27c..627a02502 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -14,9 +14,9 @@ CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco # Compiler settings CXX=g++ -CXX_OPT='-fsyntax-only -std=c++0x -Wno-format-security -Wno-nonnull' +CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security -Wno-nonnull ' CC=gcc -CC_OPT='-Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only' +CC_OPT='-Wno-format -Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only' # posix.c ${CC} ${CC_OPT} ${DIR}posix.c diff --git a/test/cfg/std.c b/test/cfg/std.c index 618a1985e..2e31ed708 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -21,6 +21,7 @@ #include #include #include +#include void bufferAccessOutOfBounds(void) { @@ -158,7 +159,7 @@ void nullpointer(int value) strtok(NULL,"xyz"); strxfrm(0,"foo",0); - // TODO: error message + // TODO: error message (#6306 and http://trac.cppcheck.net/changeset/d11eb4931aea51cf2cb74faccdcd2a3289b818d6/) strxfrm(0,"foo",42); snprintf(NULL, 0, "someformatstring"); // legal @@ -3668,3 +3669,14 @@ void nullPointer_atof(void) (void)atof(0); } +void invalidPrintfArgType_printf(void) +{ + int i = 0; + // cppcheck-suppress invalidPrintfArgType_float + printf("%f",i); + + // #7016 + uint8_t n = 7; + // cppcheck-suppress invalidPrintfArgType_uint + printf("%"PRIi16"\n", n); +}