Skip to content

Commit 1649c21

Browse files
committed
Improve tests to be more clear on whether certain cases are supported or not
1 parent b2e8f3a commit 1649c21

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

cpp/common/test/rules/readofuninitializedmemory/ReadOfUninitializedMemory.expected

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
| test.cpp:137:13:137:14 | i1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:136:8:136:9 | i1 | i1 |
88
| test.cpp:141:7:141:8 | i3 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:139:8:139:9 | i3 | i3 |
99
| test.cpp:141:13:141:14 | i1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:136:8:136:9 | i1 | i1 |
10-
| test.cpp:205:4:205:5 | p1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:204:8:204:9 | p1 | p1 |
11-
| test.cpp:207:4:207:5 | p1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:204:8:204:9 | p1 | p1 |
12-
| test.cpp:215:10:215:11 | p2 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:209:8:209:9 | p2 | p2 |
13-
| test.cpp:221:4:221:5 | p4 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:219:8:219:9 | p4 | p4 |
10+
| test.cpp:201:7:201:8 | p0 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:200:8:200:9 | p0 | p0 |
11+
| test.cpp:204:4:204:5 | p1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:203:8:203:9 | p1 | p1 |
12+
| test.cpp:206:7:206:8 | p1 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:203:8:203:9 | p1 | p1 |
13+
| test.cpp:211:7:211:8 | p2 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:209:8:209:9 | p2 | p2 |
14+
| test.cpp:214:10:214:11 | p2 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:209:8:209:9 | p2 | p2 |
15+
| test.cpp:221:7:221:8 | p4 | Local variable $@ is read here and may not be initialized on all paths. | test.cpp:219:8:219:9 | p4 | p4 |

cpp/common/test/rules/readofuninitializedmemory/test.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,26 +198,26 @@ void test_class() {
198198

199199
void extra_extra_test() {
200200
int *p0 = new int;
201-
p0; // COMPLIANT -- this is uninitialized but its access not a meaningful read
202-
// to this rule
201+
use(p0); // NON_COMPLIANT
203202

204203
int *p1 = new int;
205204
*p1 = 0; // COMPLIANT[FALSE_POSITIVE] -- this is not found bc this is not an
206205
// lvalue access
207-
*p1; // COMPLIANT[FALSE_POSITIVE] -- the pointee of p1 has been initialized
206+
use(p1); // COMPLIANT[FALSE_POSITIVE] -- the pointee of p1 has been
207+
// initialized
208208

209209
int *p2 = new int;
210210
p2 = new int;
211-
p2; // COMPLIANT -- this is uninitialized but its access not a meaningful read
212-
// to this rule
211+
use(p2); // NON_COMPLIANT
213212

214213
int *p3 = new int(1);
215214
*p3 = *p2; // NON_COMPLIANT -- the pointee of p2 has not been
216215
// initialized
217-
*p3; // NON_COMPLIANT[FALSE_NEGATIVE] -- the pointee of p3 has be overridden
216+
use(p3); // NON_COMPLIANT[FALSE_NEGATIVE] -- the pointee of p3 has be
217+
// overridden
218218

219219
int *p4;
220220
p4 = new int;
221-
*p4; // NON_COMPLIANT -- the pointee of p4 has not been
222-
// initialized
221+
use(p4); // NON_COMPLIANT -- the pointee of p4 has not been
222+
// initialized
223223
}

0 commit comments

Comments
 (0)