File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
cpp/common/test/rules/nonvoidfunctiondoesnotreturn
c/common/test/rules/nonvoidfunctiondoesnotreturn Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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>
24int test_return_f1 (int i) { // NON_COMPLIANT
35 if (i > 100 ) {
You can’t perform that action at this time.
0 commit comments