Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cee9f01

Browse filesBrowse files
committed
CTR55-CPP: improve testfile to doc an expected fp corner case
1 parent 87a623c commit cee9f01
Copy full SHA for cee9f01

File tree

Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed

‎cpp/cert/test/rules/CTR55-CPP/DoNotUseAnAdditiveOperatorOnAnIterator.expected

Copy file name to clipboardExpand all lines: cpp/cert/test/rules/CTR55-CPP/DoNotUseAnAdditiveOperatorOnAnIterator.expected
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
| test.cpp:28:31:28:31 | i | Increment of iterator may overflow since its bounds are not checked. |
66
| test.cpp:41:5:41:8 | end2 | Increment of iterator may overflow since its bounds are not checked. |
77
| test.cpp:53:42:53:42 | i | Increment of iterator may overflow since its bounds are not checked. |
8+
| test.cpp:64:15:64:15 | i | Increment of iterator may overflow since its bounds are not checked. |

‎cpp/cert/test/rules/CTR55-CPP/test.cpp

Copy file name to clipboardExpand all lines: cpp/cert/test/rules/CTR55-CPP/test.cpp
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,14 @@ void test(std::vector<int> &v, std::vector<int> &v2) {
5353
for (auto i = v.begin(); i != end; ++i) { // NON_COMPLIANT - wrong check
5454
}
5555
}
56+
}
57+
58+
void test2(std::vector<int> &v) {
59+
auto i = v.begin();
60+
while (1) {
61+
auto i2 = ((i != v.end()) != 0);
62+
if (!i2)
63+
break;
64+
(void)((++i)); // COMPLIANT[FALSE_POSITIVE]
65+
}
5666
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.