test/std.cfg: Added more test cases and comments.

This commit is contained in:
Martin Ettl 2015-10-01 20:18:06 +02:00
parent dc051f077d
commit 2fbb25e9bc
2 changed files with 15 additions and 3 deletions

View File

@ -14,9 +14,9 @@ CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco
# Compiler settings # Compiler settings
CXX=g++ 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=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 # posix.c
${CC} ${CC_OPT} ${DIR}posix.c ${CC} ${CC_OPT} ${DIR}posix.c

View File

@ -21,6 +21,7 @@
#include <time.h> #include <time.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <inttypes.h>
void bufferAccessOutOfBounds(void) void bufferAccessOutOfBounds(void)
{ {
@ -158,7 +159,7 @@ void nullpointer(int value)
strtok(NULL,"xyz"); strtok(NULL,"xyz");
strxfrm(0,"foo",0); strxfrm(0,"foo",0);
// TODO: error message // TODO: error message (#6306 and http://trac.cppcheck.net/changeset/d11eb4931aea51cf2cb74faccdcd2a3289b818d6/)
strxfrm(0,"foo",42); strxfrm(0,"foo",42);
snprintf(NULL, 0, "someformatstring"); // legal snprintf(NULL, 0, "someformatstring"); // legal
@ -3668,3 +3669,14 @@ void nullPointer_atof(void)
(void)atof(0); (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);
}