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 23f73a9

Browse filesBrowse files
committed
work
1 parent a331a62 commit 23f73a9
Copy full SHA for 23f73a9

File tree

2 files changed

+29
-0
lines changed
Filter options
  • c/common/test/rules/nonvoidfunctiondoesnotreturn
  • cpp/common/test/rules/nonvoidfunctiondoesnotreturn

2 files changed

+29
-0
lines changed
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
#include <cstdlib>
4+
int test_return_f1(int i) { // NON_COMPLIANT
5+
if (i > 100) {
6+
return i;
7+
}
8+
}
9+
10+
int test_return_f2(int i) { // COMPLIANT
11+
if (i > 0) {
12+
return i;
13+
} else {
14+
return -i;
15+
}
16+
}
17+
18+
int test_return_f3(int i) {} // NON_COMPLIANT
19+
20+
int test_return_f5(int i) { // NON_COMPLIANT
21+
if (i > 0) {
22+
return i;
23+
}
24+
if (i < 0) {
25+
return -i;
26+
}
27+
}

‎cpp/common/test/rules/nonvoidfunctiondoesnotreturn/test.cpp

Copy file name to clipboardExpand all lines: cpp/common/test/rules/nonvoidfunctiondoesnotreturn/test.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
#include <cstdlib>
24
int test_return_f1(int i) { // NON_COMPLIANT
35
if (i > 100) {

0 commit comments

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