Skip to content

Commit 23f73a9

Browse files
committed
work
1 parent a331a62 commit 23f73a9

File tree

2 files changed

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

2 files changed

+29
-0
lines changed
Lines 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

Lines 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)