Skip to content

Commit 6c0305c

Browse files
authored
Merge pull request #495 from geoffw0/returnvalue
CPP: Fix 'Missing return statement'
2 parents cc28d04 + 5cae652 commit 6c0305c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cpp/ql/src/jsf/4.13 Functions/AV Rule 114.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ predicate functionImperfectlyExtracted(Function f) {
3838
exists(CompilerError e | f.getBlock().getLocation().subsumes(e.getLocation()))
3939
or
4040
exists(ErrorExpr ee | ee.getEnclosingFunction() = f)
41+
or
42+
count(f.getType()) > 1
4143
}
4244

4345
from Stmt stmt, string msg, Function f, ControlFlowNode blame

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@ int f12(int x)
8484
// ...
8585
}
8686
}
87+
88+
void f13()
89+
{
90+
f13_func(); // implicitly declared here
91+
}
92+
93+
void f13_func(int x)
94+
{
95+
if (x < 10) return; // GOOD
96+
}

0 commit comments

Comments
 (0)