Skip to content

Commit e932c44

Browse files
committed
generate cfg tests: updated NULL pointer testing
1 parent f7d537e commit e932c44

12 files changed

Lines changed: 59657 additions & 42893 deletions

test/cfg/generated-cfg-tests-avr.cpp

Lines changed: 682 additions & 498 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-bsd.cpp

Lines changed: 273 additions & 203 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-gnu.cpp

Lines changed: 1413 additions & 1047 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-motif.cpp

Lines changed: 581 additions & 423 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-posix.cpp

Lines changed: 7716 additions & 5580 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-qt.cpp

Lines changed: 1855 additions & 1313 deletions
Large diffs are not rendered by default.

test/cfg/generated-cfg-tests-sdl.cpp

Lines changed: 110 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,122 +8,153 @@
88
// => 'unmatched suppression' warnings are false negatives.
99
//
1010

11-
void test__SDL_mutexP__noreturn() {
12-
int x = 1;
13-
if (cond) { x=100; SDL_mutexP(arg1); }
14-
// cppcheck-suppress shiftTooManyBits
15-
x = 1 << x;
11+
void test__SDL_mutexP__noreturn()
12+
{
13+
int x = 1;
14+
if (cond) {
15+
x=100;
16+
SDL_mutexP(arg1);
17+
}
18+
// cppcheck-suppress shiftTooManyBits
19+
x = 1 << x;
1620
}
1721

18-
void test__SDL_mutexP__arg1__notbool() {
19-
// cppcheck-suppress invalidFunctionArgBool
20-
SDL_mutexP(!x);
22+
void test__SDL_mutexP__arg1__notbool()
23+
{
24+
// cppcheck-suppress invalidFunctionArgBool
25+
SDL_mutexP(!x);
2126
}
2227

23-
void test__SDL_mutexP__arg1__notnull() {
24-
const char *p = NULL;
25-
// cppcheck-suppress nullPointer
26-
SDL_mutexP(p);
28+
void test__SDL_mutexP__arg1__notnull()
29+
{
30+
// cppcheck-suppress nullPointer
31+
SDL_mutexP(NULL);
2732
}
2833

29-
void test__SDL_mutexV__noreturn() {
30-
int x = 1;
31-
if (cond) { x=100; SDL_mutexV(arg1); }
32-
// cppcheck-suppress shiftTooManyBits
33-
x = 1 << x;
34+
void test__SDL_mutexV__noreturn()
35+
{
36+
int x = 1;
37+
if (cond) {
38+
x=100;
39+
SDL_mutexV(arg1);
40+
}
41+
// cppcheck-suppress shiftTooManyBits
42+
x = 1 << x;
3443
}
3544

36-
void test__SDL_mutexV__arg1__notbool() {
37-
// cppcheck-suppress invalidFunctionArgBool
38-
SDL_mutexV(!x);
45+
void test__SDL_mutexV__arg1__notbool()
46+
{
47+
// cppcheck-suppress invalidFunctionArgBool
48+
SDL_mutexV(!x);
3949
}
4050

41-
void test__SDL_mutexV__arg1__notnull() {
42-
const char *p = NULL;
43-
// cppcheck-suppress nullPointer
44-
SDL_mutexV(p);
51+
void test__SDL_mutexV__arg1__notnull()
52+
{
53+
// cppcheck-suppress nullPointer
54+
SDL_mutexV(NULL);
4555
}
4656

47-
void test__SDL_RWsize__noreturn() {
48-
int x = 1;
49-
if (cond) { x=100; SDL_RWsize(arg1); }
50-
// cppcheck-suppress shiftTooManyBits
51-
x = 1 << x;
57+
void test__SDL_RWsize__noreturn()
58+
{
59+
int x = 1;
60+
if (cond) {
61+
x=100;
62+
SDL_RWsize(arg1);
63+
}
64+
// cppcheck-suppress shiftTooManyBits
65+
x = 1 << x;
5266
}
5367

54-
void test__SDL_RWsize__arg1__notbool() {
55-
// cppcheck-suppress invalidFunctionArgBool
56-
SDL_RWsize(!x);
68+
void test__SDL_RWsize__arg1__notbool()
69+
{
70+
// cppcheck-suppress invalidFunctionArgBool
71+
SDL_RWsize(!x);
5772
}
5873

59-
void test__SDL_RWsize__arg1__notnull() {
60-
const char *p = NULL;
61-
// cppcheck-suppress nullPointer
62-
SDL_RWsize(p);
74+
void test__SDL_RWsize__arg1__notnull()
75+
{
76+
// cppcheck-suppress nullPointer
77+
SDL_RWsize(NULL);
6378
}
6479

65-
void test__SDL_RWread__noreturn() {
66-
int x = 1;
67-
if (cond) { x=100; SDL_RWread(arg1, arg2); }
68-
// cppcheck-suppress shiftTooManyBits
69-
x = 1 << x;
80+
void test__SDL_RWread__noreturn()
81+
{
82+
int x = 1;
83+
if (cond) {
84+
x=100;
85+
SDL_RWread(arg1, arg2);
86+
}
87+
// cppcheck-suppress shiftTooManyBits
88+
x = 1 << x;
7089
}
7190

72-
void test__SDL_RWread__arg1__notbool() {
73-
// cppcheck-suppress invalidFunctionArgBool
74-
SDL_RWread(!x, arg2);
91+
void test__SDL_RWread__arg1__notbool()
92+
{
93+
// cppcheck-suppress invalidFunctionArgBool
94+
SDL_RWread(!x, arg2);
7595
}
7696

77-
void test__SDL_RWread__arg1__notnull() {
78-
const char *p = NULL;
79-
// cppcheck-suppress nullPointer
80-
SDL_RWread(p, arg2);
97+
void test__SDL_RWread__arg1__notnull()
98+
{
99+
// cppcheck-suppress nullPointer
100+
SDL_RWread(NULL, arg2);
81101
}
82102

83-
void test__SDL_RWread__arg2__notbool() {
84-
// cppcheck-suppress invalidFunctionArgBool
85-
SDL_RWread(arg1, !x);
103+
void test__SDL_RWread__arg2__notbool()
104+
{
105+
// cppcheck-suppress invalidFunctionArgBool
106+
SDL_RWread(arg1, !x);
86107
}
87108

88-
void test__SDL_RWread__arg2__notnull() {
89-
const char *p = NULL;
90-
// cppcheck-suppress nullPointer
91-
SDL_RWread(arg1, p);
109+
void test__SDL_RWread__arg2__notnull()
110+
{
111+
// cppcheck-suppress nullPointer
112+
SDL_RWread(arg1, NULL);
92113
}
93114

94-
void test__IMG_isPNG__noreturn() {
95-
int x = 1;
96-
if (cond) { x=100; IMG_isPNG(arg1); }
97-
// cppcheck-suppress shiftTooManyBits
98-
x = 1 << x;
115+
void test__IMG_isPNG__noreturn()
116+
{
117+
int x = 1;
118+
if (cond) {
119+
x=100;
120+
IMG_isPNG(arg1);
121+
}
122+
// cppcheck-suppress shiftTooManyBits
123+
x = 1 << x;
99124
}
100125

101-
void test__IMG_isPNG__arg1__notbool() {
102-
// cppcheck-suppress invalidFunctionArgBool
103-
IMG_isPNG(!x);
126+
void test__IMG_isPNG__arg1__notbool()
127+
{
128+
// cppcheck-suppress invalidFunctionArgBool
129+
IMG_isPNG(!x);
104130
}
105131

106-
void test__IMG_isPNG__arg1__notnull() {
107-
const char *p = NULL;
108-
// cppcheck-suppress nullPointer
109-
IMG_isPNG(p);
132+
void test__IMG_isPNG__arg1__notnull()
133+
{
134+
// cppcheck-suppress nullPointer
135+
IMG_isPNG(NULL);
110136
}
111137

112-
void test__IMG_isJPG__noreturn() {
113-
int x = 1;
114-
if (cond) { x=100; IMG_isJPG(arg1); }
115-
// cppcheck-suppress shiftTooManyBits
116-
x = 1 << x;
138+
void test__IMG_isJPG__noreturn()
139+
{
140+
int x = 1;
141+
if (cond) {
142+
x=100;
143+
IMG_isJPG(arg1);
144+
}
145+
// cppcheck-suppress shiftTooManyBits
146+
x = 1 << x;
117147
}
118148

119-
void test__IMG_isJPG__arg1__notbool() {
120-
// cppcheck-suppress invalidFunctionArgBool
121-
IMG_isJPG(!x);
149+
void test__IMG_isJPG__arg1__notbool()
150+
{
151+
// cppcheck-suppress invalidFunctionArgBool
152+
IMG_isJPG(!x);
122153
}
123154

124-
void test__IMG_isJPG__arg1__notnull() {
125-
const char *p = NULL;
126-
// cppcheck-suppress nullPointer
127-
IMG_isJPG(p);
155+
void test__IMG_isJPG__arg1__notnull()
156+
{
157+
// cppcheck-suppress nullPointer
158+
IMG_isJPG(NULL);
128159
}
129160

0 commit comments

Comments
 (0)