summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Wesolowski2011-06-27 20:29:36 (EDT)
committer Alena Laskavaia2011-06-27 20:47:43 (EDT)
commit6b80326e1789315fc94f20aedf3e38b67f218a89 (patch)
tree17a3ddd1db9f2144aa1b43054182e7d773644e22
parent2041eb9870092b33d3fad240b840e216e5adac7a (diff)
downloadorg.eclipse.cdt-6b80326e1789315fc94f20aedf3e38b67f218a89.zip
org.eclipse.cdt-6b80326e1789315fc94f20aedf3e38b67f218a89.tar.gz
org.eclipse.cdt-6b80326e1789315fc94f20aedf3e38b67f218a89.tar.bz2
Bug 345687 - [fp] "No return, in function returning non-void" for
compound statement at the end
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java10
2 files changed, 11 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index b917dec..86a9d9e 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -192,7 +192,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
*/
private boolean isCompoundStatement(IASTStatement last) {
return last instanceof IASTIfStatement || last instanceof IASTWhileStatement || last instanceof IASTDoStatement
- || last instanceof IASTForStatement || last instanceof IASTSwitchStatement;
+ || last instanceof IASTForStatement || last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
}
protected boolean isFuncExitStatement(IASTStatement statement) {
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
index b69f416..aba8192 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -256,6 +256,16 @@ public class ReturnCheckerTest extends CheckerTestCase {
checkErrorLine(1);
}
+ // int f345687() {
+ // {
+ // return 0;
+ // }
+ // }
+ public void testNextedBlock_Bug345687() {
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
+
// int
// fp_goto(int a)
// {