Skip to content

Commit 2fbb25e

Browse files
committed
test/std.cfg: Added more test cases and comments.
1 parent dc051f0 commit 2fbb25e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

test/cfg/runtests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ CPPCHECK_OPT='--check-library --enable=information --enable=style --error-exitco
1414

1515
# Compiler settings
1616
CXX=g++
17-
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format-security -Wno-nonnull'
17+
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security -Wno-nonnull '
1818
CC=gcc
19-
CC_OPT='-Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
19+
CC_OPT='-Wno-format -Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
2020

2121
# posix.c
2222
${CC} ${CC_OPT} ${DIR}posix.c

test/cfg/std.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <time.h>
2222
#include <stdbool.h>
2323
#include <stdint.h>
24+
#include <inttypes.h>
2425

2526
void bufferAccessOutOfBounds(void)
2627
{
@@ -158,7 +159,7 @@ void nullpointer(int value)
158159
strtok(NULL,"xyz");
159160

160161
strxfrm(0,"foo",0);
161-
// TODO: error message
162+
// TODO: error message (#6306 and http://trac.cppcheck.net/changeset/d11eb4931aea51cf2cb74faccdcd2a3289b818d6/)
162163
strxfrm(0,"foo",42);
163164

164165
snprintf(NULL, 0, "someformatstring"); // legal
@@ -3668,3 +3669,14 @@ void nullPointer_atof(void)
36683669
(void)atof(0);
36693670
}
36703671

3672+
void invalidPrintfArgType_printf(void)
3673+
{
3674+
int i = 0;
3675+
// cppcheck-suppress invalidPrintfArgType_float
3676+
printf("%f",i);
3677+
3678+
// #7016
3679+
uint8_t n = 7;
3680+
// cppcheck-suppress invalidPrintfArgType_uint
3681+
printf("%"PRIi16"\n", n);
3682+
}

0 commit comments

Comments
 (0)